WEBVTT 00:00.280 --> 00:06.210 A lawful orders and deal now how we analyze structure that repeat themselves exactly N times. 00:06.240 --> 00:10.010 For example you need to find the maximum number in there not a certain point. 00:10.050 --> 00:12.740 So you need a follow up that is repeated 10 times. 00:12.750 --> 00:14.720 However this is extremely limited. 00:14.790 --> 00:20.340 Numerous times we want to just do a specific task without really knowing calming steps it will take 00:20.340 --> 00:21.050 to fix it. 00:21.090 --> 00:25.800 Let's assume that you want to calculate the details a number for example cover the number. 00:25.810 --> 00:27.350 Five hundred seventy eight. 00:27.390 --> 00:31.400 The adbul these three Indeed you have the number forty nine thousand two hundred. 00:31.480 --> 00:33.010 Well the old with these five. 00:33.060 --> 00:36.120 So we continue to find out how many digits we have. 00:36.120 --> 00:37.980 We had some try and there are procedures. 00:37.980 --> 00:44.670 So while it's a combination between For statement more specifically you will write why then number a 00:44.670 --> 00:49.920 great event zero in the in column these means that the program was around inside the law and the VIN 00:49.920 --> 00:53.090 number it means to value a smaller or equal to zero. 00:53.100 --> 00:58.170 We can do it or create a very single program you know little sawka way look walks into recreate did 00:58.170 --> 01:00.370 we have for a wide look. 01:00.870 --> 01:03.940 Let's assume that we have a mother X with numbers. 01:06.350 --> 01:11.850 This program needs to find the first five numbers that are greater than 20 and save them in then you 01:11.850 --> 01:13.610 are free. 01:13.670 --> 01:19.750 First we will create this program with a follow up after grading this program with both Ford and Y lobe. 01:19.800 --> 01:25.370 We saw the differences let us on that we cover these Magix and we need all five of these first five 01:25.370 --> 01:26.120 numbers. 01:26.120 --> 01:33.170 So first we will calculate the length of the matics any sequel to Len matics in we will initialize a 01:33.170 --> 01:36.380 variable that saw how many numbers we need to find. 01:36.380 --> 01:41.700 So our proof of numbers or something is equal to 5. 01:41.720 --> 01:46.720 Then we will create this second least that saw the five numbers that we already find. 01:46.730 --> 01:49.000 We will call this a burger. 01:49.070 --> 01:55.790 We really miss her lased as empty least solving it does come they call Larry in order to find these 01:55.790 --> 01:56.340 numbers. 01:56.490 --> 02:01.380 So for I mean that ain't the zero comma. 02:01.850 --> 02:05.640 You know it is kind of a holiday and corn of course. 02:05.750 --> 02:08.840 Now Eve marve techniques. 02:09.650 --> 02:13.650 In the polls you see I did have 20. 02:13.670 --> 02:15.750 These means that the value that we breathe. 02:15.890 --> 02:19.180 We want to be greater than Wendy in order to do something. 02:19.280 --> 02:26.000 We will give these number to a beggar so burguiere Load up berrent in order to make their burger are 02:26.030 --> 02:29.460 a bigger In a really use them mastery books. 02:29.720 --> 02:34.510 I needed to give this exact number in the approval numbers. 02:34.550 --> 02:37.460 Now we have one less number that we want to find. 02:37.490 --> 02:43.300 So uproar at numbers is equal to our overall numbers minus one. 02:43.370 --> 02:49.790 Of course it is extremely important to write here about the approval numbers that they need to be greater 02:49.790 --> 02:50.470 than zero. 02:50.510 --> 02:55.340 So our proven number is greater than zero in as we're a dimension. 02:55.370 --> 03:01.040 In the previous section of this course here we will use the end function because we need to cover both 03:01.100 --> 03:04.170 at the same time numbered and it'll be greater than 20. 03:04.180 --> 03:08.270 In this scene time when it took several more numbers do using the least. 03:08.330 --> 03:12.560 Finally after all of these we will print the big Iraqi. 03:12.640 --> 03:16.030 Here we use I with small case but we need to use this. 03:16.310 --> 03:17.370 Let's try it again. 03:17.440 --> 03:17.860 Okay. 03:17.870 --> 03:19.220 Everything seems correct. 03:19.220 --> 03:20.520 We take four to five. 03:20.530 --> 03:24.230 Twenty then twenty five twenty six. 03:24.230 --> 03:27.540 One hundred twenty two and talk into two candidate. 03:27.540 --> 03:28.210 Twelve. 03:28.310 --> 03:33.200 We leave these numbers out of the burglary because we're on the first five numbers. 03:33.200 --> 03:37.410 After that we can try again with the while Hezbollah initialising gen. 03:37.450 --> 03:41.180 Their over numbers which is again on the 5. 03:41.200 --> 03:49.200 Then we could hear the SEC on narey sold their gear to and then released in order to save our numbers. 03:49.280 --> 03:54.720 Let's start there while here there while we're around until the end of the five numbers. 03:54.770 --> 04:02.370 So while our proved greater than zero in the column after the five numbers we don't want to do anything 04:02.370 --> 04:05.550 careless so the while loop length even then no. 04:05.570 --> 04:06.840 Saw the Matrix. 04:06.900 --> 04:09.980 Their position is good at 10 20. 04:10.050 --> 04:15.320 Again we we love Benylin you're number in this segment but you and of course we need to decrease the 04:15.320 --> 04:20.170 approved numbers so up a rule that is equal to Peru. 04:20.460 --> 04:21.730 Mine was one. 04:21.740 --> 04:24.960 Finally we will print them back. 04:26.520 --> 04:28.880 If you dig a second in the woods these why look up. 04:28.890 --> 04:32.820 You will notice that we don't have anything of that in these hills. 04:32.880 --> 04:38.090 I have said about the gold dust kind of the next then the next I saw it this extremely short answer 04:38.150 --> 04:40.410 to initialise I hear in. 04:40.410 --> 04:45.750 Then after the algorithm go seems the I I called my best one. 04:45.780 --> 04:47.040 This is really important. 04:47.150 --> 04:47.480 We're going. 04:47.560 --> 04:52.800 Watch this again and again in our Of course as you can see here we have the correct results both times 04:52.890 --> 04:55.640 and of course it is the same as you can see here. 04:55.660 --> 04:57.060 We have very important differences. 04:57.060 --> 05:01.280 First of all I need to be initialized instantaneous by hand. 05:01.290 --> 05:06.370 Also I would change that statement because a battlefield has already been done in the while loop. 05:06.390 --> 05:10.510 So why do we need to create the SEC on the way even the results out of the seam. 05:10.560 --> 05:15.810 If you look closely you will realize that the old world of course is the same by the numbers of the 05:15.810 --> 05:21.720 loop is not can see here that the first procedure you can see here that the first procedure will have 05:21.720 --> 05:22.520 said it in loops. 05:22.530 --> 05:25.650 We can test with a second one that will have on 8. 05:25.650 --> 05:26.660 Of course this varies. 05:26.670 --> 05:31.630 It depends on the input a hurry but the idea is that we will end the program exactly. 05:31.640 --> 05:32.610 Are there a dime. 05:32.670 --> 05:34.400 We will not do pointless loops. 05:34.440 --> 05:36.750 So now the one million dollar question. 05:36.750 --> 05:37.660 Is it worth it. 05:37.710 --> 05:42.350 As a matter of fact no in this particular problem with VS input add a. 05:42.540 --> 05:48.440 It is not a significant difference but as you already understand in these chords we tried to think big. 05:48.480 --> 05:55.590 So the key is that you have now a with 10000 numbers so indicates that you give a nardi with 10000 numbers. 05:55.610 --> 06:00.780 Hubel have done nine thousand and Sam think pointless laws into these souls a computational judicial 06:00.810 --> 06:03.510 power that is completely lost without any reason. 06:03.570 --> 06:09.090 So sure you can start to divide the good from bad programmers not from the output but from the code 06:09.120 --> 06:11.140 that leads to this output.