Wagstaff, Kiri L: accorded for the benefit of anyone who is not able to log in.
Wagstaff, Kiri L: So keep that in mind. And we will be doing a big experiment here. This is the making personal history for me. And this is the largest zoom meeting. I've ever been in.
Wagstaff, Kiri L: We have a lot of people logged in. So we want to keep that pretty orderly everybody's muted. But you are so welcome to ask a question at any time. So all you do to do that is click the raise hand.
Wagstaff, Kiri L: Button and that will show up for me and then I can give you the floor. So you can ask your question.
Wagstaff, Kiri L: So,
Wagstaff, Kiri L: Let's see, what else, basically, I know that you may have a lot of uncertainty. Right now, we have had a lot of craziness going on and you may be nervous about this class, and many other things going on in your life and I completely understand that.
Wagstaff, Kiri L: So I want you to know that I am doing my best to try to keep things going. And to adapt to the situation as it evolves and to share that information with you so
Wagstaff, Kiri L: Know that I have your best interests at heart. This is we're going to do what we can to finish out this term and then resume with spring.
Wagstaff, Kiri L: But be aware, there may be some bumps and some difficulties and some changing requirements as we figure this out because we're going into uncharted territory.
Wagstaff, Kiri L: Now for today. Our main goal is to be able to prepare for the final exam, but I do have a couple of the things I wanted to address first
Wagstaff, Kiri L: So as you will have seen through email. We've converted the proficiency demo, just to a regular lab. So you have or will receive depending on whether you've done your lab so far, a score of 01 or 10 on that lab and
Wagstaff, Kiri L: Please don't graffiti the screen while we're doing this just so it's not confusing for the other students.
Wagstaff, Kiri L: If you do not get a 10, which is what we were using to indicate a pass on that your coarse grained will not be reduced to the 72%
Wagstaff, Kiri L: Maximum which was what proficiency demo was originally going to do right so that's the great news is stakes are lower here. It's just a regular lab. You just need to complete it. If you don't pass the demo and you get like a one or a zero indicating that you weren't there at all.
Wagstaff, Kiri L: Then it would just act as a regular lab.
Wagstaff, Kiri L: Which works out to a maximum of 1% of your final grade.
Wagstaff, Kiri L: We will not be having an in person makeup proficiency demo be, you know, given University requirements at this time and
Wagstaff, Kiri L: basic common sense. It seems like not a good idea to have any more in person gatherings than we need. So I just want you to be informed about that.
Wagstaff, Kiri L: Anybody have a question about the proficiency demo slash lab 10 you'd like to ask now just raise your hand. Okay. We do have one here. So Dylan. Go ahead.
Dylan Karambut: Yeah, so basically proficiency demo is my failed the prophecy to demo, if not fell VCs will just be one itself, right, just to clarify,
Wagstaff, Kiri L: Yes. That's exactly right. We
Wagstaff, Kiri L: It does not impact.
Wagstaff, Kiri L: Clothing as a lab scored with a every other Lab does.
Dylan Karambut: So perfect. Thank you.
Wagstaff, Kiri L: I'm sure other
Wagstaff, Kiri L: That same question. So thank you for asking that.
Wagstaff, Kiri L: Anything else about the person proficiency done well, you want to ask at this time.
Wagstaff, Kiri L: Okay. Oh, we have one more. Go ahead. Let's see, where's my mouse.
Wagstaff, Kiri L: Go ahead, Casey.
Casey: I was just wondering why you made it less
Wagstaff, Kiri L: Why we've adopted it this way.
Wagstaff, Kiri L: Yeah. Yes.
Wagstaff, Kiri L: Partly because we don't have the ability to do make ups and normally we would offer that option. So this is the US being generous option here.
Wagstaff, Kiri L: All right.
Wagstaff, Kiri L: Then reminder that we do have a survey on canvas that you can give your opinion of the course materials and how useful. They've been for you, which is very, very helpful for our for us for the course and that survey is open until midnight tonight on canvas.
Wagstaff, Kiri L: And I just realized my video was not on so you couldn't see me could you
Wagstaff, Kiri L: Are you able to see me now.
Wagstaff, Kiri L: Yes. Okay, great. It's not showing me so I have no idea what you're saying but hi everybody.
Wagstaff, Kiri L: For the final exam itself. This will be take place that I
Wagstaff, Kiri L: Take place at our regular time from six to 7:50pm it just will not take place in person. It will all be on canvas.
Wagstaff, Kiri L: It will have the same format. And as we've been expecting, true, false, and multiple choice, no short answer. The exam duration is an hour and 15 minutes long, so
Wagstaff, Kiri L: Same duration that you're expecting as well.
Wagstaff, Kiri L: And I'm giving a little extra time at the end for the final submission, just in case you try to, you try to start the exam at six. But there's a problem. You have to reboot your computer or something.
Wagstaff, Kiri L: And you end up starting a little bit later 605 or 610, you can still have an hour and 15 minutes so it won't, it won't shut things down until 8:15pm on March 16
Wagstaff, Kiri L: Just in case you were delayed starting. But if you are still working on the exam at that point canvas will auto submit whatever you've done so far at 815
Wagstaff, Kiri L: So just keep that in mind. It's really good to get started right at six. If you can, but don't stress out if you have a few minutes delay, you'll still get the full duration of time available for you.
Wagstaff, Kiri L: And I will also I'm adding some virtual office hours today through zoom right after this class. It's a different link so
Wagstaff, Kiri L: You will have seen that in your, your email as well, but feel free to join there. That one is set up so that there is a waiting room. So when you join
Wagstaff, Kiri L: You'll be in the waiting room, and then I'll have you come in one by one. So we can simulate what we would normally do with office hours and we will give that a try and see how that goes.
Wagstaff, Kiri L: Alright, feel free.
Wagstaff, Kiri L: To raise your hand if you have a question about the final exam.
Wagstaff, Kiri L: Structure that I just shared
Wagstaff, Kiri L: All right.
Wagstaff, Kiri L: Liam. Go ahead.
Liam: Hi, um, I was. Wait, is this working
Wagstaff, Kiri L: Yes, I can hear you.
Liam: Terrific. Um, I was wondering, since the exam is going to be moved online. Is it going to be like redone since you can't stop us from using notes or something. Will the questions on the exam. Be harder as a result of it being online.
Wagstaff, Kiri L: Think so. My view of that is at this time. The exam is so close that we don't really want to just change the whole format. I know a lot of you've already been studying these questions that we've that I've provided
Wagstaff, Kiri L: So keep it the same as much as possible.
Wagstaff, Kiri L: I am trusting all of you to treat this very seriously to approach it with full academic integrity to not use your notes to not use your friends to not use the internet, just like you would if it were on paper and I know that there will be temptation, perhaps
Wagstaff, Kiri L: And there's I can't police that is not proctored I'm relying on you to do the right thing here.
Liam: So it's just like a trust than
Wagstaff, Kiri L: It is in any setting. It is a trust thing that I trust, you'll follow academic integrity I but I'll let you know that is my expectation for this exam.
Liam: Fantastic. Thank you so much.
Wagstaff, Kiri L: Yep, thanks for asking.
Wagstaff, Kiri L: Alright.
Wagstaff, Kiri L: I can't tell. Who is he, Why n g, but please go ahead
Wagstaff, Kiri L: Do you have a question.
huyng: Actually, nevermind. Yeah, that was the answer my questions.
Wagstaff, Kiri L: Okay, we, um, did you still have a question or is your hands just up
Liam: I know I just felt so alone. Sorry.
Wagstaff, Kiri L: All right, no problem. Okay, any other final exam structure questions.
Wagstaff, Kiri L: All right.
Wagstaff, Kiri L: Before we jump into that I did want to give you OPPORTUNITY SINCE of course assignment six is also do on Saturday. If you have questions about that. I'm also happy to talk about this in office hours.
Wagstaff, Kiri L: Raise your hand if you have a quick question about assignment six
Wagstaff, Kiri L: And brandy. If you ask a question in the chat. You certainly can. I'm scrolling by really fast. So if I don't see it, then feel free to react or raise your hand.
Wagstaff, Kiri L: But you can also type a question if you prefer.
Wagstaff, Kiri L: And please be aware, everybody those comments are typing in the to the chat window. Everyone can see it. So let's let's treat each other with respect
Wagstaff, Kiri L: Brandi. I see your question about if your lowest grade was a 74 and then is it worth doing assignment six for the extra six points. Yes, absolutely. You would earn up to 80 points for Simon six. So that would, if it's higher than your 74 it would take the place of it.
Wagstaff, Kiri L: Great.
Wagstaff, Kiri L: Okay, we do have a question here. So,
Wagstaff, Kiri L: You way I've unmuted you go ahead
Koh, Yu Wei: I'm not yet received my group for Simon five. So when would that be, oh, and
Wagstaff, Kiri L: Most, most of those have been graded, but not all, our goal is to have them graded by the
Wagstaff, Kiri L: End of Sunday, but hopefully before then.
Wagstaff, Kiri L: So yeah, thank you for asking about that as well.
Koh, Yu Wei: Because then I will know if I get less than 80 points to submit assignment six. I'm not
Wagstaff, Kiri L: I, I completely understand that if you think you might be at risk. I would go ahead and just do the assignment, given that it's due tomorrow, so I don't want you to be having to work at the last minute.
Koh, Yu Wei: All right. Thank you.
Okay.
Wagstaff, Kiri L: There's a question about the final exam prep questions. Those are on the course website. So if you scroll there you can pick them up.
Wagstaff, Kiri L: Let's see if you have a assignment five really great question. Reach out to the team who graded your assignment and CC me on that message. So I know what's going on there.
Wagstaff, Kiri L: Question from Alvin about if you got, for example, a 126 out of 121 29
Wagstaff, Kiri L: Will the six extra credit you got on the first one.
Wagstaff, Kiri L: Yes. Keep in mind all of your assignment points go into a big pool.
Wagstaff, Kiri L: So if you exceeded the total for one assignment, then those points kind of spill over and WOULD MAKE UP FOR ANY deficit on another assignment.
Wagstaff, Kiri L: I know it's a little confusing, but it's actually a good, a good system so that your extra credit has a nice impact on the rest of your assignments as well.
Wagstaff, Kiri L: Alrighty, so for our final exam review. You might remember when we did a review for a midterm to I gave you a little menu.
Wagstaff, Kiri L: This is that same menu with the addition that we also have struts and recursion, which are the new material and
Wagstaff, Kiri L: So these are a lot of things we could talk about. But I think it makes sense to focus at least first on the strokes and recursion, because that's the newer material. So I'm going to pull that up and we can go through that and then with remaining time we can select any of these
Wagstaff, Kiri L: Topics that you want to actually cover so hang on, while I add sharing these questions.
Wagstaff, Kiri L: Alright, um,
Wagstaff, Kiri L: Can someone give me a B or Thumbs up if you can see the pdf of the practice final exam question. All right, we got a bunch of those. Okay, just, yeah, that's a lot.
Wagstaff, Kiri L: Also see a question. Will there be extra points on the final. Yes, there will be some extra credit just like we had for midterms wanted to
Wagstaff, Kiri L: If you want to do it. Okay, so here's what I had put up for structure and recursion. You may already at hopefully have looked at these questions. And so let's start with struts and
Wagstaff, Kiri L: I would like to know, does anybody have questions about number one, like what you. Well, I don't know how to do this when I can't see any of you.
Wagstaff, Kiri L: But how about this.
Wagstaff, Kiri L: I can't see your reactions. So raise your hand if you want to spend more time on question one.
Wagstaff, Kiri L: All right, maybe we'll just talk through each one, because I think there is some interest probably just to at least be comprehensive. So here we have a structure that has three different
Wagstaff, Kiri L: member variables in it, and in a float in a string. And the first question is saying, hey, I've declared a pointer to an animal, and I've named that variable, dear, and I'm declaring that off of the heat. So this is a dynamic allocation.
Wagstaff, Kiri L: Of a deer variable which is of type animal and then it's asking me, How do I set the number of eyes to one.
Wagstaff, Kiri L: So you know that it's probably going to be something to do with an eyes right and you're going to set it to one. So the question is, how do you refer to this thing and we have some choices here we can refer to deer or animal
Wagstaff, Kiri L: But keep in mind, animal is the whole struct. So if I set that if I were able to set that to one it would sort of do it for everything. And that's not actually possible so it won't let you do this.
Wagstaff, Kiri L: So instead, you want to focus on the variable you've defined a specific one. And the thing to keep in mind. A lot of people ask questions about doc versus arrow right
Wagstaff, Kiri L: So let's keep in mind that.is when you have just a regular variable, you want to access. It's member variable.
Wagstaff, Kiri L: Dear is when you have a pointer. You want to D reference it and access a member variable. So it's doing two things you can think about. It's two characters. So it's doing two things.
Wagstaff, Kiri L: This is just accessing member variable. This is the referencing and accessing. So if you've got a pointer. You then you want to pick option to see
Wagstaff, Kiri L: Option D. It's kind of interesting one because it would take the address of a pointer and then try to access a member variable so that wouldn't work. You can't get a member variable from just a pointer. Right. So, especially not the address of a pointer. So that's why not D.
Wagstaff, Kiri L: Raise your hand if you have a question about this one. Let me lower all the hands first
Wagstaff, Kiri L: Okay. Now raise your hand if you if that didn't clarify this one for you.
Wagstaff, Kiri L: All right, we go ahead
Liam: Hi. So I like understand the question. And I get all of it, but I just had a question about the air overs of the.in general
Liam: Because I'm first assignment five, we were working with dynamically allocated struts and I attempted to use the arrow, because I thought that's what I was like supposed to do, but that didn't end up working and the dot did
Liam: Is there a difference when the like kind of struck variable is part of an array, use the dot then but not if it's just the structure dynamically allocated by itself, because the arrow did not work for Sunday.
Wagstaff, Kiri L: So an assignment five, I'm guessing you were using your to do re
Wagstaff, Kiri L: Abstract. Yes. Right. So if you index into a 2D array. The thing you have at that point is not a pointer.
Forever.
Liam: That's what I thought. I just wanted to clear it up.
Wagstaff, Kiri L: Yeah, that's a great question. So we don't have an array here so it doesn't look quite the same, but yeah.
Wagstaff, Kiri L: If you had a pointer inside your to do right, you would need the arrow at that point.
Wagstaff, Kiri L: All right, I don't see any other hands up maybe other folks have probably had the same question there. So, and, and yes, Alvin. If you do reference deer and then do the dot. It's the same as the arrow so perfect.
Wagstaff, Kiri L: If you, if you saw that option. That would be a good one here and then likewise. Question two is giving you a similar request.
Wagstaff, Kiri L: To access a member variable, but this time it is just a variable. It's not a pointer. It's just an animal, not an animal pointer. So here's where we would need to use the dot and this one would not be correct. Option C would not be correct.
Wagstaff, Kiri L: Any questions about number two. Now that we talked through the the dot and the arrow.
Wagstaff, Kiri L: OK. So, number three is a little bit more relevant to the question. We just had because it is actually an array. Right.
Wagstaff, Kiri L: You know, but an array of animals have 20 animals and you've got a pointer which is getting us the address of the first one right
Wagstaff, Kiri L: So if we want to set the animal at index to then we know we're going to have to do farm have to something and it's a dot because once we've done farming to we just have an animal, not an animal pointer.
Wagstaff, Kiri L: So that's why option D would not work here because it's not a pointer.
Wagstaff, Kiri L: Now, I bet some of you are able to think about, okay, given what we've just learned
Wagstaff, Kiri L: How could I use farm.
Wagstaff, Kiri L: With the arrow.
Wagstaff, Kiri L: And still achieve the same goal there is a way to do that, but it's a little more contorted, so this is the best solution here. Any questions on number three.
Wagstaff, Kiri L: I love how you're having the sideline chat if there's anything that I missed while I was talking, feel free to ask it.
Wagstaff, Kiri L: Yeah. Very nice. Both of those are good Hayden and Elvin.
Wagstaff, Kiri L: Let's see. Okay, number four. Now we have hypothetically two variables that are both of type animal a fox in a badger and you haven't actually seeing what they're set to but all you're asked to do here is pick an expression that will be true if the Badger weighs more than the fox.
Wagstaff, Kiri L: So, you know, you've got to access the badgers wait and the fox is waiting then compare them. And here there's no confusion about
Wagstaff, Kiri L: Arrows and dots, because you've only been given that option right but the assumption here is, since I said animal variable and not pointer to an animal very variable or animal star, then you would use the dot operator.
Wagstaff, Kiri L: Options. A and B would not work because we don't have a way to compare an entire structure to an entire struct.
Wagstaff, Kiri L: Any questions about number four.
Wagstaff, Kiri L: Alrighty.
Wagstaff, Kiri L: All right. Number five is is getting at.
Wagstaff, Kiri L: Your understanding of recursive recursive functions. So here it's saying a recursive function cannot use a for loop inside its definition.
Wagstaff, Kiri L: And although we typically would not use a for loop inside a recursive function. There's nothing that precludes that if you that's not what makes it recursive. So does anyone want to volunteer on the chat or with your hand. What would make it recursive
Wagstaff, Kiri L: If it's not about whether it has a for loop, what is the key thing it would need in order to be recursive
Wagstaff, Kiri L: All right, I see some great contributions there and Hayden, would you like to say something. Since you raise your hand.
Wagstaff, Kiri L: You can go ahead Hayden.
Wagstaff, Kiri L: If you're speaking. We can't hear you.
Hayden Johnson: Oh, you can you can hear me. Yeah, how
Wagstaff, Kiri L: Go ahead.
Hayden Johnson: Yes, if it calls itself, whichever one already said but i can i can raise my hand.
Wagstaff, Kiri L: I see no problem. Yes, I see a lot of calling itself.
Wagstaff, Kiri L: And some bass cases.
Wagstaff, Kiri L: Basically case and call itself. Yeah. So you guys got this down. Those are the things we're looking for.
Wagstaff, Kiri L: Now that having a base case doesn't make it recursive, but it makes it a good recursive function because you could have a
Wagstaff, Kiri L: function that calls itself and they forgot the base case, it would still be recursive, it would just be problematic. So it's really the calling itself. That makes it into what we would call recursive, whether it's correct or not.
Wagstaff, Kiri L: And then there's a question here about the base case itself.
Wagstaff, Kiri L: That this describes the condition in which the recursion stops. That is what we're looking for. So that would be true if you have a question about base case. And what that means and feel free to raise your hand. Now,
Wagstaff, Kiri L: Okay, number seven. We're moving on to looking at how do you write recursive functions. So we have defined something called print letters and there's some gaps in it. But since I've said it's a recursive function.
Wagstaff, Kiri L: It probably needs to call itself somewhere. So we have an if statement and the way we've looked at constructing these before, is we would put our base case here. And the question is, what would be an appropriate base case to go inside that if construction.
Wagstaff, Kiri L: And the way I would think about this here is when do you want things to stop. So if you look at the question. It says down to a character a
Wagstaff, Kiri L: So that is a case where I would probably borrow that from my base case. And I would look to be checking when see is equal to A.
Wagstaff, Kiri L: If it said from character see up to pee. Then I would be checking for see being equal to pee and so on.
Wagstaff, Kiri L: So this is when you want it to stop. This is when you're in your final iterate your final work through the recursion and we're just printing the character itself.
Wagstaff, Kiri L: Alternatively, if we're not at a then this will be the recursive part and it's asking. In question eight, what, what would you put in the blank labels to
Wagstaff, Kiri L: Where you know you need to call print letters and it's like, what do you call it with right so what we've talked about with recursion is you're trying to make the problem smaller
Wagstaff, Kiri L: So you start with I'm at character. See, and I need to walk all the way down to a whatever see happens to be so see could be any letter of the alphabet. It could even start a day. Right.
Wagstaff, Kiri L: In which case this would immediately execute and you would never get to the recursive step but assuming it's not a you're in the else case.
Wagstaff, Kiri L: So you're going to call print letters with one character smaller than the one you just started with. So because we can treat characters.
Wagstaff, Kiri L: As integers, we can just subtract one from it, and if it started out as queue, then it would become P and if it started out as D would become see and so on.
Wagstaff, Kiri L: For the recursive stuck working its way down to a and notice. Anyone want to volunteer in the chat. What would happen if we put a in there.
Wagstaff, Kiri L: Yes, infinite loop. So you're going to keep calling it with whatever see is, and whatever see is, and whatever see is, and whatever see is
Wagstaff, Kiri L: And unless you happen to call the starting with a. In which case you escaped here. Any other letter would just keep going and going and going and going and going.
Wagstaff, Kiri L: Until you fill up the stack and you have a sec fault. So that's not a good choice.
Wagstaff, Kiri L: And then this is just here in case you weren't really paying attention and you just were fixated on see and you put in the letter C. So that would also, unfortunately, give you an infinite recursion and it's like fall
Wagstaff, Kiri L: Because it would just keep calling it with CC CC CC
Wagstaff, Kiri L: And then this one wouldn't work at all, because if you didn't give it something to rehearsal on there's no input argument here.
Wagstaff, Kiri L: Questions about seven or eight since they kind of go together. Raise your hand if you'd like to ask
Wagstaff, Kiri L: Okay, good. I think you've had a lot of practice with recursion. And we've been working on it for quite a while and class. So I'm expecting you'll do well with this.
Wagstaff, Kiri L: Alright, the last two questions are about this recursive function called play
Wagstaff, Kiri L: And in this one. It takes in an integer returns a float.
Wagstaff, Kiri L: Before this one was void, right, because I was doing is printing things out. This one's actually going to return something
Wagstaff, Kiri L: And the base cases if x is negative one, then return 1.5 and for anything else you're going to return 3.6 plus calling play on x minus one. So, first question is, if I pass in zero
Wagstaff, Kiri L: Then what would that return and for this I definitely encourage you to use scratch paper while you're taking this exam, even though it's on canvas handwriting things can be really helpful for recursive functions super helpful. So I would recommend that you actually traced these through
Wagstaff, Kiri L: So you would do something like
Wagstaff, Kiri L: See if I can write on here.
Wagstaff, Kiri L: You would say, okay, play of zero.
Wagstaff, Kiri L: Equals and let's see if I can make this better.
Wagstaff, Kiri L: Alright, that's probably better than me trying to draw right so right out what that becomes if I pass in zero, it becomes 3.6 plus play minus one right
Wagstaff, Kiri L: And looks like I have to do this separately every single time that is the same as 3.6 plus
Wagstaff, Kiri L: 1.5 right because you get down to the negative one, that is the base case and it returns and that is the same as
Wagstaff, Kiri L: 5.1 if you do the arithmetic.
Wagstaff, Kiri L: So any questions about how that works.
Wagstaff, Kiri L: You can probably do this in your head. If it's just a couple steps, but I highly highly recommend that you do it just like I showed here like write it down, scratch paper and work it out. If it goes more than a couple iterations, it becomes very hard to keep track of in your head.
Wagstaff, Kiri L: Alright, same thing here, on question 10 it's asking a slightly different question of how many times, will the function be called if we start with lay have to
Wagstaff, Kiri L: Actually, I'm curious. Do you see that while I'm typing or only after I'm done typing.
Wagstaff, Kiri L: While typing a. Yeah, that's even better. Okay. So play have to someone type into the chat. What that expands to
Wagstaff, Kiri L: Anyone
Wagstaff, Kiri L: Alright. Some of you are commenting about questions seven. Hang on. We'll we're working on question 10. Okay, so a lot of great answers here. I would start with the 3.6 because that straightforward, plus the play of whatever I had minus one.
Wagstaff, Kiri L: And then I would keep expanding that
Wagstaff, Kiri L: Just like what I'm seeing you guys doing in the chat, which is great. Keep doing this.
Wagstaff, Kiri L: That's plenty of negative one and then work it out.
Wagstaff, Kiri L: And yes, it is very easy to
Wagstaff, Kiri L: Have an extra one or one that's too small. Right.
Wagstaff, Kiri L: Here we go. This is fun watching me type, I'm sure.
Wagstaff, Kiri L: Oh,
Wagstaff, Kiri L: I got carried away. This is pretty hard to do live
Wagstaff, Kiri L: Okay, is that looking better.
Wagstaff, Kiri L: Okay. Glad you approve.
Wagstaff, Kiri L: It's not quite right, though.
Wagstaff, Kiri L: Oh, it doesn't let me edit what I already wrote
Wagstaff, Kiri L: Okay. Anyway, the point is, it's not even asking you to figure out what the answer is it's asking you to figure out how many times the function will be called which is
Wagstaff, Kiri L: Actually simpler. So the key is to remember that that first call play of two counts. Okay, so we're calling it once with play have to which calls play have one, which calls play of zero, which calls play of negative one.
Wagstaff, Kiri L: So if I count every time I wrote down the word play I come up with four. And that's how we end up with the right answer here.
Wagstaff, Kiri L: So,
Wagstaff, Kiri L: Haha oh database, the entire thing. This is great. I'm getting to learn how to use this as well.
Wagstaff, Kiri L: I was trying to just erase that extra 3.6
Wagstaff, Kiri L: But anyway, I think you get the idea. And any questions about this one that we haven't already addressed, please raise your hand.
Wagstaff, Kiri L: And Benny that that wouldn't be quite right, because we need to actually replace the function calls with their recursive versions not add to them every single time.
Wagstaff, Kiri L: Okay, now, I think, was there a question about, Oh, it looks like I need to clear this
Wagstaff, Kiri L: Okay, question about number seven.
Wagstaff, Kiri L: Ah, yes. So there is, it looks like it got deleted the final closing curly brace. Very good. I so that is missing.
Wagstaff, Kiri L: From this example.
Wagstaff, Kiri L: All right. Those were the questions I had prepared for you in terms of recursion instructs
Wagstaff, Kiri L: Do you have any questions that we didn't cover so far on those two topics.
Wagstaff, Kiri L: Please raise your hand if you do
Wagstaff, Kiri L: All right, Tyler. Go ahead.
Wagstaff, Kiri L: Tyler. I'm trying to unmute you. But it's not working. Do you, I'm not sure. There you go. Yeah.
Tyler Branson: I tried to ask this earlier.
Tyler Branson: Is the, I don't have a grade yet for peer reviews for Simon five, I was curious if when the summer five grade comes out, that's going to be put into the great book of that time.
Wagstaff, Kiri L: For the parodies are for the assignment itself. Are you asking about both
Tyler Branson: I just don't have a great from peer reviews. Right now I can understand that we're waiting till about latest Sunday for the assignment five grade and total
Wagstaff, Kiri L: Okay.
Tyler Branson: But I was worried that peer review is going to be put in as
Tyler Branson: At that time, as well.
Wagstaff, Kiri L: Yes, the. Those should all be taken care of at latest by that same point.
Wagstaff, Kiri L: It is my understanding that all of the design documents have been graded. So if you're not seeing a grade for your assignment five design doc, then please let us know through the TA list which goes to all of us, including me.
Wagstaff, Kiri L: But yeah, the peer reviews might not be in quite yet. And the implementations
Tyler Branson: Thank you.
Wagstaff, Kiri L: Any other questions.
Wagstaff, Kiri L: Question about the recording. I will send out a link. After this, so you can access it as needed.
Wagstaff, Kiri L: Okay, any questions about recursion and strokes.
Wagstaff, Kiri L: I'm not hearing any which means we have plenty of time to go back
Wagstaff, Kiri L: And consider some of these topics.
Wagstaff, Kiri L: Please raise your hand if you there's a topic on there. You really want to ask about or work on
Wagstaff, Kiri L: All right, go ahead.
huyng: I'm for the script.
huyng: Does it count as a class if you include a function
Wagstaff, Kiri L: Interesting question. Technically, no you if you want a class, you would have to use it the class keyword, not the struct one
Wagstaff, Kiri L: So if it's a struct, even if it has a function, it is still a struct.
Wagstaff, Kiri L: Yep.
Wagstaff, Kiri L: And yes to the question about the final will be a combination of these questions and mid term to like questions. That is right. So the midterm is, I'm sorry, the final is not just on structure and recursion. It is comprehensive so can cover everything
Wagstaff, Kiri L: I see a request for operator precedence. So why don't we take a look at that.
Wagstaff, Kiri L: Here's our sort of reference. We've spent a lot of time with arithmetic relational operators, that's when you're comparing things for equality greater than, less than and so on, logical operators which are things that operate on Boolean
Wagstaff, Kiri L: To say if things, both are true. If one or the other is true and if it is not true.
Wagstaff, Kiri L: And then I bolted the ones that we've had more recently as operators, because they're a little bit newer including a re indexing and working with pointers and strokes, so
Wagstaff, Kiri L: These can be a little trickier. Right. So if you use the ampersand in front of something, it's giving you the address of it.
Wagstaff, Kiri L: For using the asterisk in front of it. It's the referencing that's going from a pointer to a value. This is going from a value up to a pointer or address and then we already talked about the dot and arrow operators and how this one is doing two things in this one's only doing one thing
Wagstaff, Kiri L: Do you have any specific questions about the precedence.
Wagstaff, Kiri L: The chart is there on the right.
Wagstaff, Kiri L: But it's, it's kind of a lot to digest. I think it's better to think of it conceptually to know that these relational and sorry
Wagstaff, Kiri L: The assignment operators are at the bottom. Then we have logical than the relational whoops, then the arithmetic, including mod. Don't forget mod
Wagstaff, Kiri L: And then you've got things that are operating on pointers and addresses and the indexing dot and arrows up here along with the increment document are the very best and highest so
Wagstaff, Kiri L: You're not seeing it.
Wagstaff, Kiri L: Okay. Are you guys seeing the review questions. Are you seeing my slides.
Wagstaff, Kiri L: That's interesting because I'm seeing the slides.
Wagstaff, Kiri L: Hang on.
Wagstaff, Kiri L: How about now. What do you are you seeing the slides.
Wagstaff, Kiri L: Okay, I'm
Wagstaff, Kiri L: Okay I fixed it, I think. Can you see the slides now. Okay.
Wagstaff, Kiri L: All right, thank you for letting me know.
Wagstaff, Kiri L: What I just said still applies. I was walking through this list of bullet points with the different operators and then the precedence. So I'll just refresh on that, since you couldn't see it. But I think of this conceptually and blocks like at the bottom things involving assignment.
Wagstaff, Kiri L: Then moving up to the logical operators, the relational operators that are comparing values than the arithmetic. And this is where I was pointing at mod, then things that operate on memory addresses and pointers.
Wagstaff, Kiri L: And the prefix version.
Wagstaff, Kiri L: Of incremental document and then at the very top, the post fixed version of increment detriment are indexing and then the dot and error operators. So thanks for letting me know, you couldn't see it. I hope this is better.
Wagstaff, Kiri L: So I'll ask again, then any specific questions here things you're confused about.
Wagstaff, Kiri L: All right, go ahead at the beck
Wagstaff, Kiri L: What it depends what operator, you're doing on the double pointer.
So,
Wagstaff, Kiri L: Remember these are not objects. These are operators. So if P were a double pointer here and I did asterisk in front of it.
Wagstaff, Kiri L: That would be reference it by one level. So it's still be a single point. At that point, but the operator itself would have the same precedence that it has on this chart, no matter what you put in this p, whether it's double point or single point or whatever.
Wagstaff, Kiri L: Any other questions.
Wagstaff, Kiri L: Okay, now I'll go back to this menu that I thought you were saying before, feel free to pick something from here that you'd like us to talk more about
Wagstaff, Kiri L: Are linked lists going to be on the final.
Wagstaff, Kiri L: I see someone asking about that.
Wagstaff, Kiri L: No, we're just going to go with structure and recursion, but not necessarily putting them together like we did at the very end of class.
Wagstaff, Kiri L: RC strings going to be on the final. Yes, they are. So I'm seeing some boats for that. Why don't we skip to that one.
Wagstaff, Kiri L: It's pretty far down on my list here.
Wagstaff, Kiri L: Here we go. So here are some of our questions from before about see style strings. I think the key thing to remember, there is what makes us see style string, different from just an array of characters.
Wagstaff, Kiri L: So you can think of all character raises one one type of thing and then seesaw strings is a special case of that because it has to end with angel terminator. Yes, which can be represented as backslash zero
Wagstaff, Kiri L: M.
Wagstaff, Kiri L: So that's a good one. And then knowing what library, you would need to include
Wagstaff, Kiri L: To be able to use them.
Wagstaff, Kiri L: That's another good one to know anyone wants to volunteer that I like how you're typing in the in the chat.
Wagstaff, Kiri L: All right, very good.
Wagstaff, Kiri L: And I see Dylan has a question. So Dylan. Go ahead.
Dylan Karambut: Also
Dylan Karambut: Forget the military state. But if you forget the NULL terminator. What's gonna be happening.
Wagstaff, Kiri L: Yeah, if you forget the terminator. What a great question.
Wagstaff, Kiri L: So if you forget the NULL terminator. Then you just have an a list of characters. Right. A, B, C, D, and then that's the end of your array which means you're up against some other piece of memory.
Wagstaff, Kiri L: So if you want to use any of the string functions that are in the Ses. Ses string library. They are all scanning through your string to look for a know
Wagstaff, Kiri L: If they don't find it. They'll keep going until they find one. So,
Wagstaff, Kiri L: If you get lucky and there happens to be a normal right after your array in memory, it will stop at the appropriate place and you won't realize you have a bug.
Wagstaff, Kiri L: If you're unlucky, it will keep walking through any valid memory until it runs into a funnel and so you may get garbage coming out.
Wagstaff, Kiri L: And that's the kind of bug that can be very hard to notice especially if you did as I say get lucky and there was a null.
Wagstaff, Kiri L: SEC memory hadn't been used or something. So that's a really good thing to run with algorithms and it will give you that very cryptic error that talks about blah blah blah and initialized variable.
Wagstaff, Kiri L: Or it will often give you that error, it won't say hey you forgot your know Terminator
Wagstaff, Kiri L: But that's one of the causes of getting that error. So, that can be a clue to you if you run Belgrade and you have no memory leaks, but it's still giving you these warnings, I would check your see cell streams.
Wagstaff, Kiri L: We've got the whole character and we've got seen and get line and I see some chat here as well that people are talking about that.
Wagstaff, Kiri L: Hopefully, at this point, you've had enough experience now to know if you just, you see, and it will stop when you ever hits white space and white space can include spaces tabs or anything that's not
Wagstaff, Kiri L: A literal here. The get line is the safe way to do that because it will only read in the number that you're asking for. And since you had to allocate that array. It's really good to match that up with what you are asking for.
Wagstaff, Kiri L: And there was some questions. We already had about okay if I put 10 there. What is that actually going to do
Wagstaff, Kiri L: Is that going to read nine or read 10. What do you think, put it in the chat.
Wagstaff, Kiri L: Alright, just based on your votes. I'm seeing a whole lot of nines.
Wagstaff, Kiri L: Yeah, so it's going to read nine valid characters from the input and then put the knoll on there for you.
Wagstaff, Kiri L: So the total number of characters that will, it will consume that will be stored in your array is 10 but you have to know that that 10th. One is the special one.
Wagstaff, Kiri L: It's the little Terminator, and they will only get nine from the user. So great job on that. That's what we really want you to understand. You may be wondering like why do we care. Why is it so picky.
Wagstaff, Kiri L: And it's really just to help you avoid making memory mistakes that could cause problems downstream so
Wagstaff, Kiri L: Hopefully that's helpful.
Wagstaff, Kiri L: All right, we spent some time on see strings. I think there was a question about function overloading as well.
Wagstaff, Kiri L: In the chat so I'm
Wagstaff, Kiri L: Someone in the chat, then please share what do you need to have different between two functions that have the same name for the compiler to allow you to have more than one
Wagstaff, Kiri L: Yes, there needs to be some difference in the parameters, either in how many you have.
Wagstaff, Kiri L: Or their types.
Wagstaff, Kiri L: It's not enough for the name of the parameter to be different. So if one, you know, one function that takes an int a the other one takes an int be that's not good enough because those variable names are only local to the function. So it needs to be a different type or different amount
Wagstaff, Kiri L: And you can have the return type be different. But if that's the only thing that's different. That won't work either. So that's another gotcha to remember if you just change from a return type of into a return type of void not good enough.
Wagstaff, Kiri L: I also saw a question about whether we would have to know value and for the test value and will not be on the test. I just mentioned it because it's a good programming tool as you go forward into your studies and your programming.
Wagstaff, Kiri L: Same with GDP. So this test is very like what we've had before, on paper, we're mainly more looking at. Do you know the language and its features and the tools or what you use in the lab and in your programming.
Wagstaff, Kiri L: No, I don't have a slide on function overloading. I don't think so. That's why I didn't change it. Thanks for asking.
Wagstaff, Kiri L: I just had to talk it through with you.
Wagstaff, Kiri L: Alrighty, um,
Wagstaff, Kiri L: I go back to our topics.
Wagstaff, Kiri L: What's another popular one. You want to talk about or
Wagstaff, Kiri L: 2D arrays. I think that's an excellent choice.
Wagstaff, Kiri L: Let's go take a look at that and dynamic memory is another good one. Why don't we try to hit both of those, and the time we have. So I'm hoping that by now you've gained enough familiarity with 2D arrays that you would feel comfortable declaring
Wagstaff, Kiri L: A 2D array or at least knowing how that is done. I'm not going to ask you to write long pieces of code, just like I haven't done that on the paper exams, either, but you should understand how static to do rays are declared so you could recognize and read code that that does use that
Wagstaff, Kiri L: So anyone wants to volunteer and the the chat, how you would declare a static 2D array that's a four by five array of doubles.
Wagstaff, Kiri L: And make sure you put the data type in there too.
Wagstaff, Kiri L: Yeah. Okay, so I'm seeing a lot of answers on this, if you wanted it to be five by for what would you do
Wagstaff, Kiri L: Okay. Yeah, exactly. You need to switch the order because you always put the number of rows first and then the number of columns. So we've got that here. And then we get this question a lot is very laid out in row major column manager. I hope you can all get this
Wagstaff, Kiri L: Hope. There's lots of votes for yes row, even if you misspell it that's okay as long as you recognize that
Wagstaff, Kiri L: It's also I hopefully you had a good sense of what that means right so we take the first row in the array and then we stack the next row in the array contactor it third row. The fourth row and so on.
Wagstaff, Kiri L: All the way. So we do not lay out columns and then columns and then columns which would be the alternative
Wagstaff, Kiri L: All right. Now, the more challenging one. How do you allocate memory for a dynamic 2D array. So let's do the same thing. Let's create a 2D array of doubles. That's four by five. Yes. From the heat. So if you ever see dynamic that means from the heat.
Wagstaff, Kiri L: And we'll talk about the array passing there. And in a sec. Yeah. Using a for loop. So there are two major steps you need to do. Right. So first one you need to declare your row pointers and I see some
Wagstaff, Kiri L: Some ideas on that. Yep, let's make sure that you have the right number we have four rows here, not five
Wagstaff, Kiri L: And you make sure that you've got the right data type two with a double pointer on the left side and the single pointer on the right side of the assignment statement. All right, I'm seeing a lot of great examples. So anyone who's not typing. Hopefully you're seeing those two
Wagstaff, Kiri L: For that last one. You will need
Wagstaff, Kiri L: You will need. It's a double star on the right side of the assignment, not just the double otherwise your types won't match. So you're declaring an array of double pointers.
Wagstaff, Kiri L: You know what I just realized the double data type is confusing here because we're using double in two ways.
Wagstaff, Kiri L: I mean the data type and array of double data type pointers.
Wagstaff, Kiri L: Then you would have the for loop, which you're all getting at, where you assign for every item within that array of real pointers, something that it's actually going to point two. So you would have each array of i is a new double of five. So four by five array.
Wagstaff, Kiri L: So this is really good practice to be able, I love how you're all putting it out there.
Wagstaff, Kiri L: Again, I won't ask you to write this down off the top of your head, but you should be able to recognize when it's right and when it's wrong.
Wagstaff, Kiri L: So like if I had an extra pointer here. If you can see where my pointer is an extra star in here that would be wrong, because we don't want double star. We just want a double array.
Wagstaff, Kiri L: Then the next question is, how do you free that and for that of course we want to flip the order, we have our for loop first to free every rope.
Wagstaff, Kiri L: Array. And then at the end, we are delete the main variable itself, which is the array A row pointers doing it the other order does not work. It's fun to try, if you want, but it will not work.
Wagstaff, Kiri L: It'll cause problems.
Wagstaff, Kiri L: And otherwise, the for loop structure is exactly the same.
Wagstaff, Kiri L: All right. Um,
Wagstaff, Kiri L: See, there was question then about function. How do we pass these things into functions. And this is a very good question, ask because it's a little fiddly
Wagstaff, Kiri L: So in this case, we've got an array of it's a 2D Arabians it's five by three static. So hopefully you can all think of, okay, how would I declare that thing. Um, what should a function call look like
Wagstaff, Kiri L: And we'll just take a look at that. Here we have a function in this case it's void that has nothing to do with the question. The real key is what you put inside here, right.
Wagstaff, Kiri L: And so you can you can actually say it's five by three static array or you can say it's something by three and not reveal what the something is
Wagstaff, Kiri L: Right, I just realized we were only going to 250. So thank you. SEBASTIAN. If anyone needs to leave. I completely understand, we'll finish up a couple more questions here for anyone who can stay
Wagstaff, Kiri L: So this is the key really need to have that second one, the second dimension and yes I will post the slides and the recording. So watch for an email about that.
Wagstaff, Kiri L: Then how would you do it for dynamic that's the other one where you actually just pass in pointer pointer or array of pointers either one.
Wagstaff, Kiri L: Ah, great question from Zach. If you passed in row and column here like before, like you passing the three in the five somehow his arguments could you use them here. No, you cannot. That would be really great.
Wagstaff, Kiri L: I totally know what you're asking. Thanks for typing in the example know that will not work. You can't define a variables of parameter and then use it in the parameters, unfortunately. So yeah, you have to actually know how big it is, before you pass it in as part of this.
Wagstaff, Kiri L: Okay.
Wagstaff, Kiri L: Yes, we actually got to talk about dynamic memory allocation as well in this process. Any final questions about well static or dynamic memory allocation in the time we have.
Wagstaff, Kiri L: You if you ask the user for the Rowan column before you create it.
Wagstaff, Kiri L: So if you're asking the user for their own column size, then you would be using dynamic allocation. So you'd be in the second case.
Wagstaff, Kiri L: And you don't need to specify what those are. When you call them when you pass them into the function. So, yeah, no work.
Wagstaff, Kiri L: And to call the function Darian. Thank you, you would just use a are well whatever your it might not be called AR right but whatever you call it inside your main
Wagstaff, Kiri L: You don't put an asterisk in front of it or behind it, or an ampersand or anything, just the name of the array because you're passing in that double pointer as the argument.
Wagstaff, Kiri L: Does that answer your question Darian
Wagstaff, Kiri L: Yeah, perfect. Okay, any other questions about how you call the function and pass in the argument.
Wagstaff, Kiri L: I mean, you can see here, I didn't pass in row and column as arguments here.
Wagstaff, Kiri L: And that's fine. That works, but it may limit what I can do inside that function because I inside the function, I will have no idea what the dimensions are of this thing.
Wagstaff, Kiri L: So it's much better to add the wrong column. I just didn't show them here. So we could focus on how do you pass that particular argument.
Wagstaff, Kiri L: All right.
Wagstaff, Kiri L: We still have anyone people here. So, have you at one people. I'm sure you must have at least one question, feel free to ask
Wagstaff, Kiri L: If we had a pointer named array. What is the difference between these yes you have very good question. So let's say array as a pointer to
Wagstaff, Kiri L: An event. I don't know. So if you have. Oh, you're just saying if we print them out if you print a ROI. Yes, anyone wants to answer that one. First one, what would we get if we print a ROI.
Wagstaff, Kiri L: Okay, I'm good. Yeah. So the first one is just going to be an address if you print a ROI will not give you all the contents of the array like some other languages. My it will just give you the address of the start of the array.
Wagstaff, Kiri L: And percent then as the address of that address and ampersand D reference of the array would be first, we would do.
Wagstaff, Kiri L: I'm actually not sure that it would compile as written.
Wagstaff, Kiri L: But I'd have to test it. So if anyone wants to test it. I can see conceptually what you're going for is up and then down but that will be kind of weird.
Wagstaff, Kiri L: Can we use link to find her own column values so length is something that you have, for example, for a season of sorry a c++ string that is defined for that object class it's not defined for a race. So unfortunately don't have that.
Wagstaff, Kiri L: Um,
Wagstaff, Kiri L: What would happen if you put an arrow in the struct.
Wagstaff, Kiri L: Show. I think I need more details about you mean by putting an arrow in the struct.
Wagstaff, Kiri L: We defined a pointer inside the struct. And then we use the arrow. Whenever we were D referencing a pointer, if that's what you're referring to.
Wagstaff, Kiri L: Okay.
Wagstaff, Kiri L: So,
Wagstaff, Kiri L: Can you can you ask your question or would you like to use the mic. So you can ask it a little more easily just raise your hand if you want to use the mic.
Sho: Yeah, I have a question about, like, when
Sho: When we I don't understand a slider nutrition. I think last week about the when, when we, when you do the train like you've done a question.
Wagstaff, Kiri L: Yeah, I, I'm here. Um,
Wagstaff, Kiri L: I think
Wagstaff, Kiri L: Without looking at the exact example might be hard to know what the question is. But
Wagstaff, Kiri L: I will recommend if you want to come to office hours. I'm going to do virtual office hours in two minutes. And we can look at an example. More specifically,
Sho: Okay, thank you.
Wagstaff, Kiri L: Yeah, you're welcome.
Wagstaff, Kiri L: Okay, other final questions.
Wagstaff, Kiri L: tips or advice for CS 162. Oh well.
Wagstaff, Kiri L: So I have not taught one CS 162 so I don't have intimate knowledge of it. Exactly. But I know you have great instructors for it.
Wagstaff, Kiri L: I also have looked at some of the assignments that they they have for that. And I would say that they are
Wagstaff, Kiri L: More lengthy and more demanding than what we've done so far in 161 as you would expect, but they get to introduce you to a lot of new capabilities that we also haven't seen yet.
Wagstaff, Kiri L: Working with files, for example, which we only just touched on, but didn't get to actually do in an assignment and getting more and more sophisticated building your own data structures and so on.
Wagstaff, Kiri L: So you'll get to see a lot more language features in 162 then you have so far.
Wagstaff, Kiri L: Leon about
Wagstaff, Kiri L: The format for classes next term, we are in. We've been told that we need to do everything through online instruction. So most folks are planning to switch to zoom for the lectures. Yes, to answer your question, and
Wagstaff, Kiri L: If you anyone has suggestions for ways to make that more accessible easier to use.
Wagstaff, Kiri L: These easier to read. Easier to interact. We all want to hear your ideas too because we're figuring it out as we go.
Wagstaff, Kiri L: And final question about link list. No, they're not going to be on the final. That's right.
Wagstaff, Kiri L: I do not know about plugins for server Vim. I don't understand the question. Dylan. So maybe you can ask me separately.
Wagstaff, Kiri L: Yes browsing previous 162 websites is a good start. Although the instructor might not be the same as. Whoever created that particular one. So keep that in mind that they do change over time.
Wagstaff, Kiri L: Can you installs.
Wagstaff, Kiri L: I would recommend not trying to modify them.
Wagstaff, Kiri L: But certainly, you can change your Vim RC like we practiced in lab where you can customize it and have syntax highlighting and have all those other features that you might like the best.
Wagstaff, Kiri L: Yeah.
Wagstaff, Kiri L: Okay, I think that's all the time we have. That's probably more than the time we had. I'm going to switch over to
Wagstaff, Kiri L: The Office Hours zoom and you're certainly welcome to come with me there. I'll send an email reminding folks with that link is in case you didn't have it handy. But thank you for joining us for our first virtual class here I'll post about the recording as well.
Wagstaff, Kiri L: Take care of yourself and stay safe and everything I want you all to do really well in this class. And next term. Thanks.