Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,420 --> 00:00:06,810
What is going on, guys, and in this video, in this exercise, what we are going to do is to write
2
00:00:06,810 --> 00:00:07,680
a program.
3
00:00:07,710 --> 00:00:15,660
OK, so why the program just inside of these eight main function that all this program is going to do
4
00:00:15,660 --> 00:00:28,590
is basically to like to create a program that creates an array, let's say, of integers, and the user
5
00:00:28,590 --> 00:00:33,150
is going to specify some inputs for this array.
6
00:00:33,210 --> 00:00:46,140
OK, so let's say the user is going to specify the values for the array and then later on, once it's
7
00:00:46,140 --> 00:00:59,550
done, we are going to check and to print if the array is sorted or not, we are going to check or check
8
00:00:59,940 --> 00:01:10,950
if the array is like really sorted, OK, like really sorted, which means every element starting from
9
00:01:10,950 --> 00:01:14,060
the left to the right is growing.
10
00:01:14,190 --> 00:01:18,970
OK, or is that like sorted, please.
11
00:01:19,050 --> 00:01:28,560
Pleased that the element on the right is at least equal to the element on its left or larger or not
12
00:01:28,560 --> 00:01:29,100
sorted.
13
00:01:29,250 --> 00:01:29,550
OK.
14
00:01:30,390 --> 00:01:34,000
So it's basically I will give you one example.
15
00:01:34,020 --> 00:01:42,840
So let's say your array has I don't know these values like one, two, five, seven and 10.
16
00:01:42,870 --> 00:01:48,590
OK, so this array is basically like we will say, really sorted.
17
00:01:48,600 --> 00:01:54,210
And that means that these arrays really sort that because every element starting from the left to the
18
00:01:54,210 --> 00:01:59,680
right, you can see that the element on the right is greater than the element on the left.
19
00:01:59,700 --> 00:02:04,740
OK, and this condition is basically satisfied for every pair.
20
00:02:05,250 --> 00:02:09,150
OK, so this will be like really sorted.
21
00:02:10,230 --> 00:02:17,180
And before we'll take another example, the example, number two, and we will take like this.
22
00:02:17,180 --> 00:02:19,970
So one, two, two, five.
23
00:02:20,790 --> 00:02:29,740
And let's say ten, then that's actually not very or not really sorted or very similar to the one either.
24
00:02:29,810 --> 00:02:30,030
No.
25
00:02:30,540 --> 00:02:39,390
However you call it, because you see there is at least one pair of of Nabor numbers that they do not
26
00:02:39,390 --> 00:02:45,830
satisfy the condition that the element on its left is less than the element on its right.
27
00:02:45,840 --> 00:02:51,320
OK, so the element on the right equals to the element on the left.
28
00:02:51,330 --> 00:02:57,040
So that means that although there is a line of increasing.
29
00:02:57,060 --> 00:02:57,310
OK.
30
00:02:57,330 --> 00:02:59,120
So one, two, two, five, ten.
31
00:02:59,160 --> 00:03:02,460
There is nothing like a decreasing from left to right.
32
00:03:02,670 --> 00:03:05,670
So that's basically will be considered as sorted.
33
00:03:05,940 --> 00:03:14,390
And also just a third example that basically all is not really sorted and not sorted at all.
34
00:03:14,730 --> 00:03:19,760
That means that there may be like one, two, five, but there will be like three and ten.
35
00:03:20,100 --> 00:03:29,040
So at least one pair of education numbers that do not satisfy the condition that the element on the
36
00:03:29,040 --> 00:03:33,520
left is less than or equal to the element on the right.
37
00:03:33,570 --> 00:03:36,810
OK, so this will be not sorted at all.
38
00:03:37,800 --> 00:03:40,140
So three examples you can see here.
39
00:03:41,240 --> 00:03:48,590
And basically, that's what you are required to do to write these simple notes program that will be
40
00:03:48,590 --> 00:03:57,230
capable of receiving these inputs from the user and then basically to find out if it's really sorted,
41
00:03:57,230 --> 00:03:59,760
sorted or not sorted at all.
42
00:03:59,780 --> 00:04:01,610
OK, from the smallest to the largest.
43
00:04:01,970 --> 00:04:05,510
So that's basically what we are going to do in this exercise.
44
00:04:05,840 --> 00:04:14,060
So what I want you to do now is to take at least five, 10, 15 minutes and try to write these program
45
00:04:14,070 --> 00:04:14,690
on your own.
46
00:04:14,890 --> 00:04:21,470
I'm not using a separated in a different function for that because I'm not sure that it's appropriate,
47
00:04:21,470 --> 00:04:26,630
at least at the moment, because now we are going to write everything in the main function.
48
00:04:27,840 --> 00:04:30,480
And that's basically what you are required to do.
49
00:04:30,510 --> 00:04:37,260
OK, so that's why you can see here, right, a program is not just a function, so get yourself ready
50
00:04:37,260 --> 00:04:44,250
and start writing, because this video, once you are done, continue watching and check out the solutions.
5210
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.