﻿1
00:00:00,470 --> 00:00:04,460
‫So now let's take a look at linked lists under the hood.

2
00:00:04,940 --> 00:00:12,110
‫So when we're working with a linked list and we add a node to the end and we have this node point to

3
00:00:12,110 --> 00:00:14,930
‫the four node and the tail point to the for node.

4
00:00:14,930 --> 00:00:20,690
‫And we add this in what is really going on when we do that.

5
00:00:21,200 --> 00:00:27,140
‫So in order to answer that question, the first thing we have to look at is what is a node?

6
00:00:27,590 --> 00:00:30,980
‫Well, this entire thing is the node.

7
00:00:30,980 --> 00:00:34,370
‫It is both the value and the pointer.

8
00:00:34,370 --> 00:00:41,000
‫It is not just the value, but that still doesn't quite answer our question.

9
00:00:41,390 --> 00:00:50,420
‫So the analogy I like to use for a node is that it is very similar to an unordered map where you have

10
00:00:50,420 --> 00:00:51,260
‫value.

11
00:00:51,260 --> 00:00:52,430
‫And next.

12
00:00:52,790 --> 00:00:58,790
‫So let's keep our node looking like this and add this into our length list.

13
00:00:59,360 --> 00:01:07,700
‫So the first thing we have to understand is that this seven node is also very similar to an unordered

14
00:01:07,700 --> 00:01:08,390
‫map.

15
00:01:08,630 --> 00:01:15,680
‫But how do we have that next pointer from the seven node point to the four node?

16
00:01:16,250 --> 00:01:23,510
‫Well, we do it by just setting next from the seven node to be equal to the other node.

17
00:01:23,930 --> 00:01:30,740
‫And then we'll do the same thing with the 23 node and the three node and the 11 node.

18
00:01:31,160 --> 00:01:38,150
‫So the length list is very similar to a set of nested unordered maps.

19
00:01:38,690 --> 00:01:45,890
‫And then we have a variable head that points to the first node, and then we have another variable tail

20
00:01:45,890 --> 00:01:48,110
‫that points to the last node.

21
00:01:48,620 --> 00:01:54,980
‫So this is a more accurate representation of what's really going on with the linked list.

22
00:01:55,280 --> 00:02:01,250
‫Now, obviously, looking at a linked list this way makes it look a lot more complicated and it's a

23
00:02:01,250 --> 00:02:04,580
‫lot easier to look at it when we do it like this.

24
00:02:05,260 --> 00:02:12,370
‫But looking at a length list this way is a much better representation of what's really going on under

25
00:02:12,370 --> 00:02:13,090
‫the hood.

