Intro Howdy! I'm Professor Curtis of Aspire Mountain Academy here with more statistics homework help. Today we're going to learn how to determine the sample space size for computer program variable names. Here's our problem statement: A common computer programming rule is that names of variables must be between one and eight characters long. The first character can be any of the 26 letters while successive characters can be any of the 26 letters or any of the 10 digits. For example, allowable variable names include A, BB, and M3477K. How many different variable names are possible? Ignore the differences between upper and lower case letters. Solution OK, to solve this problem, I'm going to whip out my calculator, and we're going to show you here how we can actually calculate this out, because we're gonna have to look at each of the different possibilities and put them together. So let's just start with the possibility that our character name is one character long. Most students, when they're solving this problem, they start at the other end. They say, "It's between one and eight characters, so I'll just start with the highest eight characters." But as I'll show you here later in the video, that leads to what we call a distractor answer option. And you don't want to pick the distractor because it distracts you from picking the right answer.
So let's just start with assuming you got one character name. So how many possibilities do we have? Well, the first character can be any of the 26 letters of the alphabet. So I've got 26 possibilities. Now what if the character name is two characters long? Well, I got to add in those possibilities. And if the character name is two characters long, I've got the first character [which] can be any of the 26 layers of the alphabet. The second character can be any of the 26 letters or any of 10 digits . So there's 36 possibilities for that second character. Now what if we have a character name that's three characters long? We've got to add that in. So again, the first character can be 26 characters and then the remaining two characters, both of them can be 36 characters long. So I'll just square the 36 there to give me both of those. And now we're looking at what if the character name is four characters long. So I got 26 for that first character and then I've got 36 for the ones that remain. So let's raise that to the third power because we've got four characters total. And now you see I'm just going to go through the same process for each of the remaining a possible characters in the character length. So I've got 26 here for the first one times 36 raised to the fourth power that takes care of five characters in the character name. And then we're going to look at six characters. So I've got a 26 in for the first and then 36 for the remaining five. And we're working our way up there. You can see the number here is getting bigger. I've got 26 for the first character, and then for six variable names --- or excuse me, six characters in the variable name, you've got 36 raised to the fifth power. We already had that with the fifth power. So let me go back and put that to the sixth power. Now this is seven variables in the seven characters rather in the variable name. Something's not right. No, no. We're looking at it here. So I've got 26 times --- something doesn't look right. Uh, yeah, 36 raised to the seventh power, and wow! Hey, yeah, look at this. This is actually the distractor element that I was telling you about before. So this last term here is if we looking at eight characters, right? Because we've got 26 for the first and then 36 for the remaining seven. So this last term by itself is . . . so that'd be, that'd be that. There's the million mark. There's the one billion mark --- 2,037,468,266,496. And notice that's one of your answer options right here. This is a distractor element that I was telling you about before, because this number includes only the possibilities if your variable name is eight characters long, but it doesn't include all these other terms that are accounting for the variable name being less than eight characters long. So when we add all those together, now we get the proper answer, which you can see right here. Good job! And that's how we do it at Aspire Mountain Academy. Be sure to leave your comments below and let us know how good a job we did or how we can improve. And if your stats teacher is boring or just doesn't want to help you learn stats, go to aspiremountainacademy.com, where you can learn more about accessing our lecture videos or provide feedback on what you'd like to see. Thanks for watching! We'll see you in the next video.
0 Comments
Leave a Reply. |
AuthorFrustrated with a particular MyStatLab/MyMathLab homework problem? No worries! I'm Professor Curtis, and I'm here to help. Archives
July 2020
|
Stats
|
Company |
|