1 00:00:06,430 --> 00:00:13,060 And this lecture, we are going to go over the solution to the assignment from the previous lecture, 2 00:00:14,050 --> 00:00:18,010 and that was to implement in the SEO method. 3 00:00:19,270 --> 00:00:21,210 So we are now going to go over it. 4 00:00:21,220 --> 00:00:27,280 So again, as I said, it was going to be very similar to what we did for Floor. 5 00:00:27,670 --> 00:00:30,790 So we're going to have matching on our value. 6 00:00:30,820 --> 00:00:40,360 We're going to have some key and with this some key, we're going to match on key and then compare the 7 00:00:40,360 --> 00:00:41,050 value. 8 00:00:42,190 --> 00:00:52,840 And so what we match on is if it is ordering less, which means that our key is less than the value, 9 00:00:53,170 --> 00:00:56,170 then we will match on self, right? 10 00:00:57,160 --> 00:01:05,710 And we will say some node node dot seal on the value. 11 00:01:05,740 --> 00:01:09,640 Otherwise, none return none. 12 00:01:11,230 --> 00:01:18,670 All right, so now that we're done with ordering less, we do ordering greater. 13 00:01:20,470 --> 00:01:28,840 And then here again, now we're going to go on matching to the left, say some node 14 00:01:32,890 --> 00:01:43,090 and let vao equals node dot seal on our value and then we want to match on the value. 15 00:01:46,670 --> 00:01:53,030 And because we don't care what the value is, we want to just return the value. 16 00:01:53,300 --> 00:01:56,510 Otherwise, we just want to return our key. 17 00:02:01,050 --> 00:02:01,410 Right. 18 00:02:01,410 --> 00:02:03,900 So just remember, we're getting our value here. 19 00:02:03,930 --> 00:02:06,630 We're calling ceiling on the value. 20 00:02:06,630 --> 00:02:13,580 And if this is the value that we want to return, then we return our value. 21 00:02:13,590 --> 00:02:16,740 Otherwise we just return our some key. 22 00:02:17,820 --> 00:02:28,230 And now we say some key here to be exhaustive for this match statement. 23 00:02:28,350 --> 00:02:36,120 We now need to close out the exhaustion for our equals or for our ordering, which means we can have 24 00:02:36,120 --> 00:02:40,200 an equal, which means that we just want to return our key. 25 00:02:43,500 --> 00:02:45,510 And then lastly. 26 00:02:47,290 --> 00:02:54,520 We want to be exhaustive on our overall match statement and return none if needed. 27 00:02:56,170 --> 00:03:03,340 So as I said, the SEO method is going to be very, very similar to our floor method. 28 00:03:04,690 --> 00:03:06,070 Like very similar. 29 00:03:06,100 --> 00:03:07,990 What are our differences here? 30 00:03:08,230 --> 00:03:09,850 We have less. 31 00:03:10,810 --> 00:03:12,670 Less instead of less. 32 00:03:12,670 --> 00:03:16,630 Having all this logic greater has the logic now. 33 00:03:17,320 --> 00:03:25,270 That way we get the greatest the least greatest value above our argument being passed in. 34 00:03:26,410 --> 00:03:33,460 So now we just need to test out our SQL method and we have our test cases already created. 35 00:03:33,580 --> 00:03:40,130 So let's run cargo test and it seems I have some syntax errors expected. 36 00:03:40,150 --> 00:03:42,460 I identify or found keywords. 37 00:03:42,460 --> 00:03:49,300 So let's go to 146 and see what I did wrong here. 38 00:03:51,340 --> 00:03:53,490 So I said ordering less. 39 00:03:53,500 --> 00:03:56,490 It would help if I added that in. 40 00:03:56,500 --> 00:03:59,320 Let's see if that fixes it for me. 41 00:04:00,490 --> 00:04:02,230 Expected here. 42 00:04:02,230 --> 00:04:07,900 So 164 let's get rid of that and try it. 43 00:04:08,410 --> 00:04:11,770 And now it looks like we're still running successfully. 44 00:04:11,770 --> 00:04:17,590 Are floor and SEAL methods were executed correctly? 45 00:04:17,590 --> 00:04:22,270 So sealing is working as desired. 46 00:04:22,270 --> 00:04:32,440 So we pass into six and our tree the greatest least value above six that is in our tree is seven. 47 00:04:32,440 --> 00:04:40,810 And then when we pass in 4043 is the least greatest value above 43 in our tree. 48 00:04:41,080 --> 00:04:48,880 So hopefully this made sense to you and you enjoyed implementing in our very own binary search tree. 49 00:04:49,570 --> 00:04:56,110 If you have any questions, please feel free to ask them in the Q&A section and in our next section 50 00:04:56,110 --> 00:04:59,620 we will begin talking about dynamic programming.