﻿1
00:00:00,470 --> 00:00:04,130
‫In this course, we're going to spend a lot of time on big.

2
00:00:04,130 --> 00:00:08,510
‫Oh, it is a huge topic when it comes to data structures and algorithms.

3
00:00:09,200 --> 00:00:10,670
‫So what is Bigo?

4
00:00:11,650 --> 00:00:20,710
‫O is a way of comparing two sets of code and let's say code one and code to accomplish exactly the same

5
00:00:20,710 --> 00:00:21,250
‫thing.

6
00:00:21,340 --> 00:00:23,740
‫How would you compare one against the other?

7
00:00:24,130 --> 00:00:26,620
‫Code one might be more readable.

8
00:00:26,620 --> 00:00:27,640
‫That might be better.

9
00:00:28,360 --> 00:00:31,150
‫CO two might be more concise.

10
00:00:31,150 --> 00:00:35,650
‫The code might take up fewer lines, and if that's what you're measuring, then you would say that code

11
00:00:35,650 --> 00:00:36,610
‫two is better.

12
00:00:37,240 --> 00:00:46,450
‫Big O is a way of comparing code one and code two mathematically about how efficient they run.

13
00:00:46,870 --> 00:00:52,690
‫In a coding interview, you will absolutely be asked questions about Big O.

14
00:00:53,260 --> 00:00:56,500
‫So let's look at what Big O is.

15
00:00:57,230 --> 00:01:00,080
‫Let's say we have a stopwatch.

16
00:01:00,860 --> 00:01:07,070
‫And we run code one, we start the stopwatch and it runs for 15 seconds.

17
00:01:07,760 --> 00:01:11,150
‫And we reset the stopwatch and we run code two.

18
00:01:11,180 --> 00:01:15,610
‫And code two runs a lot longer than 15 seconds.

19
00:01:15,620 --> 00:01:17,210
‫It runs for a full minute.

20
00:01:17,920 --> 00:01:22,000
‫Based on this, you would say that code one is better than code two.

21
00:01:22,360 --> 00:01:23,800
‫You can measure it.

22
00:01:24,510 --> 00:01:27,330
‫This is called time complexity.

23
00:01:28,370 --> 00:01:34,670
‫The thing about time complexity that is interesting is that it is not measured in time.

24
00:01:35,380 --> 00:01:41,590
‫Because if you took the same code and ran it on a computer that runs twice as fast, it would complete

25
00:01:41,590 --> 00:01:42,430
‫twice as fast.

26
00:01:42,430 --> 00:01:43,510
‫It doesn't make the code any better.

27
00:01:43,510 --> 00:01:45,300
‫It just means the computer is better.

28
00:01:45,310 --> 00:01:50,320
‫So it is measured in the number of operations that it takes to complete something.

29
00:01:50,710 --> 00:01:54,430
‫And we'll look at examples of that as we go along here.

30
00:01:54,700 --> 00:01:59,140
‫In addition to time complexity, we measure space complexity.

31
00:01:59,710 --> 00:02:02,200
‫So let's say that code one.

32
00:02:02,850 --> 00:02:10,230
‫While it runs very fast comparatively, let's say it takes up a lot of memory when it runs.

33
00:02:11,030 --> 00:02:16,340
‫And maybe code too, even though that takes much longer to finish.

34
00:02:16,940 --> 00:02:18,740
‫Maybe it takes up less memory.

35
00:02:19,160 --> 00:02:26,450
‫If preserving memory space is your most important priority and you don't mind having some extra time

36
00:02:26,450 --> 00:02:27,320
‫complexity.

37
00:02:27,350 --> 00:02:29,270
‫Maybe CO two is better.

38
00:02:29,690 --> 00:02:34,850
‫So when you get into an interview, there's a good chance that you'll be asked questions about time,

39
00:02:34,850 --> 00:02:39,250
‫complexity, and then they'll say, Hey, well, what if space complexity is our main priority?

40
00:02:39,260 --> 00:02:40,310
‫How would you approach it?

41
00:02:40,310 --> 00:02:46,070
‫Then you have to understand both concepts and be able to address that in the job interview.

42
00:02:46,890 --> 00:02:49,830
‫But for the most part in this class, we will be dealing.

43
00:02:50,640 --> 00:02:51,930
‫With time complexity.

44
00:02:52,440 --> 00:02:54,840
‫And that is our quick intro.

45
00:02:55,900 --> 00:02:56,500
‫Big O.

