WEBVTT 1 00:00:03.360 --> 00:00:12.179 William Cheng: Okay, welcome to the first discussion section. So again, the discussion section we're going to use it to talk about, you know, programming assignments. Okay. 2 00:00:14.190 --> 00:00:23.250 William Cheng: All right, so please understand that the discussion section material is just sort of an overview. It's not substitute for reading the spec and the grading guideline. 3 00:00:23.850 --> 00:00:33.000 William Cheng: You are expected to read the entire spec, you are expected to read the entire all the webpage at the spec points to 4 00:00:33.510 --> 00:00:38.790 William Cheng: You're expected to read the grading guidelines and all these things are your responsibility there. 5 00:00:39.510 --> 00:00:48.420 William Cheng: So if you are, you know, sort of new to programming or you're, you know, haven't had enough programming experience. Please understand, the programming is not hard. 6 00:00:48.960 --> 00:00:55.560 William Cheng: You know, you need to sort of understand the basic you know what the programming language, what kind of features they give it to you. 7 00:00:55.950 --> 00:01:02.400 William Cheng: And the rest of it just, it just practice in bed. The more you practice the better you get the you get at it. 8 00:01:02.730 --> 00:01:08.550 William Cheng: And also you need to develop good habits because if you have bad habits you going to end up spending a lot of time debugging. 9 00:01:09.120 --> 00:01:17.640 William Cheng: Okay, so, so, so, so here are some of the, you know, programming good habits. Number one is that you should always check the return code. 10 00:01:18.120 --> 00:01:24.270 William Cheng: Whenever you make a function call. Read the man page as a man page on the manuals that are Unix the call man page. 11 00:01:24.900 --> 00:01:37.770 William Cheng: So if you read the men page they would tells you they will tell you what kind of return value that that should give you should always check the return code. They even if you don't expect the function to fail, you should always check the return code that 12 00:01:39.000 --> 00:01:46.500 William Cheng: Oh, and the second thing is that you should initialize all your variables. Because sometimes, you know, people don't initialize a variable and turns out of their bugs. 13 00:01:46.980 --> 00:01:52.170 William Cheng: It's kind of silly that you waste a lot of time to debug your code. If it turns out that you know your variable or nine initialized. 14 00:01:52.440 --> 00:02:02.280 William Cheng: Okay. So whenever you declare variable like this, you should always initialize to some, you know, default values zero minus one, you know, something like that. Or if you have a pointer always initialize to know 15 00:02:02.610 --> 00:02:12.150 William Cheng: If you have a data structure. You can zero out the entire data structure using this function called men set that so again anytime you see a function that you don't know what it does look at the main page. 16 00:02:12.480 --> 00:02:20.370 William Cheng: You do men, followed by the name of the function and then it will give you the manual again read a very, very carefully to understand the structure of the madman page. 17 00:02:20.610 --> 00:02:25.170 William Cheng: You just start doing this as early as possible because you're going to end up reading a lot of man pages. 18 00:02:25.590 --> 00:02:30.750 William Cheng: Okay. So get used to that as well. This function or you need to give an address of a data structure. 19 00:02:30.960 --> 00:02:38.220 William Cheng: Followed by what do you want to fill with resident this case, I want to fill out this entire data structure, starting at the address of timeout. 20 00:02:38.490 --> 00:02:50.010 William Cheng: timeout is of this data type, whereas over again, the way you think about is that here's timeout T i m e o UT over here it's have this data type. So by knowing the data type. You know what the fields are 21 00:02:50.760 --> 00:02:58.500 William Cheng: Okay, the address of time. So again, in my, my first lecture I mentioned the importance of understanding the address. So, so you need to start 22 00:02:58.860 --> 00:03:10.920 William Cheng: So so so trying to use addresses and trying to understand what it means. Right. So address of time, I'll be here, just this memory location that pointed the first memory location, though this entire data structure there. So this data structure, you know, 23 00:03:12.270 --> 00:03:21.300 William Cheng: Again, you can think about a data structure contain a bunch of fields or something like that. You can also think about is that there's an address at the beginning of the data structure and followed by a bunch of data bytes. 24 00:03:21.690 --> 00:03:29.430 William Cheng: Okay. So in this case, what we're doing over here is that we're going to take the address of this data structure we're going to fill it with zero, but you need to know how many bytes to fail. 25 00:03:29.610 --> 00:03:42.390 William Cheng: So in this case, users this function called sizer size of size size of struck time about who's tell you how many bites are in this data structure. So, this particular function just says start from this address filler with zero for so many bytes. 26 00:03:43.050 --> 00:03:51.780 William Cheng: That's all it does. Okay. It doesn't really matter what kind of data structure, it is right, this case, we know that is of this data structure, the data structure. So, therefore, we know how many bytes of zero to fill 27 00:03:52.530 --> 00:03:58.530 William Cheng: Okay, if this is just appointed that point to some random memory location. So again, you need to know how many bites are there. 28 00:03:59.430 --> 00:04:04.710 William Cheng: How many bites are there in the address that is pointing to. So this way you can actually zero out the data structure. 29 00:04:05.160 --> 00:04:14.850 William Cheng: That whenever you use a data structure. Whenever you use a pointer. You have to know what it's pointing to. If you don't know what it's pointing to. And then what can you do, what do you shouldn't fill it out with data. 30 00:04:15.720 --> 00:04:23.430 William Cheng: Okay, if you have a point your point is somewhere over here. You have no idea what it's pointing to don't fill it with data. Okay, so what you can do is that, so you're not getting that case, what, what can you do 31 00:04:23.760 --> 00:04:31.380 William Cheng: Right. If you haven't, if you have a point here. The point is somewhere and you don't know what it's pointing to the only thing you can do is to pass the pointer around 32 00:04:31.890 --> 00:04:38.430 William Cheng: Okay, so, so you're pointing to the data structure, you can pass it around by sending to somewhere else. And so another point good point here, another partner point here. 33 00:04:38.610 --> 00:04:44.250 William Cheng: If everybody's pointing there and nobody knows what you're pointing to. And that's okay. You can you can point to something as long as you don't use it. 34 00:04:45.120 --> 00:04:53.340 William Cheng: Okay, that's the nature of pointers. Okay, so, so if you're not an address, you don't know who lives there. Or they'll go don't go in there, okay. But you can actually pass 35 00:04:53.640 --> 00:04:58.350 William Cheng: The address around the other people say hey you know there's an address. I have no idea who lives there. Don't go there. 36 00:04:59.340 --> 00:05:06.870 William Cheng: Right, and that's perfectly okay right so that's the nature of address that's the nature of pointer, a pointer is, you know, a 32 bit machine. 37 00:05:07.110 --> 00:05:15.930 William Cheng: Appointed is always four bytes long. It contains an address of something we don't know what it is. So maybe you know what it is. Maybe you don't know what it is, but it's just an address. 38 00:05:16.590 --> 00:05:21.900 William Cheng: Okay. All right. Very important concept, you need to start getting used to thinking about pointers. 39 00:05:22.230 --> 00:05:31.530 William Cheng: And also you should get used to not leave any resources if you allocate a bunch of memory when you're done with a you're supposed to free it if you open a file. If you're done with a file, you should close it. 40 00:05:31.980 --> 00:05:39.150 William Cheng: In warm up assignment warm up one and two. If you Malik something and you don't free. It's not a big deal if you open something you don't close is not a big deal. 41 00:05:39.630 --> 00:05:49.890 William Cheng: Okay, when you get into the colonel colonel assignment, they will be requirement for you to keep track of all these resources if you, you know, create something you might have to free otherwise going to end up losing points. 42 00:05:50.220 --> 00:06:00.150 William Cheng: OK, so again one more time and not so important. Colonel assignment. Some of these resources are they the the colonel summer insist that you that the the other you actually manage them. 43 00:06:01.740 --> 00:06:09.810 William Cheng: All right. Alright, to create a temporary file, you know, for some reason, then, in this case, when you program is about determination free issue, you should delete all these files that 44 00:06:11.790 --> 00:06:21.390 William Cheng: All right. And, you know, if you read data from an external source. For example, the user is typing something you read data from a file. Well, you have no idea what data is is actually in that file. 45 00:06:21.720 --> 00:06:28.830 William Cheng: Okay, so in that case you needed to be very, very careful because if you expect that the data is always going to be eight bytes long. What if it's 100 bytes long 46 00:06:29.280 --> 00:06:36.990 William Cheng: Well, in that case, if you only allocate an eight by buffer. He tried to write 100 bytes into it, you can end up with a buffer overflow and then sooner or later you're going to crash. 47 00:06:37.920 --> 00:06:42.960 William Cheng: OK. So again, it's important to know exactly how big your buffer is where as a buffer. Again, it's just an array of bytes. 48 00:06:43.200 --> 00:06:48.690 William Cheng: Okay, you should never overrides you should never have a buffer overflow to right beyond the size of the buffer. 49 00:06:48.960 --> 00:06:54.450 William Cheng: Okay. So, therefore, you have to always know what you're reading right if you don't know you have to read very, very carefully. 50 00:06:54.810 --> 00:07:02.850 William Cheng: There. So one of the things that typically that we recommend is that you should never use a function constraint copy to copy to say like you copy a string from source to destination. 51 00:07:03.300 --> 00:07:10.350 William Cheng: The source can be really, really long and the destination is going to be a buffer very if you write if you copy too much data you can end up the buffer overflow. 52 00:07:10.680 --> 00:07:21.750 William Cheng: Error. Okay, so instead of using string copy every time when you try to use drink coffee, you should use the, the other version of it as a string and copy you actually specify the size of the buffer. So this way you will never fall 53 00:07:22.860 --> 00:07:31.800 William Cheng: Right, so, so, so if you want to copy a string from here to here. You need to know how big this buffer is when you string and copy the second argument is going to be the size of the buffer. 54 00:07:32.190 --> 00:07:46.440 William Cheng: Okay, so be careful to to to to, sort of, you know, figure out exactly what the size of the buffer is okay. You're the you're the programmer, you're creating the buffer. You need to know how big a buffer his if you don't know how big a buffer is what they don't copy into it. All right. 55 00:07:47.790 --> 00:07:53.790 William Cheng: And sometimes we saw before he you size up right so you need to get used to use something called sizer 56 00:07:54.150 --> 00:08:00.480 William Cheng: If you use size of a buffer over here. If the buffer is declared like this what the size of the buffer is that a number of bytes and that data structure. 57 00:08:00.600 --> 00:08:06.360 William Cheng: So in this case, you know, the size of buffer over here is equal to eight bytes. So therefore size above is going to be good at. 58 00:08:06.780 --> 00:08:15.240 William Cheng: But if you have a pointer type right you stay charged star, you know, P over here. And if you try to use size a pea sized the P is always going to be equal to four. 59 00:08:16.200 --> 00:08:21.960 William Cheng: Okay, because this is the pointer type and I just mentioned on a 32 bit machine appointed time is always four bytes long 60 00:08:22.380 --> 00:08:31.740 William Cheng: Okay, whatever. It points to. So when you use size. A. P. You are not at you, you're not trying to sort of figure out what is the pointing to. You're actually asking about what is the size of this pointer. 61 00:08:32.220 --> 00:08:36.360 William Cheng: Where the size of the pointer or the 32 bit machine is always good for all right. 62 00:08:37.080 --> 00:08:43.770 William Cheng: Okay, finally, this is one of your requirement. You know when you try to compile your code, you have to use minus wi LL 63 00:08:44.310 --> 00:08:53.430 William Cheng: You know, to, to compile your code. So, this one will turn off all the compiler warning. Okay. And then what you need to do is that you need to make sure that when you compile your code, you have zero compile time warning. 64 00:08:54.570 --> 00:08:58.500 William Cheng: Alright, so, so you end up you have compiler warning grade is going to take points off. 65 00:08:58.770 --> 00:09:06.360 William Cheng: Okay, so it's your responsibility to try to sort of figure out what is the compiler trying to tell you when it give you a warning. Usually the compilers trying to help you out. 66 00:09:06.750 --> 00:09:13.530 William Cheng: Okay, so read the message is very, very carefully to understand what a compiler is doing. If you don't understand what a compiler is telling you send me email. 67 00:09:13.950 --> 00:09:22.890 William Cheng: Copy and paste that your competitor, the error message or the warning message to me so I can read it for you. Okay, don't be shy about asking. Okay. 68 00:09:25.470 --> 00:09:34.140 William Cheng: All right, you need to use the debugger. The debugger is your friend. You need to get to get another debugger right now. So starting with warm up why you should use the debugger. 69 00:09:34.380 --> 00:09:41.610 William Cheng: Okay, I cannot force you to use the debugger up I'm strongly encourage you to learn a debugger, that the debugger of choice is called GDP. 70 00:09:42.150 --> 00:09:50.040 William Cheng: GDP is the new debugger. So what you need to do is I will wait until the debugger program you say GDP, followed by the name of the executable program so 71 00:09:50.400 --> 00:09:59.310 William Cheng: For warm up what it could be list has could be warm up line. So you say GDP, followed by the name of the executable, you're going to get this GDP prob says GDP is is ready to step your commands. 72 00:09:59.850 --> 00:10:10.260 William Cheng: So typically, there's only like 10 or 15 things that we're that we're doing in GDP, guys. But again, it's a very, very simple debugger. All you need to do is to learn these 10 and 15 commands and then you're good to go. 73 00:10:10.920 --> 00:10:18.390 William Cheng: Okay, so here are some of the example of the command. Right. So what you would do is that you will set breakpoints always say break and you can say break, followed by a function 74 00:10:18.540 --> 00:10:25.320 William Cheng: So this way. I will your program run to the beginning of this function GDP will take control and you can actually do a bunch of stuff to it. Yeah. 75 00:10:25.830 --> 00:10:33.750 William Cheng: The other way is to set a breakpoint at a particular line so so for this test, I see you can set a breakpoint online at seven or my 42 whatever number that you have 76 00:10:34.020 --> 00:10:43.140 William Cheng: Net. So you're going to set a bunch of breakpoint and then going to use the run command the run command. If you just type run, it will be the same thing as running your program without any comment on arguments. 77 00:10:43.680 --> 00:10:51.570 William Cheng: Okay, if your program is supposed to have command line arguments you say run followed by all your command line arguments. Okay, but the. But in this case, you don't have to say run this test. 78 00:10:51.720 --> 00:10:55.860 William Cheng: Because you're already debugging this test, right. So you say run, followed by the command argument. 79 00:10:56.610 --> 00:11:03.750 William Cheng: Okay, so what it will do is at this point three things can happen number. The first thing has happened is that your program run to completion. Everything's perfect and that will be fine. 80 00:11:04.050 --> 00:11:11.490 William Cheng: Number two is that he will hit one of the breakpoints. Okay, if you have, if you hit one of the breakpoints GDP is back in control and you can do a bunch of development mass 81 00:11:12.210 --> 00:11:24.960 William Cheng: Number three is that you are correct your program will crash. Okay. So, in that case what you would do is as soon as your program cash. Every time your program crashed. The first thing we should do is to type where it will tell you where your program died. 82 00:11:26.160 --> 00:11:30.480 William Cheng: There. So that's one of the reason you need to use the debugger whenever your program die you type where 83 00:11:30.720 --> 00:11:38.580 William Cheng: Exactly. Your program die and then you look at your cursor. Oh, obviously this is, you know, this is why dies, if it turns out it's not so obvious. Well, then you have a debug your code. 84 00:11:39.150 --> 00:11:50.400 William Cheng: Okay, so the first thing that you should always do is to do where so so when you start to send me an email to say, hey, my program died, you know, my problem crash. What could be the cause. The first thing you need to tell me is that when you type where, what do you see 85 00:11:51.330 --> 00:11:57.330 William Cheng: Okay, so. So get used to this whenever you click on it were. And then what I will do that. It will show you the stack or the stack trace. Right. 86 00:11:57.750 --> 00:12:03.840 William Cheng: So I think if you're familiar with Java or C plus there's another command call stack trace. This actually is. Where are exactly the same thing. 87 00:12:04.110 --> 00:12:09.570 William Cheng: Okay, is show you that the main function is going to call this function is going to call this function and eventually whatever function call. 88 00:12:09.870 --> 00:12:18.120 William Cheng: Is going to crash. So he will show you all these function. So, sorry, it's going to show you all the stack rank starting from May all the way to the point he died. 89 00:12:19.080 --> 00:12:23.070 William Cheng: Okay, so look at that very, very carefully, because what it will do is that is that for every function. 90 00:12:23.250 --> 00:12:31.440 William Cheng: It will show you what the function arguments are so maybe if you look at the function arguments as, Oh, I know what why more appropriate diet because one of the function arguments over here is wrong. 91 00:12:32.280 --> 00:12:36.750 William Cheng: Okay, so in this case very, very quickly, you will you will figure out what why you forgot died. 92 00:12:38.040 --> 00:12:48.000 William Cheng: Alright, so you should always do this first run your program. If it crashed to wear. Look at the Apple very, very carefully, understand what it's trying to tell you guys okay if you don't understand what it's trying to tell you 93 00:12:48.210 --> 00:12:53.640 William Cheng: For that to me and then asked me to to read it for you. Okay, you need to learn this as early as possible. 94 00:12:54.450 --> 00:13:02.010 William Cheng: Right. So some of the things that you can do with GDP takes control is that you can clear the breakpoints. So you say clear if you had a breakpoint. It will clear the breakpoint. 95 00:13:02.400 --> 00:13:09.390 William Cheng: You can print any kind of a see expression, you can say prayer you know P list right arrow anchor or something like that. 96 00:13:09.870 --> 00:13:17.550 William Cheng: So this will print, you know, putting out the information you can also ask you to print in hex you say print slash x, then everything will be a hexadecimal. 97 00:13:17.850 --> 00:13:26.910 William Cheng: Whenever you try to print an address, you should always look at the hexadecimal version. Okay. Because the hex MS decimal version and give you a lot more information than the decimal version. 98 00:13:27.780 --> 00:13:32.460 William Cheng: Right, whenever you put in an address always use the hexadecimal version there. 99 00:13:32.850 --> 00:13:39.900 William Cheng: Alright, the next thing that you can do over here is to to single step right the next over here. Is that what you will do is that if you're currently at a function. If you do next. 100 00:13:40.050 --> 00:13:47.460 William Cheng: What he will do is that they will call the function and that function returns. It will a GDP will get control again but now you're in the next next line your sequel. 101 00:13:48.060 --> 00:13:57.420 William Cheng: Then if it turns out that you're at a function. You can also step inside. So in this case, the commands step. So it wasn't when you step you're gonna if you're at a function, you will go inside the function and then 102 00:13:57.600 --> 00:14:04.800 William Cheng: You, you, you, GDP watch it will actually will break right there. Okay, so again, get used to these commands to see what they do. 103 00:14:05.280 --> 00:14:09.660 William Cheng: The other thing that you can do to satisfy point that some other debug recall is my point. 104 00:14:09.870 --> 00:14:21.030 William Cheng: In GDP is called display. So you can say display followed by again a see expression. So from this point on every command that you type in GDP, it will keep printing this particular number 105 00:14:22.020 --> 00:14:27.570 William Cheng: Okay, so this is very, very useful because let's say that right now. You know, you know, your progress. Is that a good state. 106 00:14:27.960 --> 00:14:32.850 William Cheng: This number over here is always zero. Okay, so what you will do that. You can satisfy point on 107 00:14:33.150 --> 00:14:44.880 William Cheng: From this one. Or you can do next, next, next, next, next, all of a sudden, this does not become a real really big number. Well, then, what is telling you is that the last thing that you do make this number go crazy. Well then, then this case, what, what would you do 108 00:14:45.180 --> 00:14:53.520 William Cheng: What you will restart your debugger and now when you get to the point where where it goes crazy. You start stepping into a function and not you know 109 00:14:54.090 --> 00:15:02.160 William Cheng: And and not and not use the next command instead of using the step command and then you do next, next, next, and try to sort of figure out what we are programmed crashed. 110 00:15:03.030 --> 00:15:12.180 William Cheng: Guys that again whenever you try to debug over here. You might have to read run the debugger multiple times in order for you to find the bugs don't expect to find the bug in the first in the first shot. 111 00:15:12.420 --> 00:15:22.380 William Cheng: Okay, unless you're really lucky. Right. So you crash your type where you know exactly what bugs are great right otherwise a you to go through this multiple paths. Okay, so that that's what you should expect 112 00:15:22.860 --> 00:15:31.140 William Cheng: Is that a debugger. You can also temporarily change a value, you can use the set command to say you know this one. You said it to 99 and then you can continue to single step and see what happens. 113 00:15:31.740 --> 00:15:32.970 William Cheng: Next, right. 114 00:15:33.540 --> 00:15:39.480 William Cheng: So if you are done with single step. And you can also use the continue command will use to continue command again three things going to happen. 115 00:15:39.630 --> 00:15:49.410 William Cheng: Your program can go to the end and everything is perfect, or you hit a breakpoint or your programs crash and you do this over and over again. But when you're done, you take the quick command and then you can go back to your 116 00:15:50.010 --> 00:15:59.940 William Cheng: To go back to your login shop. You can change your program re compile it and then my yoga all over again. Okay, so these are the basic command that you need in GDP. You don't need anything else. 117 00:16:00.840 --> 00:16:06.300 William Cheng: Alright, so, so, so some people say, oh, maybe I should try Eclipse, I should try you know Microsoft or something like that. 118 00:16:06.810 --> 00:16:18.660 William Cheng: But again, you know, when you try to debug the colonel assignment. The Colonel assignment is designed to work with GDP. So, you know, if you try to learn another debugger all your time will be wasted because in the end, when you go to your Kronos. I mean, you have the GDP again. 119 00:16:19.020 --> 00:16:25.170 William Cheng: Okay, so therefore I strongly recommend you to start using GDP, you know, your first assignment now. 120 00:16:26.580 --> 00:16:30.120 William Cheng: All right. Any question about GDP, feel free to send it to me. Alright. 121 00:16:30.720 --> 00:16:39.660 William Cheng: So let's talk a little bit about one on one and warm up on has two parts. So I call a Part A and Part B because they correspond to part in part be inside the grading guidelines. 122 00:16:39.930 --> 00:16:46.950 William Cheng: The grading Garland divided into two parts. The first part is known as the plus point parts and the second point is known as the minus point point minus 123 00:16:47.640 --> 00:16:58.800 William Cheng: Points part, the first part also divide into two parts. Part A and Part B, right, you put it in a part be a perfect, you get 100 points and then what the greater will do is that it will go through the minus points. Actually, I tried to take points away from you. 124 00:16:59.550 --> 00:17:08.400 William Cheng: Okay, so you should need to make sure that your, your, your plus points section is perfect and also you need to make sure that the greater, can I take away any of the points in the minus point section there. 125 00:17:09.540 --> 00:17:18.750 William Cheng: The first part called upon a you need to develop a web link circular list called my fall to list. According to the spec. So again, read the spec very, very carefully. 126 00:17:19.440 --> 00:17:23.610 William Cheng: So you need to implement a traditional link list abstraction there. 127 00:17:24.120 --> 00:17:30.390 William Cheng: Internally, the implementation is a circular. That's right. So when we need to sort of distinguish what is an abstraction and what is an implementation. 128 00:17:30.780 --> 00:17:35.670 William Cheng: Okay, so in party over here, you are supposed to implement it using the circular list. 129 00:17:36.060 --> 00:17:41.790 William Cheng: Okay, if you don't want to use a circular less. We're not going to read your code, so therefore it's going to be okay, right, but you're supposed to use a circular list. 130 00:17:42.030 --> 00:17:48.090 William Cheng: The reason you need to use a circular. This is that because when we get to the colonel assignment. The Colonel assignments full circle list. 131 00:17:48.720 --> 00:17:56.430 William Cheng: Okay, so if you're used to circular list that you will not be will not be afraid, you know, but otherwise going to be scarce as well. What is the secret list. What do I have to do with it. Yeah. 132 00:17:57.210 --> 00:18:03.180 William Cheng: Alright so internally the implementations and circular less but it behaves like a traditionalist there. 133 00:18:03.540 --> 00:18:11.130 William Cheng: Alright. And the reason for that always get a question, why do we need to implement a circular list the circular list implementation may be a little cleaner. 134 00:18:12.000 --> 00:18:19.740 William Cheng: Okay, then a traditional implementation. Right. So again, you know, there's not much difference. But hopefully you will learn that you know people like circle is because a little cleaner now. 135 00:18:20.160 --> 00:18:31.050 William Cheng: Alright, in part B, you're going to use the double link circular list that you implement it in part a and use that to implement a command called the sore command the command. Basically what we're trying to do is 136 00:18:31.890 --> 00:18:39.810 William Cheng: You know, sort of simulate reading a list of bank transactions sort them based on the time of the transaction and then print them out, you know, using a certain format. 137 00:18:40.350 --> 00:18:46.020 William Cheng: Okay, so it again. It's a very sort of a traditional assignment you read employees short, then you print it up. Okay, very 138 00:18:46.230 --> 00:18:52.350 William Cheng: Very, very simple. And this correspond to part B of the grading guidelines. Okay, so I've got a sort of briefly talk about, you know, these two parts. 139 00:18:53.070 --> 00:19:00.930 William Cheng: It's, it's extremely important to pay attention to the grading guidelines. Okay, the grading guidelines show you what a good inputs. What about inputs. 140 00:19:01.500 --> 00:19:07.740 William Cheng: OK. So again, you know, by running suitability guidelines you get plenty of examples of what good input look like what bad input look like 141 00:19:08.250 --> 00:19:17.430 William Cheng: So again, you know, and also, as I mentioned last time, the greater the greater, greater assignment. There's only one way, the greatest lot of great and that's by following the grading guidelines. 142 00:19:17.730 --> 00:19:23.040 William Cheng: Okay, so if you don't follow the wedding. Guys, you shouldn't be surprised if you end up getting zero in the programming assignment. 143 00:19:23.700 --> 00:19:34.290 William Cheng: Right, because again, the greater has no choice but to follow the waiting allies. If you ask the greater degrees great in a different way, the greater has to refuse it ok so again grading down is very important. Yeah. 144 00:19:35.910 --> 00:19:53.820 William Cheng: The recommended timeline for warm up. One is that you should finish Part A, by the end of next Tuesday. You know, the woman. One is, do another week after that. Okay, so. So pray over here, you need to implement the sparkle. My for to list. I see. It's about 100 lines long. 145 00:19:54.900 --> 00:20:02.730 William Cheng: Okay, so you should do this as early as possible. Okay, and try to finish it before next Tuesday. And then, you know, spend the rest of the week to try to finish our be gag and 146 00:20:02.970 --> 00:20:15.840 William Cheng: Part B, if you're a good see programmer or c++ programmer. I mean this program should be very, very simple. Right. Otherwise, you know, if you're not a good si, si se programmer, then this is your opportunity to get really, really good at it as soon as possible. 147 00:20:17.430 --> 00:20:20.070 William Cheng: Alright, so you can see how is that possible. How can I mercy, you know, 148 00:20:21.840 --> 00:20:30.450 William Cheng: One or two weeks. You just have to put all your time into it. Okay, any kind of a see combo. The concept of you who don't understand you need to talk to me and hopefully I can help you understand that. 149 00:20:30.660 --> 00:20:37.860 William Cheng: Okay, especially with idea like pointers and stuff like that. If you're confused about them asked me as many questions as you want. Okay. 150 00:20:38.670 --> 00:20:45.120 William Cheng: All right, well, you should shoot for is that you should finish Part B. By the early submission deadline to get 10% extra credit 151 00:20:46.110 --> 00:20:53.880 William Cheng: Okay, for every programming assignment is completely doable to finish by the 10% extra credit Li, you just have to start your assignment early 152 00:20:54.390 --> 00:21:05.580 William Cheng: Okay, so the summer, you should not be doing anything else but doing this you know that we're taking this class and make sure that you finish every programming assignments early. So this way. In the end, you will be able to understand everything 153 00:21:06.720 --> 00:21:07.020 William Cheng: Okay. 154 00:21:09.420 --> 00:21:11.880 William Cheng: Alright, so let's talk about the the link lists. 155 00:21:13.830 --> 00:21:21.390 William Cheng: litmus abstraction. So, so what's the list, right, the list is abstract data type. Yeah, some kind of a data structure and then they also come with a bunch of functions. 156 00:21:21.900 --> 00:21:27.840 William Cheng: Here are some of the functions that you're supposed to us with a list, right. So, again, to link this right yeah bunch of stuff that are linked together right 157 00:21:28.050 --> 00:21:35.430 William Cheng: So what do you need to do to use this particular language. Right. So for example, you need to find out who is the first on the link class. So there's a function called first 158 00:21:35.640 --> 00:21:40.710 William Cheng: If you're somewhere in the middle of the list. There's another function called next that will give you the next guy on the New England list. 159 00:21:40.920 --> 00:21:47.490 William Cheng: You have a function called last that will give you the last guy on the link glass your function called previous that will tell you to go back to get the previous guy on the last 160 00:21:47.940 --> 00:21:50.220 William Cheng: Issue of a function called insert to ask 161 00:21:51.000 --> 00:21:57.810 William Cheng: Linda is you should have a function called remove to remove stuff on the link bears, you have a function called count, you know. So all these are the function 162 00:21:58.020 --> 00:22:09.990 William Cheng: That you used to manipulate Inglis. Good. So again, the, the idea of after data type is that there's a data structure that you implement a linguist and there's a bunch of function that allow you to actually use them to to manipulate the linguists. Okay. 163 00:22:10.830 --> 00:22:18.390 William Cheng: All right, so we need to have a well defined interface. So for warm up one the interface is defined for you and you are not allowed to change it. Okay. 164 00:22:19.080 --> 00:22:28.530 William Cheng: So once you do, so you don't have. I have a world is that interface. If it turns out your implementation is wrong, you should fix your implementation issue not fix the interface. 165 00:22:29.070 --> 00:22:36.360 William Cheng: OK, so again in warm up. What I'm going to give you the interface. You're not allowed to change it. You are supposed to implement, you know, 166 00:22:36.990 --> 00:22:39.960 William Cheng: The implement the list. According to the spec. Okay. 167 00:22:40.890 --> 00:22:46.560 William Cheng: All right. And also I'm also going to give you an application that will use the language. And again, you are not allowed to touch the application. 168 00:22:46.920 --> 00:23:00.180 William Cheng: Because the application is written, so that is supposed to work with the assumption of this list list abstraction. Okay. So, therefore, you're not allowed to change your application. Okay. The only thing that you allowed to change is your implementation of my fault, my boy to list. Yeah. 169 00:23:06.060 --> 00:23:09.300 William Cheng: Alright, so there are basically two types of lists. 170 00:23:10.440 --> 00:23:15.480 William Cheng: So again, you know, if you haven't. Next and the Previous point or point to the elements of the list over here. 171 00:23:16.050 --> 00:23:24.690 William Cheng: The first way is that the next in the previous point are they are part of the objects. Okay. So as I mentioned before, when we use the word object, we're talking about any kind of 172 00:23:25.110 --> 00:23:36.300 William Cheng: You know, a basic data type. THE SIMPLE BETA data types like characters like integers like floating point numbers. They can also be complex data type of pointer data type. Okay. The word object can be anything. 173 00:23:36.900 --> 00:23:45.630 William Cheng: Okay. All right, so, so, so typically, what you will do is that if you want to keep track of list of stuff you can create these objects and inside these object, you can actually have Next and the Previous pointer. 174 00:23:45.750 --> 00:23:48.930 William Cheng: So this way you will you will link them all together and create a linked list. 175 00:23:49.320 --> 00:23:56.880 William Cheng: Then, so this will be the first type of list where the Next and the Previous pointer are part of the object. Right, so it will look like this. Right. Every one of these is that object. 176 00:23:57.060 --> 00:24:04.200 William Cheng: Inside the object. There's a next point or appointed a next object on the list. And there's a previous point here. The point of the previous object on the last 177 00:24:04.440 --> 00:24:11.280 William Cheng: Guy. And then if you are the first object, the previous pointer would typically appointed no need for the last object. The next point, or will point it not 178 00:24:11.880 --> 00:24:20.130 William Cheng: Okay, so this way you can you can you can you know you can implement a bunch of function or the function that I mentioned before, the first, last, insert the remove all that kind of stuff. 179 00:24:20.790 --> 00:24:31.680 William Cheng: Yeah, all right. A major drawbacks of this first implementation is that, you know, you know, if you only have one next point or my previous pointer. Then in this case this object. How many lawyers kind of belong to 180 00:24:32.610 --> 00:24:39.990 William Cheng: What this object can only belong to one nurse, because if you want this object to belong to, to less what then you need to next point and to previous pointer. 181 00:24:40.860 --> 00:24:47.250 William Cheng: Okay, so therefore, in this case, if you want this object to be belong to three less. In this case, you have to have three next point two and three previous monitor 182 00:24:47.850 --> 00:24:55.710 William Cheng: Okay, alright. So that's the first type of list. The second type of list. The Next and the Previous puncher outside of the object. Right. So in this case, this is our list right here. 183 00:24:56.040 --> 00:25:07.830 William Cheng: Okay, the list has a pointer, as also on the pop over here, web, it will sort of have to list. So in this case, the next and previous partner. There are part of the list, and the list has an object pointer over here or pointed the object. 184 00:25:08.700 --> 00:25:19.470 William Cheng: Okay, so this way. If you want a one object with belong to, to list. What would you do well. You're gonna create one list over here. You gotta create another list inside this list over here. They're all these data structure and one of them will punted this object. 185 00:25:19.740 --> 00:25:23.550 William Cheng: And now this object can be it can be belong to as many lists as you want. 186 00:25:24.780 --> 00:25:28.710 William Cheng: Okay, so, so for warm up. What we're going to implement the second kind of list. 187 00:25:29.670 --> 00:25:38.700 William Cheng: Alright, so it's a little unusual. But again, this is a programming exercise for you to understand how pointer works how these lists work and things like that. So again, you need to implement the second, the 188 00:25:39.120 --> 00:25:42.720 William Cheng: Second way that. So the way we're going to do this is that we're going to give you 189 00:25:43.320 --> 00:25:49.260 William Cheng: A. So we're going to give you a header file and the header file is going to be the one that you had that that you have to stick to it. 190 00:25:49.980 --> 00:25:58.650 William Cheng: Right, so, so here's the picture of the second list, right, we're gonna have a list. I look like this. And then there's the LBJ pointer over here that will point to some kind of object. 191 00:25:58.980 --> 00:26:03.600 William Cheng: Okay, so this could be a list of so so so again, what kind of object as opposed to 192 00:26:04.080 --> 00:26:13.530 William Cheng: What we have no idea. This could be a list of submarines. This could be a list of space shuttles, this could be a list of floating point numbers. It could be list of integers. We have no idea what is the list of 193 00:26:14.280 --> 00:26:18.900 William Cheng: Okay, so you're going to end up implementing a list like that. Okay. You can use this list of point to anything. 194 00:26:19.860 --> 00:26:26.850 William Cheng: That alright so here's an abstraction of that we're going to implement it in as in a circular less and this case our data to look like this. 195 00:26:27.030 --> 00:26:33.780 William Cheng: This list is called My for two lists right in the example over here that we stopped before we here. It's a linguist for for objects. 196 00:26:34.110 --> 00:26:45.150 William Cheng: There. So now, if we're going to, you know, if we do part A of our program as part of our problem in the Simon over here we're going to end up with five of these objects over here that have all these pointers. 197 00:26:45.480 --> 00:26:52.020 William Cheng: Okay, the first one over here is inside the list. So this one is known as the anchor object, the anchor is part of the list. Okay. 198 00:26:52.530 --> 00:27:00.540 William Cheng: So what it will do is that it will point to the first element and also pointed the last element. Okay. And then what it will do is it, it will make sure to inform you in the end it will form a circle this 199 00:27:01.260 --> 00:27:05.610 William Cheng: That. So the list at the bottom over here is going to be a list of four objects. 200 00:27:06.570 --> 00:27:09.900 William Cheng: Okay, so if you look at this list. You say, Well, what is the what is the empty list look like 201 00:27:10.350 --> 00:27:19.650 William Cheng: That if you start removing these object and continue to maintain that into a circular list, you will see that if you keep removing these object in the air, what, you know, what does the emptiness will look like. 202 00:27:20.070 --> 00:27:27.720 William Cheng: The empty list. The next objects over, he will pointed anchor itself and the previous point of view appointed to anchor yourself and that will be what an empty list look like 203 00:27:29.250 --> 00:27:32.430 William Cheng: Or is it again. This is how you would implement this particular list. Okay. 204 00:27:34.440 --> 00:27:42.030 William Cheng: So, so let's take a look. Take a look at that list definition over here. Again, this is I call this the interface. This is a specification of what the my for to list look like 205 00:27:42.450 --> 00:27:50.970 William Cheng: They are two things. One of them is called My for to list element. So these are called list element over here so you can see that in this picture. In order for me to keep track of for 206 00:27:52.140 --> 00:27:58.110 William Cheng: You know, for object. I need a link list. I need a circle and Linda, so five my up five list elements. 207 00:27:58.290 --> 00:28:06.840 William Cheng: Okay, every element has three pointers one point to point to the next guy on the list and the other one point of the previous guy on the list and the other one point to the object. Yeah. 208 00:28:07.650 --> 00:28:10.440 William Cheng: Alright, so in this case it will look like this right here is my for to list element. 209 00:28:10.860 --> 00:28:17.700 William Cheng: There's a net and there's a previous and then there's the object that data type of the object is called voice star right. What is the boy star. 210 00:28:18.300 --> 00:28:35.100 William Cheng: Okay. Some people will say, Boy, Star Wars is a pointer. That's not correct. Okay. So, so for this class, maybe for this cause only or in general, when you see that when whenever you see a voice on a 32 bit machine. All that means as as the Ob, J is a four by number 211 00:28:36.270 --> 00:28:44.310 William Cheng: Okay, so what we do here as a Fulbright number. It doesn't have to be appointed, but it could be a pointer. Right. Why is that because a pointer, it just a four by 212 00:28:44.880 --> 00:28:55.950 William Cheng: A pointer, just a Fulbright number right but a pointer is something that contain the address. So this is the pointer icon in the address on a 32 bit address space. Well that's equal to four by thong, guys, so therefore I can actually put the address here. 213 00:28:56.580 --> 00:29:03.270 William Cheng: Can actually put a character here. I can also put a character there. Can I put an integer here. I can also put an integer. Here I can actually put anything here. 214 00:29:04.140 --> 00:29:15.360 William Cheng: Okay so boy star is a data type to say that, you know, this is a 32 bit number. I have no idea whether it's a pointer or something else. Okay. All I known as a Fulbright number 215 00:29:16.710 --> 00:29:18.600 William Cheng: All right. That's what a voice Doris. 216 00:29:20.310 --> 00:29:26.310 William Cheng: Okay, so, so again, don't assume anything. Right, so, so, so, you know, in part a warm up why 217 00:29:26.850 --> 00:29:35.040 William Cheng: You need to you're implementing a list. Okay. If you're inputting unless somebody says, Hey, keep track of this object for me to. You have to know what kind of object it as 218 00:29:35.520 --> 00:29:41.550 William Cheng: Well, you don't. Okay. Somebody give you a pointer to it, you just point to it right so you don't need to know whether it's a list of summary. 219 00:29:41.790 --> 00:29:48.690 William Cheng: Or whether it's a list of, you know, space shuttle or do some integers. You have no idea what it is. Okay, so that's what you're supposed to do. Yeah. 220 00:29:49.350 --> 00:29:56.670 William Cheng: Right, and then come the list over here. So again, if you go to the previous picture over here. What's inside or less right instead unless there's an anchor guys over here. 221 00:29:56.880 --> 00:30:07.800 William Cheng: My for two lists over here. There's anchor right the anchor over here is not a pointer is actually a data structure, right. So the anchor over here is exactly 12 by slowly contained three pointers over here. 222 00:30:08.250 --> 00:30:11.310 William Cheng: But this one the anchor itself is not a pointer there. 223 00:30:11.850 --> 00:30:19.500 William Cheng: There's another field over here called non members to tell you how many, how long the link losses. Okay, so when you first create a list. 224 00:30:19.710 --> 00:30:25.770 William Cheng: In this case number number of your should be equal to zero. Okay. And the anchor over here, you need to have the anchor point to itself. 225 00:30:26.310 --> 00:30:34.950 William Cheng: Okay, so that, so, so, so, so what happened is that when you start with a list. The first thing you need to do is to initialize the list right which we just talked about that every time when you go to Data structure, you need to initialize 226 00:30:35.310 --> 00:30:42.360 William Cheng: So for my for two lists. There's a second. Let me clean this up a little bit right when you create a my for to list. What do you have to do over here. 227 00:30:42.570 --> 00:30:52.080 William Cheng: Well, the first thing over here is that the number over here instead of zero and then next need to point it, enter, enter is up in the previous need to point to the anchor yourself. What about the LBJ over here. 228 00:30:53.340 --> 00:31:03.630 William Cheng: Well, the overview is actually not being used. Okay. Because, because, you know, and over here. There's just extra pointer. So, therefore, you don't have to initialize the OB SharePoint or if you want. Or if you want to evangelize it that's also fine. 229 00:31:04.860 --> 00:31:13.950 William Cheng: Okay, so, so in my 14 days over here. I need to keep track of the length of the list. And also, I need to the next and previous. Why do I need to the Next and the Previous pointer. 230 00:31:14.160 --> 00:31:20.160 William Cheng: Right, because remember the abstraction that were important over here is a link list, we need to know who is the first and who's the last 231 00:31:21.240 --> 00:31:29.340 William Cheng: Okay, so therefore we use the next point over here to point to the first one we use the previous one over here to point to the last one. So therefore, the LBJ point over here is totally useless. 232 00:31:30.240 --> 00:31:41.730 William Cheng: Okay, you can leave it on initialize, if you like, or you can point it to. Now, if you like, well, but but don't use it. Okay, under no condition you should use the obituary pointer inside the anchor. Okay. 233 00:31:43.800 --> 00:31:52.950 William Cheng: All right, if you look at the header file because there's also a bunch of stuff over here. They're the really weird over here. It says, you do not have to set these function pointers. 234 00:31:53.430 --> 00:31:57.930 William Cheng: Okay, I'm always going to get email to say what a function pointers. I'm not going to tell you a function pointers are 235 00:31:59.400 --> 00:32:10.110 William Cheng: Okay, so what you should do is that you should need to learn to ignore things that does not concern you, because the comment says, Don't worry about them. Okay. You do not have to set these things. So, so don't do it. 236 00:32:11.760 --> 00:32:16.710 William Cheng: Okay, so of course later on, you're gonna you're gonna know function pointers are because they're actually very important in this class. 237 00:32:17.100 --> 00:32:25.950 William Cheng: Okay. But at this point, I'm going to ask you to ignore them. You should feel comfortable about ignoring things that you're asked not to touch. Okay. Because later on when you go to the colonel assignment. 238 00:32:26.550 --> 00:32:32.790 William Cheng: There will be many, many places you are not supposed to touch stuff that you don't know about, okay, because as soon as you touch them your corner is going to blow up. 239 00:32:33.150 --> 00:32:39.720 William Cheng: Okay, so therefore you need to get used to. Ignoring stuff you just trust that they're perfect. Okay. And that will be okay. All right. 240 00:32:41.640 --> 00:32:51.990 William Cheng: All right, so there's bunch of function pointer ignore them and then in the header part over here, it sort of tells you, these are external definition over here. So what is trying to tell you that these are the function that you have to implement 241 00:32:53.430 --> 00:33:08.250 William Cheng: Okay, so, so, so again, in part A of warm up while you're supposed to write a write a file called My 402 list. I see. Okay. So inside this far. You're supposed to implement all these functions that are external in the header file. 242 00:33:09.360 --> 00:33:14.370 William Cheng: Okay, so these are the these are just a function that you have to implement. Right. So over here, they give you the function portal type 243 00:33:14.880 --> 00:33:24.990 William Cheng: Guys are therefore you're supposed to look at the spec and understand what they're supposed to do and the implement all these functions. Alright, so they're all dysfunction and then I guess it also my fortune in 244 00:33:27.060 --> 00:33:36.450 William Cheng: In in a function or the last option over here is how you initialize the list. So therefore, every time we create a data structure of my for to list the first thing that you should do is to call my 245 00:33:36.720 --> 00:33:48.510 William Cheng: To Do list and then to initialize them into an empty list. Okay, all these other function, all these other function. What they will do is that whenever you call any of the other function, they will assume that the list is a valid list. 246 00:33:49.680 --> 00:33:55.590 William Cheng: Okay, so what about on this right the balance over here again the list over here is very, very simple. Right. We started the picture over here, the list. Very simple. 247 00:33:56.040 --> 00:34:06.690 William Cheng: Valley list over here is that here is a list. Okay, if this is the value list. What does the number over here, the number of elements on this list. Okay. The number over here has to be equal to four. 248 00:34:07.380 --> 00:34:12.930 William Cheng: Okay, because this is a linked list a circular lingo. So for object. So the number of elements over your has to be equal to four. 249 00:34:13.080 --> 00:34:21.030 William Cheng: So this means that every time when you add something to the linguists, you need to increment a number of elements on this list every time you delete something on the list. You also need to make sure it's consistent 250 00:34:21.780 --> 00:34:27.780 William Cheng: Okay, so when we call any of these other function we always assume that the first argument over here is going to be a valid this 251 00:34:27.990 --> 00:34:35.910 William Cheng: Guy. So, therefore, you have to start with about this and then from this point on all these operation will continue to maintain that these this list will be a valid list. 252 00:34:37.890 --> 00:34:47.730 William Cheng: Alright, so again, this particular function over here. When you finish writing that it should be about 100 lines of code. Okay. If you end up to be 500 lines of code. Maybe you're doing something totally wrong. 253 00:34:48.960 --> 00:34:50.430 William Cheng: Okay. All right. 254 00:34:52.050 --> 00:35:01.260 William Cheng: Okay, so, so how do you start right you can actually copy my for to list at age into my forward to this. See, in that case will be all wrong, right, because the header file over here doesn't look right. 255 00:35:01.470 --> 00:35:09.660 William Cheng: You need to get rid of all these data structure, you need to get rid of all these keywords external because they don't make sense in a dusty file in the get rid of all the pound define over here. 256 00:35:10.050 --> 00:35:21.780 William Cheng: So, okay, read the warm up one FAQ, it will sort of give you the procedure where you have to do. Okay, so this way you will start with a template for my afford to list. I see. And then you need to implement all those functions. 257 00:35:22.830 --> 00:35:30.330 William Cheng: Alright. Alright, so here's what the basic structure look like once you copy that you need to you need to replace the top bar over here with pounding clue. My for to list out. Ah. 258 00:35:31.050 --> 00:35:37.260 William Cheng: So in see Wednesday pounding clue what it will do is it will take this file and take the entire content of the file and put it right here. 259 00:35:38.040 --> 00:35:45.840 William Cheng: Okay, so the entire content of the file over here I show you that already. So, so you can copy all the stuff. Put it right there. And that will be what you're what we call a look like 260 00:35:46.230 --> 00:35:51.930 William Cheng: Okay. So in this case, all these external view will be redundant. You need to get rid of them. And then you need to implement all these functions. 261 00:35:53.250 --> 00:35:59.580 William Cheng: Or so, again, very, very simple. That's how you will start implementing for $2 the my fault, my fault to the STASI yeah 262 00:36:02.010 --> 00:36:12.180 William Cheng: Alright, so, so let me briefly go over some of the function that you're required to implement the length over here. I gave you the implementation already, right. So in this case, what you have to do is that what is the length of the list. 263 00:36:12.360 --> 00:36:19.830 William Cheng: Why are we here you have non members over here instead of list. So you just return non members because a non member always tell you how many elements are on the list. 264 00:36:20.310 --> 00:36:27.720 William Cheng: Okay, so therefore it's going to be your job to make sure that you know the length over here always return that the correct number there. 265 00:36:28.620 --> 00:36:37.170 William Cheng: And then another function to say whether the list is empty or na while so this function or you try to return, whether the number of Members over here is equal to zero or not. If you go to zero that is empty. 266 00:36:37.650 --> 00:36:46.680 William Cheng: Over here I say less than or equal to. So that's also ok ok if it's not equal to zero that mom, you shouldn't go negative. Right. So if it doesn't equal to zero, that means empty. Yeah. 267 00:36:47.460 --> 00:36:48.720 William Cheng: All right, where's the pen. 268 00:36:49.050 --> 00:36:57.720 William Cheng: Right. So this is the first element on the list. When you tell a parent something you're a pending something at the end of the list. So, therefore, this is the last guy over here with each other or 269 00:36:57.930 --> 00:37:03.420 William Cheng: Something over here. I'm going to a pendant object and the pen object over here. It's a voice star type because I have no idea what it is. 270 00:37:03.750 --> 00:37:11.640 William Cheng: Okay. So this guy is, how would I implement this guy. So in this case, what I will do is that I will actually create a Maya for to list element over here. 271 00:37:11.880 --> 00:37:17.760 William Cheng: I'm going to use Malik because I'm dynamically create this particular object again. You are not allowed to use a static 272 00:37:18.300 --> 00:37:21.390 William Cheng: Static location you have used that me allocation by calling Malik. 273 00:37:21.750 --> 00:37:24.210 William Cheng: Okay, so, man. I will create this data structure over here. 274 00:37:24.390 --> 00:37:33.510 William Cheng: And then you can use a pointer to point to it. Okay. And then how do you append that to the list right so in this case. The next point is you pointed this guy and this guy's nets wider should point to the anchor. 275 00:37:33.690 --> 00:37:46.620 William Cheng: Okay. The anchors previous pointers. You pointed this guy and this guy's previous finder to point to the last elements over here the object over here, as you point to copy this value over here into into our last field over here. 276 00:37:47.850 --> 00:37:58.770 William Cheng: Okay, so, so, because you know you don't know what type of object. This is right. So if you're given a pointer, you should just copy the address. Okay, so this way you point to the same thing, right, whenever you copy a pointer you point to the same object. 277 00:37:59.970 --> 00:38:04.560 William Cheng: Okay, so therefore you somebody give you a give you an address, you just copy the address and then going to end up pointing to the same thing. 278 00:38:05.070 --> 00:38:12.300 William Cheng: Yeah, one of this object over here is actually not a pointer. Okay, if it turns out it's a character. What, in this case, you copy a character. Again, it works perfectly. 279 00:38:12.690 --> 00:38:18.720 William Cheng: Okay, so therefore, in this case, don't try to point to it. Instead just copy from object over here to the object field over here. 280 00:38:19.740 --> 00:38:24.720 William Cheng: Alright, so again if you don't understand, you know, well, well, if you don't understand what that means. 281 00:38:25.050 --> 00:38:33.300 William Cheng: You know, in warm up one that's your exercise to understand what that means to copy to copy a pointer. Okay. And also, if it's not a pointer copy also works. 282 00:38:33.900 --> 00:38:45.900 William Cheng: All right. Okay. So am I done over here. Well, there's one more thing I need to do the number over here. I need to increment by one right plus or equal to one, right. So now I end up with a list of five elements or so therefore I need income and number 283 00:38:46.230 --> 00:38:55.290 William Cheng: Okay, that's all you have to do for a pen. Okay. You can also look at the other you know function over here, prepare you added at the right before the first element over here is called pre pan. 284 00:38:55.980 --> 00:39:05.700 William Cheng: There's some info on link if I employee, I will point over here. So this is my for two lists elements over here, this will be appointed a point to one of the elements over here as hardware. A link something 285 00:39:06.330 --> 00:39:18.240 William Cheng: Okay, it's okay if you have a linguist like this, right, I need to unlinked. This one was so in this case what I need to do is I need to point around it. Right. And then once I finished pointing around it. Then I finished on that link and this object. 286 00:39:19.410 --> 00:39:25.500 William Cheng: OK. So again, I'm like, it's very, very simple. You just, you know, sort of move the pointer around it so so so this way you can only get 287 00:39:26.580 --> 00:39:33.180 William Cheng: So, by the way, I always get this question. When you unlinked something over here, this object point to something. Am I supposed to free that object. 288 00:39:34.620 --> 00:39:43.140 William Cheng: Okay, the answer is no, you are, you know, so over here. If I, if my pointer over here is pointing this object right when I on Lincoln. That's why this is called on link is doesn't call free 289 00:39:43.860 --> 00:39:49.620 William Cheng: Okay, I'm just unlinked from the list. What am I supposed to do with the object. OK. You are not allowed to touch it. 290 00:39:50.430 --> 00:40:00.630 William Cheng: Okay, why is that, well, because maybe somebody else is using it. Right. I mean, so again, in part A of a warm up. Why you are the list, implement, are you are you know, your job is to keep track of things. 291 00:40:00.900 --> 00:40:05.970 William Cheng: Are you allowed to delete these things while you're not allowed to delete the things you are not authorized to lead these things. 292 00:40:06.510 --> 00:40:15.120 William Cheng: Okay, so therefore we are linked object over here, even though this object might point to a summary. You are not allowed to free up the submarine or otherwise otherwise your plans will crash. 293 00:40:15.330 --> 00:40:25.260 William Cheng: Again, because this object might be known to many, many lists. So if you just unlinked this object from one list, you know, you shouldn't really delete the object. If you delete the object all the other list will point to invalid objects. 294 00:40:26.010 --> 00:40:32.130 William Cheng: Okay, so it's very, very important to understand wine you we unlinked something you're not allowed free right 295 00:40:33.300 --> 00:40:42.030 William Cheng: All right. And then there's a link on all of them. And then there's insert before answer after again read the spec over here. First and the Last and the Next and the Previous are the things 296 00:40:42.510 --> 00:40:49.230 William Cheng: There's a fine operation. Try to find that objects or again this case where you have to do is that you need to traverse the list a hobby traverse less 297 00:40:51.030 --> 00:40:56.970 William Cheng: There so it is take a look at this list over here. Right, so I know what I have a pointer pointed list or I have a 298 00:40:57.330 --> 00:41:05.580 William Cheng: Data structure of the list over here. This is my list in order for me to traverse the list. I need to call the first function over here to give me the first element over here. 299 00:41:05.940 --> 00:41:13.260 William Cheng: Okay. So if I look for a particular object. I need to compare the object. I'm looking for against this pointer over here to see if they have exactly the same value. 300 00:41:14.190 --> 00:41:18.000 William Cheng: Okay, so one of them says to the other way is to whether they're exactly the same, then I found it. 301 00:41:18.570 --> 00:41:22.200 William Cheng: Otherwise, I'm going to follow the next pointer over here or call the next function over here. 302 00:41:22.380 --> 00:41:30.570 William Cheng: To go to the next list element over here again computer this object against us up to see if they're the same. I'm going to keep going until I go to the the end over here. Okay. 303 00:41:30.780 --> 00:41:35.940 William Cheng: Whenever I go to the, the last over here in order for me to go to the next object over here. Where would it go to 304 00:41:36.450 --> 00:41:41.220 William Cheng: Why you look at this picture over here to say it's a circular list after last over here, I will go to the anchor. 305 00:41:41.820 --> 00:41:48.660 William Cheng: But if you return the anchor the application programmer is going to be very surprised. Right. The application programmer is the one that asked you to keep track of list of submarines. 306 00:41:49.050 --> 00:41:56.220 William Cheng: And so therefore, when they iterate through this list is to iterate so so so unless it on the application for one right I'm asking you to keep track of for summaries. 307 00:41:56.790 --> 00:42:06.450 William Cheng: Okay, so when I read through this list, I better return only four times because I don't have four submarines. Okay. If you return to me the anchor the the the operational. So what is an anchor. I've no idea what it is. 308 00:42:07.050 --> 00:42:16.980 William Cheng: Okay, so therefore, when you try to implement the next function over here. So if you're already at the end of the list over here. If you try to get you know if you try to implement a next, I'm sure you have to return. 309 00:42:17.250 --> 00:42:21.240 William Cheng: So, so in this case the next of the last element over here has to return all 310 00:42:22.950 --> 00:42:30.930 William Cheng: OK. So again, it's up to you to implement it, if somebody gave it a last item on the list and say, Who is next in this guy Tuesday. The next is not because you have reached the end of the list. 311 00:42:31.500 --> 00:42:38.370 William Cheng: Okay, so this way you, won't you, will not, you know, circulate this forever because you got to have a way to terminate this particular list. Yeah. 312 00:42:39.570 --> 00:42:49.170 William Cheng: Well, I finally the inner function over here is the one that will initialize less okay and you said number object over here equals zero. And then you have the Next and the Previous appointed anchor yourself. Okay. 313 00:42:51.540 --> 00:42:56.640 William Cheng: Alright, so again, this is the code for traversing the, you know, this list over here. Okay, so what happened is that 314 00:42:57.390 --> 00:43:02.040 William Cheng: You know, the application program that will use your list will try to traverse the list and they will use co like this. 315 00:43:02.280 --> 00:43:11.340 William Cheng: The application programmer, the application program. They do. They would know whether they want you to keep track job Alyssa submarines or list of space shuttle or list of integers. 316 00:43:11.730 --> 00:43:20.880 William Cheng: Okay. So then why should know the data type of objects, right. It's just a, you're not supposed to look to know. Okay, so therefore, in this this example over here the object that we create a 317 00:43:21.660 --> 00:43:27.750 William Cheng: Data Type called foo guys computer science people like to say fu for some reason over here. Alright, so I'll be here. There's a food pointer. 318 00:43:28.110 --> 00:43:32.460 William Cheng: So what I would do is I will call this function. I'm going to call my phone to listen first over here. 319 00:43:32.910 --> 00:43:43.680 William Cheng: So what it will do is it'll return to you. The first pointer over here. Okay. And then what I will do is that I will use the elements object field over here to point at this object. And we're going to type Casa to start 320 00:43:44.340 --> 00:43:55.890 William Cheng: Okay. The reason I can type has to start because I'm the creator of the list. So therefore, I know you know how to object. So therefore, I know how typecast voice pointer to the pointer that that I'm actually using 321 00:43:56.520 --> 00:44:01.950 William Cheng: Okay, so this way. I will type classes over here. I'm, I mean, that was the full pointer. I can look at the fields of the food. 322 00:44:02.220 --> 00:44:05.040 William Cheng: The food object and try to sort of figure out what I need to do with that. 323 00:44:05.280 --> 00:44:12.870 William Cheng: If it turns out this is not the logic that I need that I will go to the next iteration over here. So in this case, what I would do is I will call my for to list next 324 00:44:13.080 --> 00:44:19.530 William Cheng: Using the same list right here. And then the element over here is going to be this element. And this function is to return to me the next element over here. 325 00:44:19.920 --> 00:44:31.470 William Cheng: Okay, so I'm going to keep doing this until the next function over here, return. Now that means I finished visiting the the entire list. And now I will return a null pointer. So I know I finishing traversing the entire list. 326 00:44:32.370 --> 00:44:42.090 William Cheng: Okay, so your implementation on my forward to list has to be written in such a way that this code will work with your list. Okay. Otherwise, it's a bug in your code now. 327 00:44:46.680 --> 00:44:57.570 William Cheng: Alright. So for part a, you know, the program that you must that you must run has already been written for you. This program is called list as okay basically tried to test your list over here. 328 00:44:58.170 --> 00:45:02.880 William Cheng: It will use your implementation or less and run a bunch of tests. Okay. Make sure that your implementation is perfect. 329 00:45:03.150 --> 00:45:08.700 William Cheng: Yeah. So, by the way, I was good this question to say that what if you program pass list that does that mean that you list implementation is perfect. 330 00:45:09.000 --> 00:45:13.230 William Cheng: Of course not. Right. It just means that it passed the list test. Okay. That's all it means. 331 00:45:13.530 --> 00:45:21.180 William Cheng: If it turns out you you have some bugs that are hidden while that then, then, then it may be the case that list has will not be able to discover all your books. Yeah, right. 332 00:45:22.050 --> 00:45:29.460 William Cheng: So, so you have to use the provider list test. See, and make file to create list as all the scene, you can download them from the wall one speck 333 00:45:29.910 --> 00:45:39.540 William Cheng: Guy. I'll use the make file to compile your code. So the list as much run without error and you must not change CS brought to that age. My for to this is 334 00:45:39.840 --> 00:45:49.560 William Cheng: This test. I see. And may fall over here, right. So the only other the file you need to create is my for to list our see. And then, you know, once you've finished creating them. You finish implementing that 335 00:45:49.950 --> 00:45:56.490 William Cheng: You need to type make and they will create list and you run the program. Right. So again, respect to find out how this works. 336 00:45:56.910 --> 00:46:05.910 William Cheng: You also should learn how to run list that's under GDP. So in case your program list has crashed or to print out some weird error messages you need to sort of figure out what's going on. 337 00:46:06.240 --> 00:46:13.680 William Cheng: Okay, so listen star see is not well commented intentionally because obviously because I'm asking you to read the code. 338 00:46:14.550 --> 00:46:21.270 William Cheng: Okay, so in this class is very, very important to learn how to read the code that you did not right. Okay, you need to learn how to read other people's code. 339 00:46:21.780 --> 00:46:24.930 William Cheng: Okay, so you're going to start with one more while you're gonna start reading my code. 340 00:46:25.200 --> 00:46:36.450 William Cheng: There so so you're asked to read the code and figure out what it's doing. And understand when and why error messages are printed. Okay, don't just asked me to say, Oh, why am I getting this error message, read the code. 341 00:46:36.780 --> 00:46:48.690 William Cheng: Okay, and try to sort of figure out what's going on. Yeah. Alright, so we're here because that you are required to use your imagination. Okay. Whenever you see an error message. Read error message first to see, you know, 342 00:46:49.890 --> 00:46:50.940 William Cheng: To see what could it mean 343 00:46:52.260 --> 00:47:03.870 William Cheng: Okay, so, so to make an educated guess to see what it means and then read the code to sort of sort of figure out, you know, the activity related rats. Hopefully the error message you will be meaningful. So this way you can actually figure out what's going on there. 344 00:47:05.130 --> 00:47:09.150 William Cheng: So again, give it a try. And then. Can I just send me an email. If you have questions. Okay. 345 00:47:10.170 --> 00:47:16.950 William Cheng: All right on par be is implement this or command. Right. So we're going to run our program as warm up one. Okay, so you need to implement 346 00:47:17.580 --> 00:47:31.260 William Cheng: A program called warm up 111 take, you know, at least one command on argument and that command argument has to be the word sort. Okay, it's kind of very silly is there. Why, if it's if it's always the same. What do you have to specify a while because that's required. 347 00:47:32.370 --> 00:47:42.270 William Cheng: Okay, so you are not allowed to implement a different spec, you know, the only way to run 111 is going to be one more one followed by the worst sort and if the word is not sword you to print an error message in Quito program. 348 00:47:42.720 --> 00:47:51.210 William Cheng: Okay, the last argument over here. I'm going to use a notation, the square bracket over here. It's a notation. Okay. It says that this is an optional command on argument. 349 00:47:51.900 --> 00:48:02.850 William Cheng: Okay, if you read the spec, it will tell you that if this optional command argument does not exist, then you're supposed to read the input from standard in okay standard is called STD is 350 00:48:03.510 --> 00:48:08.760 William Cheng: OK. So again, if you want to know what it is you need to look look at a see tutorial. 351 00:48:09.330 --> 00:48:11.730 William Cheng: You know, it will tell you tell you how to read data from standard yet. 352 00:48:11.970 --> 00:48:22.320 William Cheng: Okay, if it turns out that the last argument over here is valid, then this can issue be treated as the name of the file and we're supposed to do is that you supposed to open the file and then process that data in the file. 353 00:48:22.890 --> 00:48:33.480 William Cheng: Okay, so when you're reading from standard in will use reading from the, from the file you should expect exactly the same format because the only purpose will warm up. What is the handle data of that format. 354 00:48:35.100 --> 00:48:41.100 William Cheng: Okay, so that format is known as a team file format over here says the empty file right so T file get respect to tell you exactly what to call this 355 00:48:41.370 --> 00:48:47.250 William Cheng: A teapot is a bunch of line over here every line contain for field and the fields are separated by the tab character. 356 00:48:47.730 --> 00:48:52.200 William Cheng: So in see the type characters backslash t. So there's a one Apache two batches t 357 00:48:52.500 --> 00:49:01.650 William Cheng: Three backslash T. The first field of yours one character is plus or minus. The second one is going to be a number which is the UNIX transaction is a Unix timestamp. 358 00:49:02.100 --> 00:49:12.630 William Cheng: Yeah you supposed to remain minus as to time to find out what it's all about. Okay, the search field over here is going to be an amount. So it's gonna be a bank transaction as a mouse $1 amount 359 00:49:13.020 --> 00:49:20.250 William Cheng: So it's going to be a number number can be zero. Okay, and followed by a period followed by exactly two digits. 360 00:49:20.550 --> 00:49:29.280 William Cheng: Okay. Some people don't know what that means is that, what does that mean to exactly two digits. That means that it can be three digits doesn't mean it can't be one digit know exactly two digits means exactly that. 361 00:49:29.880 --> 00:49:35.280 William Cheng: Okay, if it doesn't have two digits. It's an error in the input file, you should print an error message and put your program right away. 362 00:49:35.940 --> 00:49:38.910 William Cheng: Okay, don't try to handle input that's incorrect. 363 00:49:39.390 --> 00:49:48.300 William Cheng: OK. So again, read the script over here at the spec tells you exactly what the impossible. So look like anything that's wrong. You should print an error message and quit your program right away. 364 00:49:48.600 --> 00:49:57.090 William Cheng: Do not attempt to recover from the error because that's the spec. Okay. If you recover from your, from the era, then you're not implementing the spec. 365 00:49:57.750 --> 00:50:06.300 William Cheng: Guys okay in the air, which adequate your assignment. We have to follow the spec, we have to follow the grading guidelines. Okay, take all these are very, very seriously. Right. 366 00:50:06.960 --> 00:50:20.730 William Cheng: Right. And finally, the last part over here is called the transaction description. They are ASCII text strings over here, they cannot be empty. Okay. So, anything can be x or something like that, whatever, you know, garbage over there. It doesn't really matter. It just a string. 367 00:50:21.780 --> 00:50:28.380 William Cheng: Okay. So in this case, what you would do is that you need to read all these lines over here. You take the second line. The second argument over here, which is a timestamp. 368 00:50:28.620 --> 00:50:39.300 William Cheng: You need to treat them as an integer. And then you sort all these Ben transaction over here, according to the integer value and then for small to large and then you print out the, sort of, sort of the 369 00:50:39.810 --> 00:50:44.610 William Cheng: bank statement or guys. What does the bank statement look like right the bank statement will list all your transactions. 370 00:50:44.790 --> 00:50:58.860 William Cheng: list out the amount it also will keep a balance. So the beginning transaction balance going to be good to zero. And then you have to add depends on whether it's with the positive or there was draw a new to sort of plan out, you know, the balance every after every transactions. 371 00:51:00.060 --> 00:51:09.030 William Cheng: Okay, so, so, so think about when you write your program you are, you will be your bank customer, you want to read a good day, man. So you better make sure that your bank statement looks pretty 372 00:51:09.960 --> 00:51:13.950 William Cheng: Good, so, so, so, so the you know the spec tell you exactly what the best service possible flag. 373 00:51:14.700 --> 00:51:19.350 William Cheng: So here's what they look like. You don't have to print it. You're not supposed to print that this was sort of, basically it's a ruler. 374 00:51:19.590 --> 00:51:28.650 William Cheng: And set on top so you know exactly which column contains which character. So the first character over here is going to be this character and then followed by the transaction date. 375 00:51:29.340 --> 00:51:32.790 William Cheng: There and then followed by the description, followed by the amount, followed by the balance. 376 00:51:33.300 --> 00:51:38.340 William Cheng: For a negative, you know, the amount. We're going to use this notation of using a parenthesis. 377 00:51:38.670 --> 00:51:47.610 William Cheng: Okay, you should also notice that there's a blank space right in front of it. There's a blank, blank space right after. So again, by reading this format you need to print it exactly like this. 378 00:51:48.450 --> 00:51:54.930 William Cheng: Okay, so why do I require this again warm up. This is called a warm up assignment. It needs to get you good at printing stuff on the screen. 379 00:51:55.830 --> 00:52:00.570 William Cheng: Okay, so therefore you need to be able to control exactly what his character go in your output that 380 00:52:01.260 --> 00:52:08.160 William Cheng: The balance over here also can be positive or negative. Right. So again, you start with zero after you have a depository of this number after you have 381 00:52:08.370 --> 00:52:13.920 William Cheng: You know, another deposit you have more money after you have withdrawal, then this guy's gonna end up with, you know, less money and things like that. 382 00:52:14.760 --> 00:52:24.240 William Cheng: All right. Okay. So, I guess. Okay. Read the spec very, very carefully and then find out exactly, you know what the printer supposed to be again run through the grading guidelines the grading Ghana has solutions. 383 00:52:24.570 --> 00:52:32.730 William Cheng: You know, for the other principals who will die your printout needs to look exactly the same as my solution. Okay. Otherwise, the greater will have to take points off. 384 00:52:33.450 --> 00:52:37.260 William Cheng: Okay, some people say, oh, that's really tedious. You know, why does it have to be exactly the same. 385 00:52:37.680 --> 00:52:45.810 William Cheng: You know, if I have extra character. Well, you know, the, the idea here is that if they are different by one character. It should be a really easy buck for you to fix. 386 00:52:46.800 --> 00:52:55.590 William Cheng: Okay, this is the programming exercise. It asks you to learn how to use the debugger to find out exactly what the differences are. And this way you can learn how to fix your box. 387 00:52:56.460 --> 00:53:06.000 William Cheng: Okay. That's why you're asked to do all these things. Okay, so please do don't complain as a tedious. It's tedious intentionally so you can go get good at us, if you're already good at this. There should be no problem. 388 00:53:06.450 --> 00:53:10.980 William Cheng: Okay, anything that's different, you should be able to easily find out what's wrong with that and you fix your code and everything will be perfect. 389 00:53:12.000 --> 00:53:15.390 William Cheng: Right. That's what you're supposed to learn in Walmart one right 390 00:53:17.340 --> 00:53:25.560 William Cheng: All right, so you know. So over here I have one recommendation, how do you actually keep track of balances. So one thing that you know some people like to do is that they need to they'd like to 391 00:53:25.830 --> 00:53:30.300 William Cheng: Convert the amount over here into a double into a floating point number 392 00:53:31.050 --> 00:53:34.440 William Cheng: It's really not a good idea because once you do that, you're gonna end up with round of error. 393 00:53:34.830 --> 00:53:45.540 William Cheng: Then your app will be incorrect. Right. So one thing I would recommend is that you can cover everything two integers. So whenever you get a transaction. You can multiply by 100 right so you get the number of sense, you know, 394 00:53:46.320 --> 00:53:54.270 William Cheng: Your transaction amount. And then at this point you can just keep track of number of sense when you add or subtract integers, you will never lose precision. 395 00:53:54.960 --> 00:54:02.970 William Cheng: Guys. But again, that would be my recommendation do it that way. You can also keep track of things using floating point number. You just have to worry about roundup errs, yeah. 396 00:54:05.550 --> 00:54:06.000 William Cheng: All right. 397 00:54:06.750 --> 00:54:16.230 William Cheng: So you know the time over here is going to be the UNIX time again, there's some suggestion of what you can do. You can use a function called see time and that will give you a bunch of characters. 398 00:54:16.410 --> 00:54:20.670 William Cheng: You can copy those characters over here and print it, you know, into this buffer right here. So, again, that 399 00:54:20.880 --> 00:54:26.550 William Cheng: You can try these things out and find out which way is best for you and they use that implementation. Right. Some people always 400 00:54:26.760 --> 00:54:32.640 William Cheng: Try to use a special function is there. I just want to call a function, everything will work perfectly. What if there's no such function. 401 00:54:33.330 --> 00:54:36.990 William Cheng: Well, so in that case you need to use some other function in order to give you the same information. 402 00:54:37.710 --> 00:54:42.870 William Cheng: OK. So again, don't try to just, just do everything by using one function call. Okay. If it turns out that 403 00:54:43.380 --> 00:54:47.370 William Cheng: You know, it's pretty simple from another function call, you need to do is the need to write a simple function. 404 00:54:47.880 --> 00:54:57.900 William Cheng: To to to call another function and then copy all the data into the buffer in the right place and that this way you can just use that function. Okay. So the basic idea here is that you need to learn how to write your own functions. 405 00:54:58.470 --> 00:55:03.930 William Cheng: Okay, and then you put all your programs together by stitching up a bunch of functions together in the end, you're going to do the right things. 406 00:55:05.520 --> 00:55:13.530 William Cheng: Okay. All right. So that's how you supposed to run your program right a bunch of small functions, put them together and that will be your program. Okay. 407 00:55:15.750 --> 00:55:18.330 William Cheng: All right, so I guess. 408 00:55:19.380 --> 00:55:30.630 William Cheng: I guess a lot of stuff over here. I'm gonna, you know, I guess I'm starting to run out of time. Pretty soon. So again, read the the spec and the spec also point you do a bunch of requirement over here read everything very, very carefully. 409 00:55:32.910 --> 00:55:44.850 William Cheng: All right and and and you should use the virtual machine right away. So, you know, during this week, you should install your virtual machine and then it gives you your require use Virtual Box because the greater we use Virtual Box and then you can start 410 00:55:47.190 --> 00:56:00.300 William Cheng: Into your virtual machine. And then, you know, use your, you know, virtual machine to develop. Are you using Ubuntu 1604 to develop your programming assignment. Okay. So, this way we will you get your kernel assignment you will be ready. Okay. 411 00:56:01.860 --> 00:56:14.160 William Cheng: Well, by the way, there's one common over here, don't run the grading script inside the virtual machine is shared folder, are you going to get error messages over here again copy everything into, you know, into Ubuntu 16.04 in order for you to run the grading script. 412 00:56:16.140 --> 00:56:20.190 William Cheng: Alright, so I'm going to sort of skip some of these that you have questions, feel free to ask me. 413 00:56:20.430 --> 00:56:28.230 William Cheng: There's also. Can you send me the README file the README file probably provided for you. All you have to do is to take the remains template over here and then modify the 414 00:56:28.770 --> 00:56:34.950 William Cheng: Template according to the instruction. Okay, so there are several important sections over here, what is called build and run 415 00:56:35.190 --> 00:56:43.860 William Cheng: What you're supposed to do is to read the instructions very carefully. Replace the comments in there by you know your own specification over year. 416 00:56:44.160 --> 00:56:52.230 William Cheng: Or. So in this case, again, if the command is make you need to replace, you know, though, that all the comments over here with your command to actually clear executable. Okay. 417 00:56:52.590 --> 00:57:00.030 William Cheng: And also there's a section called self grading, you are required to give yourself a great in every of the item that's mentioned in the grading guidelines. 418 00:57:00.600 --> 00:57:09.750 William Cheng: Okay, so in this case where you need to do again read a very carefully, you will mention that they're a bunch of question marks over here, you're, you're, you're expected to replace the question mark with your own grade. 419 00:57:10.980 --> 00:57:16.950 William Cheng: Okay, so, so again, you're supposed to do it if you don't do it for every question mark that you forget to replace. We're going to do that half a point 420 00:57:18.240 --> 00:57:29.220 William Cheng: Alright, so, so, so again, take this very, very seriously. Because in the end, there's only one way to great, yeah. There's also a section called bugs and test escape if you know that your program will crash. 421 00:57:30.240 --> 00:57:35.070 William Cheng: Okay, when it runs a particular test, you should ask the greater not the greater okay so if you ask whether or not 422 00:57:35.370 --> 00:57:41.040 William Cheng: You're not going to get a plus positive points for it. But again, in this case, you will not lose negative points because your program and our crash. 423 00:57:41.490 --> 00:57:45.030 William Cheng: Guys, okay, you should use this to your advantage. I mean, what you're supposed to shoot 424 00:57:45.300 --> 00:57:53.340 William Cheng: Shoot for is that your program should work perfectly. So in this case, the section should be empty, guys. And this guy. Usually you should replace the say none. I don't have any bugs you know 425 00:57:53.850 --> 00:57:58.800 William Cheng: There'll be no testers to skip that. And finally, there's an additional information for the greater 426 00:57:59.070 --> 00:58:07.140 William Cheng: This section is optional. Okay, so if you want the greatest know about something you should fill out something something there. Otherwise, you can leave a blank. Okay, so you can also 427 00:58:07.830 --> 00:58:12.360 William Cheng: Replace it with the word none to say that I have no additional information or to provide to the greater 428 00:58:13.080 --> 00:58:19.740 William Cheng: Okay, so when you're done. There should be no question markings on your Readme file, other than the one that are part of the instructions. 429 00:58:20.370 --> 00:58:27.240 William Cheng: Okay. So whenever you make a submission. Check your Readme file to make sure that they are perfect, so you don't lose any silly points. 430 00:58:27.660 --> 00:58:36.570 William Cheng: Okay, a silly point will be a leftover question mark really you know that you know these points. Okay. So, therefore, make sure you don't you don't make silly mistakes like that. Okay. 431 00:58:38.430 --> 00:58:39.030 William Cheng: All right. 432 00:58:40.140 --> 00:58:45.870 William Cheng: Again, this is what I just mentioned before, you know, some people will end up writing a long one long function that's 500 433 00:58:49.230 --> 00:58:54.300 William Cheng: lines long. You should learn not to do that, you know, write your program in well defined functions. 434 00:58:54.450 --> 00:59:04.980 William Cheng: Every function needs to be modified and then India you put a bunch of functions together to call other functions and then India your main provider just in India, just make up just add to the call bunch of functions. 435 00:59:05.520 --> 00:59:14.430 William Cheng: Okay, so that's what your plan is supposed to do. Some people actually if you follow some kind of under the software engineer, in principle, they would tell you that every function should not be longer than 10 lines. 436 00:59:14.580 --> 00:59:23.910 William Cheng: Some people say 20 lines, you know, I don't know if there's a standard for that. Right. The basic idea over here is that you need to, you know, sort of design your code. So that is consists of a bunch of functions. 437 00:59:24.960 --> 00:59:28.200 William Cheng: All right. I mean, when it comes to grading. We're not going to grade on 438 00:59:28.860 --> 00:59:39.420 William Cheng: We're gonna, we're not going to create your programming assignment, according to the style guide. But again, these are just recommendations. Okay, so you don't have to follow it, but it's a good is sort of a good way to go. Yeah. 439 00:59:41.760 --> 00:59:50.220 William Cheng: All right, lots of requirement again read everything. If you have questions, send them to me. So I guess that will be the end of the you know the 440 00:59:51.480 --> 01:00:03.540 William Cheng: The discussion section for the first week. So, so I'm going to release this video by 6pm on Thursday night so that if you have any questions about warm up one or about the video. 441 01:00:04.110 --> 01:00:12.120 William Cheng: Tomorrow, on Friday, you know, you can you can actually go to the live discussion section and ask the question, you know, to the to the TA. Yeah. All right.