1 00:00:06,700 --> 00:00:12,370 Now that we have a good understanding of how he linked this works, we're going to take the time to 2 00:00:12,370 --> 00:00:15,850 begin creating our own implementation for a linked list. 3 00:00:16,810 --> 00:00:19,470 So the first thing I want to do is create a new lib. 4 00:00:19,480 --> 00:00:24,100 That way we can use test cases to evaluate our solutions. 5 00:00:24,670 --> 00:00:27,910 So I created a new LIB called it section 21. 6 00:00:27,910 --> 00:00:33,730 So we're going to want to go ahead and change into that directory as well as open up the lib rs file. 7 00:00:34,480 --> 00:00:36,970 We can get rid of all this boilerplate code. 8 00:00:37,810 --> 00:00:42,370 Now we are ready to begin setting up our linked list. 9 00:00:43,180 --> 00:00:49,030 So the first thing that we want to do from what we saw in the previous lecture is we want to create 10 00:00:49,030 --> 00:00:53,300 our node struct and we're going to have it over generic t. 11 00:00:53,320 --> 00:00:57,790 That way we can use any kind of elemental data, data that we would like. 12 00:00:57,940 --> 00:01:05,410 So we'll have our first element of type T, and then we're going to have our next, which is going to 13 00:01:05,410 --> 00:01:09,460 point to a custom data type of linked T. 14 00:01:10,120 --> 00:01:13,630 And remember next is going to point to our memory address. 15 00:01:14,650 --> 00:01:22,990 So let's go ahead and create our custom type link T and we're going to give it an option. 16 00:01:23,890 --> 00:01:28,480 Because if you recall, our head can point to a none. 17 00:01:28,690 --> 00:01:32,770 So with option, we can either point to some or to a none. 18 00:01:32,770 --> 00:01:34,750 So we want to use an option here. 19 00:01:34,750 --> 00:01:41,950 That way we can also point to a none, and we're going to give it a box that's going to contain a node 20 00:01:41,950 --> 00:01:51,880 T and now we want to create our struct that's going to hold our head, which is going to also be our 21 00:01:51,880 --> 00:01:52,540 list. 22 00:01:53,350 --> 00:02:00,310 And we're going to have our head, which is going to be of a custom type link t that we just created 23 00:02:00,310 --> 00:02:00,820 here. 24 00:02:01,870 --> 00:02:07,210 So this looks like a good starting point and to getting our link list set up. 25 00:02:07,450 --> 00:02:15,400 So in the next lecture, we're going to take some time to implement some methods into our linked list.