title
Data Structures and Algorithms in JavaScript - Full Course for Beginners

description
Learn common data structures and algorithms in this tutorial course. You will learn the theory behind them, as well as how to program them in JavaScript. ⭐️ Contents (link to code after title) ⭐️ ⌨️ Stacks (00:21) https://codepen.io/beaucarnes/pen/yMBGbR?editors=0012 ⌨️ Sets (09:03) https://codepen.io/beaucarnes/pen/dvGeeq?editors=0012 ⌨️ Queues & Priority Queues (19:24) https://codepen.io/beaucarnes/pen/QpaQRG?editors=0012 ⌨️ Binary Search Tree (26:03) https://codepen.io/beaucarnes/pen/ryKvEQ?editors=0011 ⌨️ Binary Search Tree: Traversal & Height (39:34) https://codepen.io/beaucarnes/pen/ryKvEQ?editors=0011 ⌨️ Hash Tables (53:19) https://codepen.io/beaucarnes/pen/VbYGMb?editors=0012 ⌨️ Linked List (1:03:04) https://codepen.io/beaucarnes/pen/ybOvBq?editors=0011 ⌨️ Trie (1:14:59) https://codepen.io/beaucarnes/pen/mmBNBd?editors=0011 ⌨️ Heap (max and min) (1:27:29) https://codepen.io/beaucarnes/pen/JNvENQ?editors=0010 🔗 Heap visualization: https://www.cs.usfca.edu/~galles/visualization/Heap.html ⌨️ Graphs: adjacency list, adjacency matrix, incidence matrix (1:42:07) ⌨️ Graphs: breadth-first search (1:46:45) https://codepen.io/beaucarnes/pen/XgrXvw?editors=0012 📄Data structures article by Beau Carnes: https://medium.freecodecamp.org/10-common-data-structures-explained-with-videos-exercises-aaff6c06fb2b 🐦Follow creator Beau Carnes on Twitter: https://twitter.com/carnesbeau 🔗Beau also made this Algorithms course from Manning Publications: https://www.manning.com/livevideo/algorithms-in-motion?a_aid=algmotion&a_bid=9022d293 (Promo code: 39carnes) 🎥And if you like robots and toys, check out Beau's other YouTube channel: https://www.youtube.com/robotfamily -- Learn to code for free and get a developer job: https://www.freecodecamp.org Read hundreds of articles on programming: https://medium.freecodecamp.org

detail
{'title': 'Data Structures and Algorithms in JavaScript - Full Course for Beginners', 'heatmap': [{'end': 341.263, 'start': 265.711, 'weight': 0.899}, {'end': 613.241, 'start': 541.529, 'weight': 0.706}, {'end': 1762.496, 'start': 1553.821, 'weight': 0.829}], 'summary': 'Course on data structures and algorithms in javascript covers common data structures such as stack, set, queue, binary search trees, binary tree traversal, hash tables, linked lists, trie data structure, binary heaps, and graph representations, emphasizing their implementation and operations with examples, providing a comprehensive understanding for beginners.', 'chapters': [{'end': 251.26, 'segs': [{'end': 136.419, 'src': 'embed', 'start': 28.525, 'weight': 0, 'content': [{'end': 33.409, 'text': 'If you make a stack of books, the topmost book in the stack was the one that you put there last.', 'start': 28.525, 'duration': 4.884}, {'end': 39.195, 'text': "If you remove that book from your stack's top, you would expose the book that was put there before the last book.", 'start': 33.85, 'duration': 5.345}, {'end': 42.557, 'text': 'Stacks are of last in, first out type of service.', 'start': 39.875, 'duration': 2.682}, {'end': 47.079, 'text': 'The last book you put on top of a stack would be the first book you take off the stack.', 'start': 43.017, 'duration': 4.062}, {'end': 50.562, 'text': "Another example of a stack is your browser's back button.", 'start': 47.46, 'duration': 3.102}, {'end': 58.927, 'text': "If you look up here, we just opened up Facebook.com, so we add it to the top of the stack of sites that we've already visited previously.", 'start': 51.002, 'duration': 7.925}, {'end': 60.608, 'text': 'We do stack.push.', 'start': 58.947, 'duration': 1.661}, {'end': 62.209, 'text': 'Push is one of the stack methods.', 'start': 61.028, 'duration': 1.181}, {'end': 64.069, 'text': 'You push Facebook on top of the stack.', 'start': 62.229, 'duration': 1.84}, {'end': 68.412, 'text': 'This middle is what it looks like when we are visiting Facebook.', 'start': 64.75, 'duration': 3.662}, {'end': 74.496, 'text': 'And then this bottom image is where we press the back button to navigate back to Twitter.', 'start': 68.893, 'duration': 5.603}, {'end': 79.439, 'text': 'So we pop off the most recent URL and we just leave Twitter at the top of it.', 'start': 74.716, 'duration': 4.723}, {'end': 87.697, 'text': 'The functions traditionally provided in this stack are push for placing data onto a stack top.', 'start': 79.879, 'duration': 7.818}, {'end': 91.1, 'text': 'for removing the top element of a stack.', 'start': 87.697, 'duration': 3.403}, {'end': 100.388, 'text': 'peak for displaying the top element of a stack and length or size for determining how many elements are on a stack.', 'start': 91.1, 'duration': 9.288}, {'end': 109.56, 'text': 'A nice feature of JavaScript is that the array object already has all the functions we need in order to use it as a stack.', 'start': 101.613, 'duration': 7.947}, {'end': 112.142, 'text': 'So you could just use an array as a stack.', 'start': 110.1, 'duration': 2.042}, {'end': 117.767, 'text': 'I will show you how to do this using an array, but then I will actually create a stack class and show you how that works too.', 'start': 112.782, 'duration': 4.985}, {'end': 120.969, 'text': "I'm going to use an array stack to find words that are palindromes.", 'start': 118.127, 'duration': 2.842}, {'end': 127.795, 'text': 'A palindrome is a word that is spelled the same forwards and backwards, such as Bob, B-O-B, or race car, R-A-C-E-C-A-R.', 'start': 121.41, 'duration': 6.385}, {'end': 136.419, 'text': "Okay, so we have our letters equals an empty array, and that's the stack.", 'start': 130.276, 'duration': 6.143}], 'summary': "Stacks follow last in, first out type, exemplified by browser's back button. javascript array object can be used as a stack, and a stack class can also be created.", 'duration': 107.894, 'max_score': 28.525, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U28525.jpg'}, {'end': 260.807, 'src': 'embed', 'start': 230.615, 'weight': 5, 'content': [{'end': 234.956, 'text': 'Now we have a string that should be the reverse of the first word.', 'start': 230.615, 'duration': 4.341}, {'end': 237.617, 'text': 'So word and our word should be reverse of each other.', 'start': 235.176, 'duration': 2.441}, {'end': 246.559, 'text': "Now to check if it's a palindrome, we just say if our word equals equals equals word, it is a palindrome, or else it's not a palindrome.", 'start': 237.997, 'duration': 8.562}, {'end': 248.619, 'text': "So let's run that and see what happens.", 'start': 247.059, 'duration': 1.56}, {'end': 251.26, 'text': 'And race car is a palindrome.', 'start': 249.739, 'duration': 1.521}, {'end': 260.807, 'text': "But if we change that to free code camp and run that, Nope, it's not a palindrome.", 'start': 251.98, 'duration': 8.827}], 'summary': "Demonstration of checking palindromes in a string using code, with 'race car' being a palindrome and 'free code camp' not being a palindrome.", 'duration': 30.192, 'max_score': 230.615, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U230615.jpg'}], 'start': 0.369, 'title': 'Data structures and algorithms in javascript', 'summary': "Discusses common data structures and algorithms in javascript, including the implementation of stack data structure with examples such as a stack of books and browser's back button, emphasizing the last in, first out type of service and the stack methods push and pop. it also explains how to use an array as a stack, creating a stack class, and finding palindromes using the stack, demonstrating with the word 'race car' which is a palindrome.", 'chapters': [{'end': 91.1, 'start': 0.369, 'title': 'Data structures and algorithms in javascript', 'summary': "Discusses common data structures and algorithms in javascript, including the implementation of stack data structure with examples such as a stack of books and browser's back button, emphasizing the last in, first out type of service and the stack methods push and pop.", 'duration': 90.731, 'highlights': ["The stack data structure is illustrated using a stack of books and the browser's back button, highlighting the last in, first out type of service and the stack methods push and pop.", "Explanation of how stacks work: the last book added is the first one removed (Last In, First Out - LIFO), demonstrated with examples of adding and removing websites from a browser's history stack.", 'The functions traditionally provided in this stack are push for placing data onto a stack top and pop for removing the top element of a stack.']}, {'end': 251.26, 'start': 91.1, 'title': 'Using arrays as stacks and creating a stack class', 'summary': "Explains how to use an array as a stack in javascript, creating a stack class, and finding palindromes using the stack, demonstrating with the word 'race car' which is a palindrome.", 'duration': 160.16, 'highlights': ['The chapter explains how to use an array as a stack in JavaScript', 'Creating a stack class and finding palindromes using the stack', "Demonstrating with the word 'race car' which is a palindrome"]}], 'duration': 250.891, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U369.jpg', 'highlights': ["The stack data structure is illustrated using a stack of books and the browser's back button, highlighting the last in, first out type of service and the stack methods push and pop.", "Explanation of how stacks work: the last book added is the first one removed (Last In, First Out - LIFO), demonstrated with examples of adding and removing websites from a browser's history stack.", 'The functions traditionally provided in this stack are push for placing data onto a stack top and pop for removing the top element of a stack.', 'The chapter explains how to use an array as a stack in JavaScript', 'Creating a stack class and finding palindromes using the stack', "Demonstrating with the word 'race car' which is a palindrome"]}, {'end': 1553.601, 'segs': [{'end': 341.263, 'src': 'heatmap', 'start': 265.711, 'weight': 0.899, 'content': [{'end': 271.736, 'text': 'Now I will show you how to implement a stack in JavaScript so you can understand stacks a little more.', 'start': 265.711, 'duration': 6.025}, {'end': 276.12, 'text': 'You probably would never do that, because you can use an array as a stack,', 'start': 272.357, 'duration': 3.763}, {'end': 279.242, 'text': 'but this should possibly help you understand how stacks work a little better.', 'start': 276.12, 'duration': 3.122}, {'end': 284.827, 'text': "So here's where we're going to create the stack, which is going to be this function.", 'start': 280.143, 'duration': 4.684}, {'end': 289.851, 'text': "here we're going to have two variables this dot count and this dot storage.", 'start': 284.827, 'duration': 5.024}, {'end': 292.733, 'text': 'Now this dot storage is an empty object.', 'start': 290.311, 'duration': 2.422}, {'end': 296.496, 'text': 'And count is going to keep track of how many items are in the stack.', 'start': 293.273, 'duration': 3.223}, {'end': 298.957, 'text': 'So here are all the different methods.', 'start': 297.236, 'duration': 1.721}, {'end': 300.539, 'text': 'We have push.', 'start': 299.398, 'duration': 1.141}, {'end': 303.221, 'text': 'This.push is going to add a value to the end of the stack.', 'start': 300.599, 'duration': 2.622}, {'end': 305.102, 'text': "You're going to pass in the value.", 'start': 303.241, 'duration': 1.861}, {'end': 309.065, 'text': 'This.storage, remember storage is the empty object.', 'start': 305.783, 'duration': 3.282}, {'end': 313.268, 'text': 'At the index, this.count, we are going to add the value.', 'start': 309.445, 'duration': 3.823}, {'end': 317.852, 'text': "So we're going to put the value on the top of the stack or the end of the stack.", 'start': 313.308, 'duration': 4.544}, {'end': 322.035, 'text': "And then we're just going to increment count up one.", 'start': 318.312, 'duration': 3.723}, {'end': 324.637, 'text': "So now it's showing that we have another item in the stack.", 'start': 322.275, 'duration': 2.362}, {'end': 330.999, 'text': "The next function, we're going to remove and return the value at the end of the stack or at the top of the stack, which is this.pop.", 'start': 325.257, 'duration': 5.742}, {'end': 332.86, 'text': 'This is going to pop an item off.', 'start': 331.079, 'duration': 1.781}, {'end': 336.121, 'text': 'So if this.count equals equals zero,', 'start': 333.44, 'duration': 2.681}, {'end': 341.263, 'text': "that means there's nothing in the stack and we're going to return undefined because there is nothing in the stack.", 'start': 336.121, 'duration': 5.142}], 'summary': 'Implementing a stack in javascript using a function with push and pop methods to add and remove values from the stack.', 'duration': 75.552, 'max_score': 265.711, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U265711.jpg'}, {'end': 573.102, 'src': 'embed', 'start': 541.529, 'weight': 1, 'content': [{'end': 543.031, 'text': 'Well, those are the basics of stack.', 'start': 541.529, 'duration': 1.502}, {'end': 556.453, 'text': 'the set data structure is kind of like an array, except there are no duplicate items and the values are not in any particular order.', 'start': 547.327, 'duration': 9.126}, {'end': 561.136, 'text': 'the typical use for a set is to simply check for the presence of an item.', 'start': 556.453, 'duration': 4.683}, {'end': 563.598, 'text': "i'm going to show you how to implement a set function.", 'start': 561.136, 'duration': 2.462}, {'end': 565.74, 'text': 'es6 actually has a built-in set object.', 'start': 563.598, 'duration': 2.142}, {'end': 573.102, 'text': 'However, the built-in set objects does not contain all the methods that are common to sets.', 'start': 566.42, 'duration': 6.682}], 'summary': 'Introduction to sets and their implementation with es6 set object.', 'duration': 31.573, 'max_score': 541.529, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U541529.jpg'}, {'end': 651.771, 'src': 'heatmap', 'start': 541.529, 'weight': 8, 'content': [{'end': 543.031, 'text': 'Well, those are the basics of stack.', 'start': 541.529, 'duration': 1.502}, {'end': 556.453, 'text': 'the set data structure is kind of like an array, except there are no duplicate items and the values are not in any particular order.', 'start': 547.327, 'duration': 9.126}, {'end': 561.136, 'text': 'the typical use for a set is to simply check for the presence of an item.', 'start': 556.453, 'duration': 4.683}, {'end': 563.598, 'text': "i'm going to show you how to implement a set function.", 'start': 561.136, 'duration': 2.462}, {'end': 565.74, 'text': 'es6 actually has a built-in set object.', 'start': 563.598, 'duration': 2.142}, {'end': 573.102, 'text': 'However, the built-in set objects does not contain all the methods that are common to sets.', 'start': 566.42, 'duration': 6.682}, {'end': 579.045, 'text': "So you may still have to implement part of the set yourself, depending on what you're going to use it for.", 'start': 573.683, 'duration': 5.362}, {'end': 585.427, 'text': 'When I show you the implementation for the set, I will tell you which methods are part of the ES6 set and which are not.', 'start': 579.405, 'duration': 6.022}, {'end': 589.729, 'text': "So we're just going to go through this code, we're going to call it mySet.", 'start': 586.207, 'duration': 3.522}, {'end': 595.492, 'text': 'Now we could call it set, but I want to make it different than the ES6 set, so this is mySet.', 'start': 589.869, 'duration': 5.623}, {'end': 597.413, 'text': "So here's just the collection.", 'start': 595.712, 'duration': 1.701}, {'end': 602.875, 'text': "the set is going to be a collection of items and we're going to store them in an array, which an array can have duplicate items.", 'start': 597.413, 'duration': 5.462}, {'end': 607.518, 'text': "but we're going to implement this in such a way that you cannot add duplicate items to this array.", 'start': 602.875, 'duration': 4.643}, {'end': 613.241, 'text': 'This method, the method has, is going to check for the presence of an element, and then return true or false.', 'start': 607.898, 'duration': 5.343}, {'end': 620.988, 'text': "So you're going to pass in the element, and it's going to do collection dot index of element is not negative one.", 'start': 613.261, 'duration': 7.727}, {'end': 625.872, 'text': "So if the element is not in the collection, it's going to return negative one.", 'start': 621.328, 'duration': 4.544}, {'end': 629.595, 'text': "So if it doesn't return negative one, it's true.", 'start': 626.272, 'duration': 3.323}, {'end': 632.097, 'text': "So if it's not negative one, it's true.", 'start': 629.675, 'duration': 2.422}, {'end': 636.221, 'text': "That means the element is in the array, else it's false.", 'start': 632.157, 'duration': 4.064}, {'end': 637.742, 'text': 'now we have the values.', 'start': 636.741, 'duration': 1.001}, {'end': 639.943, 'text': 'this is going to return all the values of the set.', 'start': 637.742, 'duration': 2.201}, {'end': 641.865, 'text': 'pretty straightforward just return the collection.', 'start': 639.943, 'duration': 1.922}, {'end': 648.849, 'text': "now add we're going to add an element to this set, but first we have to check if the element is in the set already.", 'start': 641.865, 'duration': 6.984}, {'end': 651.771, 'text': "so we're going to call the the method.", 'start': 648.849, 'duration': 2.922}], 'summary': 'Introduction to implementing a set function with es6 and custom methods for checking, retrieving, and adding elements.', 'duration': 43.873, 'max_score': 541.529, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U541529.jpg'}, {'end': 741.986, 'src': 'embed', 'start': 719.117, 'weight': 7, 'content': [{'end': 727.081, 'text': 'So the ES6 set has values add, remove and size, except remove is delete.', 'start': 719.117, 'duration': 7.964}, {'end': 733.903, 'text': "in the x six set, instead of calling remove, you're going to call delete, but all the other things are included.", 'start': 727.081, 'duration': 6.822}, {'end': 741.986, 'text': 'Oh, another thing is size is not a method in the ES six set size is a property.', 'start': 734.383, 'duration': 7.603}], 'summary': 'Es6 set has add, delete, and size methods; size is a property.', 'duration': 22.869, 'max_score': 719.117, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U719117.jpg'}, {'end': 789.176, 'src': 'embed', 'start': 763.517, 'weight': 2, 'content': [{'end': 768.96, 'text': "The next few methods actually just help you work with sets when you're working with two different sets.", 'start': 763.517, 'duration': 5.443}, {'end': 771.362, 'text': 'So we have union.', 'start': 769.6, 'duration': 1.762}, {'end': 774.344, 'text': 'This method is going to return the union of two sets.', 'start': 771.982, 'duration': 2.362}, {'end': 780.509, 'text': "So it's going to combine the sets but leave out any duplicates in the combination of the sets.", 'start': 774.784, 'duration': 5.725}, {'end': 789.176, 'text': "So we're going to call the union method on the original set and we're going to pass in the other set that we want to combine.", 'start': 780.829, 'duration': 8.347}], 'summary': 'The union method combines two sets, excluding duplicates.', 'duration': 25.659, 'max_score': 763.517, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U763517.jpg'}, {'end': 912.026, 'src': 'embed', 'start': 863.031, 'weight': 3, 'content': [{'end': 867.393, 'text': "The first set, again, we're going to call the this.values to get all the values in the first set.", 'start': 863.031, 'duration': 4.362}, {'end': 870.655, 'text': 'Now, for each value in the first set.', 'start': 868.053, 'duration': 2.602}, {'end': 876.136, 'text': 'We are going to check if the other set has the value.', 'start': 871.955, 'duration': 4.181}, {'end': 878.257, 'text': 'We are going to add it.', 'start': 876.616, 'duration': 1.641}, {'end': 881.097, 'text': "And then we're going to return the intersection set.", 'start': 878.677, 'duration': 2.42}, {'end': 886.079, 'text': 'So the intersection is just all the items that are in both sets.', 'start': 881.497, 'duration': 4.582}, {'end': 888.779, 'text': "And we're going to return that as a new set.", 'start': 886.739, 'duration': 2.04}, {'end': 893.6, 'text': "And this next function, we're also going to have to add the my there.", 'start': 889.179, 'duration': 4.421}, {'end': 895.301, 'text': 'So this is the difference.', 'start': 893.981, 'duration': 1.32}, {'end': 898.462, 'text': 'So the difference between the sets.', 'start': 896.121, 'duration': 2.341}, {'end': 902.843, 'text': 'So all the items that are in one set but not the other set.', 'start': 898.482, 'duration': 4.361}, {'end': 909.546, 'text': "So we're going to create a new set again, the different set, and again we're going to get the values of the first set.", 'start': 903.464, 'duration': 6.082}, {'end': 912.026, 'text': 'Now this is very similar to the intersection.', 'start': 910.126, 'duration': 1.9}], 'summary': 'The functions find intersection and difference between sets from the values.', 'duration': 48.995, 'max_score': 863.031, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U863031.jpg'}, {'end': 963.597, 'src': 'embed', 'start': 935.418, 'weight': 5, 'content': [{'end': 938.64, 'text': "And the last method we're going to talk about is the subset.", 'start': 935.418, 'duration': 3.222}, {'end': 943.684, 'text': 'And this is going to test if the set is a subset of a different set.', 'start': 939.321, 'duration': 4.363}, {'end': 950.749, 'text': "So it's going to test if the first set is completely contained within the second set.", 'start': 944.164, 'duration': 6.585}, {'end': 953.811, 'text': "So it's just going to return true or false.", 'start': 951.349, 'duration': 2.462}, {'end': 956.853, 'text': "So we're going to pass in the other set.", 'start': 954.431, 'duration': 2.422}, {'end': 959.995, 'text': "We're going to, again, get all the values of the first set.", 'start': 957.153, 'duration': 2.842}, {'end': 963.597, 'text': "And we're going to call this function firstSet.every.", 'start': 960.515, 'duration': 3.082}], 'summary': 'The subset method tests if a set is completely contained within another set, returning true or false.', 'duration': 28.179, 'max_score': 935.418, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U935418.jpg'}, {'end': 1225.947, 'src': 'embed', 'start': 1195.282, 'weight': 0, 'content': [{'end': 1199.566, 'text': 'In JavaScript, just like a stack, you can implement a queue with just an array.', 'start': 1195.282, 'duration': 4.284}, {'end': 1203.71, 'text': 'If you want to limit an array to just the traditional queue methods, you must create it yourself.', 'start': 1200.087, 'duration': 3.623}, {'end': 1206.032, 'text': 'Let me show you one such implementation.', 'start': 1204.111, 'duration': 1.921}, {'end': 1208.335, 'text': 'So we have the queue right here.', 'start': 1206.613, 'duration': 1.722}, {'end': 1212.418, 'text': "And we're going to have a collection that's going to collect all the items in the queue.", 'start': 1208.895, 'duration': 3.523}, {'end': 1217.921, 'text': 'And this is just kind of a helper function to print or to console.log the collection.', 'start': 1212.938, 'duration': 4.983}, {'end': 1220.863, 'text': 'And here are the main methods of a queue.', 'start': 1218.582, 'duration': 2.281}, {'end': 1225.947, 'text': 'We have inQueue, which is going to push the first item onto the queue.', 'start': 1221.143, 'duration': 4.804}], 'summary': 'In javascript, a queue can be implemented with an array, and main methods include inqueue for pushing the first item onto the queue.', 'duration': 30.665, 'max_score': 1195.282, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U1195282.jpg'}], 'start': 251.98, 'title': 'Implementing data structures in javascript', 'summary': 'Covers the implementation of stack, set, and queue data structures in javascript, including their methods and usage, comparing to es6 set implementation, and demonstrating set operations for union, intersection, difference, and subset. it also highlights insights into their use cases and differences.', 'chapters': [{'end': 540.168, 'start': 251.98, 'title': 'Implementing a stack in javascript', 'summary': 'Explains how to implement a stack in javascript, including the methods push, pop, size, and peak, and demonstrates the usage with specific examples.', 'duration': 288.188, 'highlights': ['The chapter explains how to implement a stack in JavaScript', 'Includes methods like push, pop, size, and peak', 'Demonstrates usage with specific examples']}, {'end': 762.916, 'start': 541.529, 'title': 'Implementing set data structure in javascript', 'summary': 'Explains how to implement a set data structure in javascript, covering the methods for checking presence, adding, removing elements, and returning values, with a comparison to the es6 set implementation and highlighting the differences.', 'duration': 221.387, 'highlights': ['The chapter explains how to implement a set data structure in JavaScript, covering the methods for checking presence, adding, removing elements, and returning values, with a comparison to the ES6 set implementation and highlighting the differences.', 'The ES6 set has values add, remove, and size, except remove is delete. Size is a property in the ES6 set, not a method.', 'The method has is used to check for the presence of an element in the set by returning true or false based on the presence of the element.', 'The add method checks if the element is already in the set before adding it and returns true if the element is successfully added, otherwise false.', 'The remove method removes an element from the set and returns true if the element is successfully removed, otherwise false.']}, {'end': 982.572, 'start': 763.517, 'title': 'Set operations in javascript', 'summary': 'Explains the union, intersection, difference, and subset methods for sets in javascript, demonstrating how to combine sets, find common elements, identify differences, and test for subsets, providing insights into their implementation and use cases.', 'duration': 219.055, 'highlights': ['The union method combines two sets, leaving out any duplicates, and returns a new set containing the combined unique items.', 'The intersection method creates a new set containing only the items that are present in both sets, effectively finding the common elements between the two sets.', 'The difference method generates a new set containing items that are present in the first set but not in the second set, offering a way to identify the unique items in each set.', 'The subset method tests if the first set is completely contained within the second set, returning true or false based on the comparison.']}, {'end': 1152.137, 'start': 983.092, 'title': 'Set data structure and methods', 'summary': 'Introduces the set data structure and its methods, demonstrating its use in determining subset relationships and set operations, and highlights the differences between es6 set implementation and the built-in set.', 'duration': 169.045, 'highlights': ['The set data structure is introduced and its use in determining subset relationships is demonstrated.', 'The chapter demonstrates the use of set operations and the values function to identify common elements between sets.', 'The differences between ES6 set implementation and the built-in set are highlighted, including the return type of the values method and the behavior of add and delete methods.']}, {'end': 1553.601, 'start': 1152.677, 'title': 'Queue data structure in javascript', 'summary': 'Explains the queue data structure in javascript, including its implementation using arrays for enqueue, dequeue, front, size, and isempty methods, as well as a priority queue with examples and the inqueue function logic.', 'duration': 400.924, 'highlights': ['The chapter explains the queue data structure in JavaScript, including its implementation using arrays for enqueue, dequeue, front, size, and isEmpty methods, as well as a priority queue with examples and the inQueue function logic.', 'A queue is similar to a stack, with first in, first out (FIFO) behavior, and real-life examples are provided for better understanding.', 'The implementation of a queue using an array is demonstrated, showing methods for inQueue and DQ, along with insights into item addition and removal processes.']}], 'duration': 1301.621, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U251980.jpg', 'highlights': ['The chapter explains how to implement a queue in JavaScript, including its methods and usage, with real-life examples and insights into item addition and removal processes.', 'The chapter explains how to implement a set data structure in JavaScript, covering the methods for checking presence, adding, removing elements, and returning values, with a comparison to the ES6 set implementation and highlighting the differences.', 'The union method combines two sets, leaving out any duplicates, and returns a new set containing the combined unique items.', 'The intersection method creates a new set containing only the items that are present in both sets, effectively finding the common elements between the two sets.', 'The difference method generates a new set containing items that are present in the first set but not in the second set, offering a way to identify the unique items in each set.', 'The subset method tests if the first set is completely contained within the second set, returning true or false based on the comparison.', 'The chapter explains how to implement a stack in JavaScript, including its methods and usage with specific examples.', 'The ES6 set has values add, remove, and size, except remove is delete. Size is a property in the ES6 set, not a method.', 'The method has is used to check for the presence of an element in the set by returning true or false based on the presence of the element.', 'The add method checks if the element is already in the set before adding it and returns true if the element is successfully added, otherwise false.']}, {'end': 2294.839, 'segs': [{'end': 1762.496, 'src': 'heatmap', 'start': 1553.821, 'weight': 0.829, 'content': [{'end': 1559.91, 'text': "That's just index zero of this value, which is the item that we got off the beginning of the array.", 'start': 1553.821, 'duration': 6.089}, {'end': 1562.334, 'text': 'Well, those are queues and priority queues.', 'start': 1560.131, 'duration': 2.203}, {'end': 1572.194, 'text': 'A tree data structure is a way to hold data that when visualized looks like a tree you would see in nature.', 'start': 1566.408, 'duration': 5.786}, {'end': 1576.419, 'text': 'Now this is actually what we visualize a tree data structure to look like.', 'start': 1572.795, 'duration': 3.624}, {'end': 1580.143, 'text': 'All data points in the tree are called nodes.', 'start': 1577.16, 'duration': 2.983}, {'end': 1586.109, 'text': 'The top of the tree is called the root node and from here it branches out into additional nodes.', 'start': 1580.664, 'duration': 5.445}, {'end': 1589.631, 'text': 'each of which may have more child nodes, and so on.', 'start': 1586.73, 'duration': 2.901}, {'end': 1597.774, 'text': 'Nodes with branches leading to other nodes are referred to as the parent of the node of the branches that leads to the child.', 'start': 1590.171, 'duration': 7.603}, {'end': 1601.656, 'text': 'Leaf nodes are nodes at the end of the tree that have no children.', 'start': 1598.114, 'duration': 3.542}, {'end': 1605.337, 'text': 'Also, any children of a node are parents of their own subtree.', 'start': 1602.096, 'duration': 3.241}, {'end': 1610.139, 'text': 'In this video, we will be covering a specific type of tree called a binary search tree.', 'start': 1605.817, 'duration': 4.322}, {'end': 1617.264, 'text': "While the tree data structure can have any number of branches at a single node, for instance, see the C here? There's FGH.", 'start': 1610.819, 'duration': 6.445}, {'end': 1619.066, 'text': 'It has three branches at a single node.', 'start': 1617.304, 'duration': 1.762}, {'end': 1622.989, 'text': 'A binary tree, however, can only have two branches for every node.', 'start': 1619.486, 'duration': 3.503}, {'end': 1625.551, 'text': "If we look down here, here's a binary tree.", 'start': 1623.009, 'duration': 2.542}, {'end': 1627.672, 'text': 'Each node only has two branches.', 'start': 1625.891, 'duration': 1.781}, {'end': 1630.675, 'text': 'Also, binary search trees are ordered.', 'start': 1628.153, 'duration': 2.522}, {'end': 1637.921, 'text': 'Each subtree is less than or equal to the parent node, and each right subtree is greater than or equal to the parent node.', 'start': 1631.155, 'duration': 6.766}, {'end': 1645.847, 'text': 'because they use the principle of binary search, on average operations are able to skip about half of the tree, so that each lookup,', 'start': 1638.641, 'duration': 7.206}, {'end': 1651.971, 'text': 'insertion or deletion takes time proportional to the logarithm of the number of items stored in the tree.', 'start': 1645.847, 'duration': 6.124}, {'end': 1656.875, 'text': 'this is much better than the linear time required to find items by key in an unsorted array,', 'start': 1651.971, 'duration': 4.904}, {'end': 1661.078, 'text': 'but slower than the corresponding operations on a hash table.', 'start': 1656.875, 'duration': 4.203}, {'end': 1663.24, 'text': "so let's see how this works in javascript.", 'start': 1661.078, 'duration': 2.162}, {'end': 1666.661, 'text': "Here we're going to use classes to create the binary search tree.", 'start': 1663.7, 'duration': 2.961}, {'end': 1672.543, 'text': "Basically, we're going to create two classes, the node class and the BST or binary search tree class.", 'start': 1667.241, 'duration': 5.302}, {'end': 1675.385, 'text': 'The node class represents each node in the tree.', 'start': 1673.204, 'duration': 2.181}, {'end': 1677.185, 'text': "And there's going to be three data properties.", 'start': 1675.405, 'duration': 1.78}, {'end': 1679.626, 'text': "We have the data, which is what we're actually trying to store.", 'start': 1677.385, 'duration': 2.241}, {'end': 1686.389, 'text': 'And we have this dot left and this dot right, which are going to point to the left node and the right node.', 'start': 1679.926, 'duration': 6.463}, {'end': 1694.534, 'text': "So, in the binary search tree we're going to have the constructor which just creates the root node, which is the top of the tree,", 'start': 1686.909, 'duration': 7.625}, {'end': 1695.655, 'text': 'which starts as null.', 'start': 1694.534, 'duration': 1.121}, {'end': 1698.596, 'text': "And then we're going to have the add function.", 'start': 1696.035, 'duration': 2.561}, {'end': 1701.778, 'text': 'So this is how we are going to add something to the tree.', 'start': 1698.777, 'duration': 3.001}, {'end': 1703.82, 'text': "So we're going to add the data.", 'start': 1702.759, 'duration': 1.061}, {'end': 1706.263, 'text': "We're going to get a reference to the root node.", 'start': 1704.021, 'duration': 2.242}, {'end': 1709.867, 'text': 'But if this is the first node, node will be null.', 'start': 1706.583, 'duration': 3.284}, {'end': 1716.074, 'text': "In that case, we're just going to set the root node to the new data we just put in.", 'start': 1710.207, 'duration': 5.867}, {'end': 1718.496, 'text': 'So new node data.', 'start': 1716.314, 'duration': 2.182}, {'end': 1721.219, 'text': "So we're just going to create a node based on that data.", 'start': 1718.777, 'duration': 2.442}, {'end': 1727.446, 'text': "If it's not the first node, we're going to have to figure out where to put this node in the tree.", 'start': 1721.98, 'duration': 5.466}, {'end': 1733.172, 'text': 'to figure out where to place the new node, we are going to use a recursive function.', 'start': 1727.446, 'duration': 5.726}, {'end': 1736.575, 'text': "So we're going to create this function, which is search tree.", 'start': 1733.192, 'duration': 3.383}, {'end': 1743.823, 'text': "we're going to pass in the node which starts off as the root node if the data we pass in is less than no data.", 'start': 1736.575, 'duration': 7.248}, {'end': 1748.106, 'text': "That means we're going to put the node on the left side of the tree.", 'start': 1744.924, 'duration': 3.182}, {'end': 1756.011, 'text': "So if the node.left side of the tree is null, we're just going to assign node.left to the new node, and then we'll return.", 'start': 1748.506, 'duration': 7.505}, {'end': 1762.496, 'text': "But if node.left is not null, we're going to return search tree node.left.", 'start': 1756.412, 'duration': 6.084}], 'summary': 'Binary search trees use binary search, with operations taking time proportional to the logarithm of the number of items stored.', 'duration': 208.675, 'max_score': 1553.821, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U1553821.jpg'}, {'end': 1651.971, 'src': 'embed', 'start': 1623.009, 'weight': 0, 'content': [{'end': 1625.551, 'text': "If we look down here, here's a binary tree.", 'start': 1623.009, 'duration': 2.542}, {'end': 1627.672, 'text': 'Each node only has two branches.', 'start': 1625.891, 'duration': 1.781}, {'end': 1630.675, 'text': 'Also, binary search trees are ordered.', 'start': 1628.153, 'duration': 2.522}, {'end': 1637.921, 'text': 'Each subtree is less than or equal to the parent node, and each right subtree is greater than or equal to the parent node.', 'start': 1631.155, 'duration': 6.766}, {'end': 1645.847, 'text': 'because they use the principle of binary search, on average operations are able to skip about half of the tree, so that each lookup,', 'start': 1638.641, 'duration': 7.206}, {'end': 1651.971, 'text': 'insertion or deletion takes time proportional to the logarithm of the number of items stored in the tree.', 'start': 1645.847, 'duration': 6.124}], 'summary': 'Binary search trees are ordered, allowing efficient operations with time proportional to the logarithm of the items stored.', 'duration': 28.962, 'max_score': 1623.009, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U1623009.jpg'}, {'end': 1694.534, 'src': 'embed', 'start': 1667.241, 'weight': 2, 'content': [{'end': 1672.543, 'text': "Basically, we're going to create two classes, the node class and the BST or binary search tree class.", 'start': 1667.241, 'duration': 5.302}, {'end': 1675.385, 'text': 'The node class represents each node in the tree.', 'start': 1673.204, 'duration': 2.181}, {'end': 1677.185, 'text': "And there's going to be three data properties.", 'start': 1675.405, 'duration': 1.78}, {'end': 1679.626, 'text': "We have the data, which is what we're actually trying to store.", 'start': 1677.385, 'duration': 2.241}, {'end': 1686.389, 'text': 'And we have this dot left and this dot right, which are going to point to the left node and the right node.', 'start': 1679.926, 'duration': 6.463}, {'end': 1694.534, 'text': "So, in the binary search tree we're going to have the constructor which just creates the root node, which is the top of the tree,", 'start': 1686.909, 'duration': 7.625}], 'summary': 'Creating two classes: node and bst, with 3 data properties for each node.', 'duration': 27.293, 'max_score': 1667.241, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U1667241.jpg'}, {'end': 1932.158, 'src': 'embed', 'start': 1906.706, 'weight': 3, 'content': [{'end': 1912.269, 'text': 'If you look at this binary search tree right here, you can see the minimum is all the way on the left side, 9.', 'start': 1906.706, 'duration': 5.563}, {'end': 1914.611, 'text': 'The max is all the way on the right side, 76.', 'start': 1912.269, 'duration': 2.342}, {'end': 1918.073, 'text': 'So just using that knowledge makes it easy to findMin and findMax.', 'start': 1914.611, 'duration': 3.462}, {'end': 1921.268, 'text': "So I'm going to set the current node to the root node.", 'start': 1918.666, 'duration': 2.602}, {'end': 1923.05, 'text': 'And so the min is going to be all the way on the left.', 'start': 1921.589, 'duration': 1.461}, {'end': 1929.135, 'text': 'So while this dot left does not equal null, the current node is going to be current dot left.', 'start': 1923.45, 'duration': 5.685}, {'end': 1932.158, 'text': "And then at the very end, it's going to return current dot data.", 'start': 1929.395, 'duration': 2.763}], 'summary': 'Binary search tree: min=9, max=76. easy to findmin and findmax.', 'duration': 25.452, 'max_score': 1906.706, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U1906706.jpg'}, {'end': 2202.181, 'src': 'embed', 'start': 2171.209, 'weight': 4, 'content': [{'end': 2177.416, 'text': 'the way to remove this node right here would be to replace it with this node down here.', 'start': 2171.209, 'duration': 6.207}, {'end': 2184.823, 'text': 'So if we remove three, we can replace it with four, and then everything will be right with the binary search tree.', 'start': 2177.836, 'duration': 6.987}, {'end': 2190.389, 'text': 'So if you look at what it would become over here, we just replace the four down here with the three up there.', 'start': 2184.843, 'duration': 5.546}, {'end': 2192.511, 'text': 'But how are we going to get down to that?', 'start': 2190.73, 'duration': 1.781}, {'end': 2202.181, 'text': "four?. Well, first we have to go to the right subnode and then we have to go all the way down to the most left subnode after we've gone to the right subnode.", 'start': 2192.511, 'duration': 9.67}], 'summary': 'To remove node three, replace it with four in the binary search tree, navigating right subnode and then all the way down to the most left subnode.', 'duration': 30.972, 'max_score': 2171.209, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U2171209.jpg'}], 'start': 1553.821, 'title': 'Binary search trees and implementation', 'summary': 'Covers binary search trees, a tree data structure with nodes having two branches, and their ordered nature allows for operations to skip about half the tree, resulting in time proportional to the logarithm of the number of items stored. it also covers the implementation of a binary search tree, including creating classes for nodes and the tree, adding nodes, finding the minimum and maximum values, checking for the presence of a value, and removing nodes recursively.', 'chapters': [{'end': 1666.661, 'start': 1553.821, 'title': 'Binary search trees', 'summary': 'Covers binary search trees, a tree data structure with nodes having two branches, and their ordered nature allows for operations to skip about half the tree, resulting in time proportional to the logarithm of the number of items stored.', 'duration': 112.84, 'highlights': ['Binary search trees have two branches for every node, making them ordered and allowing operations to skip about half of the tree, resulting in time proportional to the logarithm of the number of items stored.', 'A binary search tree is much more efficient than finding items by key in an unsorted array and slower than the corresponding operations on a hash table.', "A binary search tree's ordered nature ensures that each subtree is less than or equal to the parent node, and each right subtree is greater than or equal to the parent node."]}, {'end': 2294.839, 'start': 1667.241, 'title': 'Binary search tree implementation', 'summary': 'Covers the implementation of a binary search tree, including creating classes for nodes and the tree, adding nodes, finding the minimum and maximum values, checking for the presence of a value, and removing nodes recursively.', 'duration': 627.598, 'highlights': ['The chapter covers the implementation of a binary search tree, which involves creating classes for nodes and the tree, and adding nodes to the tree using a recursive function.', 'Finding the minimum and maximum values in the tree is achieved by traversing to the leftmost and rightmost nodes, respectively, and returning their data.', "The process for checking the presence of a specific value in the tree involves traversing the tree by comparing the value with the current node's data, and returning true if the value is found and false if it's not.", 'The removal function for a binary search tree involves a recursive process that handles scenarios where nodes have no children, one child, or two children, ensuring the integrity of the tree structure.', 'The recursive removal process includes finding the appropriate replacement node when removing a node with two children, ensuring the resulting tree maintains the binary search tree properties.']}], 'duration': 741.018, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U1553821.jpg', 'highlights': ['Binary search trees have two branches for every node, resulting in time proportional to the logarithm of the number of items stored.', "A binary search tree's ordered nature ensures each subtree is less than or equal to the parent node, and each right subtree is greater than or equal to the parent node.", 'The chapter covers the implementation of a binary search tree, including creating classes for nodes and the tree, adding nodes, finding the minimum and maximum values, checking for the presence of a value, and removing nodes recursively.', 'Finding the minimum and maximum values in the tree is achieved by traversing to the leftmost and rightmost nodes, respectively, and returning their data.', 'The removal function for a binary search tree involves a recursive process that handles scenarios where nodes have no children, one child, or two children, ensuring the integrity of the tree structure.']}, {'end': 2884.834, 'segs': [{'end': 2404.945, 'src': 'embed', 'start': 2295.28, 'weight': 1, 'content': [{'end': 2302.045, 'text': "We'll do node.write and then call this recursive function again, and node.write data, and we're going to return the node.", 'start': 2295.28, 'duration': 6.765}, {'end': 2308.83, 'text': "So you can see that delete is the most complicated one that we've covered, especially when one node has two leafs.", 'start': 2302.385, 'duration': 6.445}, {'end': 2313.673, 'text': "so let's look at how you use a binary search tree, at least this one that i've created so far.", 'start': 2309.27, 'duration': 4.403}, {'end': 2315.414, 'text': "so let's open up the console here.", 'start': 2313.673, 'duration': 1.741}, {'end': 2316.935, 'text': "i'm going to do const.", 'start': 2315.414, 'duration': 1.521}, {'end': 2318.596, 'text': 'bst equals new bst.', 'start': 2316.935, 'duration': 1.661}, {'end': 2320.537, 'text': "i've created my binary search tree.", 'start': 2318.596, 'duration': 1.941}, {'end': 2327.102, 'text': "we're going to add 4, add 2, 6, 1, 3, 5, 7, and then i'm going to remove 4 and then we're going to.", 'start': 2320.537, 'duration': 6.565}, {'end': 2332.765, 'text': "we're going to console.log the min and the max two times and then we're going to check to see if four is present.", 'start': 2327.102, 'duration': 5.663}, {'end': 2338.889, 'text': "another thing we're going to do is we're i'm going to add in a, remove Seven and we'll run that again.", 'start': 2332.765, 'duration': 6.124}, {'end': 2340.571, 'text': 'You can see it first.', 'start': 2338.909, 'duration': 1.662}, {'end': 2342.012, 'text': "It's the minimum is one.", 'start': 2340.831, 'duration': 1.181}, {'end': 2350.218, 'text': "It's going to console dot log max, which is seven, but then we remove seven and now the max is going to be six and We're going to see.", 'start': 2342.012, 'duration': 8.206}, {'end': 2351.919, 'text': 'is this present?', 'start': 2350.218, 'duration': 1.701}, {'end': 2355.322, 'text': "is for present false note, for is not present because we've removed it.", 'start': 2351.919, 'duration': 3.403}, {'end': 2359.064, 'text': 'and This video covered all the key methods common to a binary search tree.', 'start': 2355.322, 'duration': 3.742}, {'end': 2366.468, 'text': "However, in a future video I'll be going over a few other things you can do, such as finding the tree height and traversing the tree through in-order,", 'start': 2359.324, 'duration': 7.144}, {'end': 2368.489, 'text': 'pre-order and post-order traversal.', 'start': 2366.468, 'duration': 2.021}, {'end': 2373.432, 'text': 'If you want to play around with this code, you can check the link to the code in the description.', 'start': 2368.789, 'duration': 4.643}, {'end': 2381.436, 'text': "I'm going to talk about finding the tree height and tree traversal.", 'start': 2377.535, 'duration': 3.901}, {'end': 2386.798, 'text': 'height in a tree represents the distance from the root node to any given leaf node.', 'start': 2382.237, 'duration': 4.561}, {'end': 2391.159, 'text': "So if you look at this example over here, the root node is nine, that's height zero.", 'start': 2387.198, 'duration': 3.961}, {'end': 2394.08, 'text': "But if you see four and 17, here, that's height 136 and 22.", 'start': 2391.52, 'duration': 2.56}, {'end': 2396.661, 'text': 'height two, five, seven and 20 are height three.', 'start': 2394.08, 'duration': 2.581}, {'end': 2404.945, 'text': "So it's the distance from the root node to the leaf nodes.", 'start': 2402.023, 'duration': 2.922}], 'summary': 'Covered delete method in binary search tree, demonstrated with code. upcoming video to include tree height and traversal methods.', 'duration': 109.665, 'max_score': 2295.28, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U2295280.jpg'}, {'end': 2459.966, 'src': 'embed', 'start': 2422.54, 'weight': 0, 'content': [{'end': 2427.764, 'text': "So before I show you the code to implement those things, I'm going to show you the use of the code.", 'start': 2422.54, 'duration': 5.224}, {'end': 2429.725, 'text': "We're going to go all the way down to the bottom.", 'start': 2428.064, 'duration': 1.661}, {'end': 2439.952, 'text': 'where we create a new binary search tree, and then we add all these values, which those values there are the same values as in the picture over here.', 'start': 2430.986, 'duration': 8.966}, {'end': 2444.455, 'text': "We're going to find the min height, we're going to find the max height, and we're going to check if it's balanced.", 'start': 2439.972, 'duration': 4.483}, {'end': 2446.056, 'text': "Let's just comment out these now.", 'start': 2444.816, 'duration': 1.24}, {'end': 2451.38, 'text': "So it's showing the min height is one in the console, the max height is three, and it's not balanced.", 'start': 2446.477, 'duration': 4.903}, {'end': 2459.966, 'text': 'The min height is the distance from the root node to the first leaf node without two children.', 'start': 2451.68, 'duration': 8.286}], 'summary': 'Demonstrated code to create binary search tree, adding values, finding min and max height, and checking if balanced with min height as 1, max height as 3, and unbalanced result.', 'duration': 37.426, 'max_score': 2422.54, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U2422540.jpg'}], 'start': 2295.28, 'title': 'Binary search tree operations and tree height & traversal', 'summary': 'Covers implementation of common operations on a binary search tree, including adding, removing, finding min/max values, and checking for specific nodes, alongside demonstrating tree traversal methods and the importance of balanced trees for efficient searching.', 'chapters': [{'end': 2359.064, 'start': 2295.28, 'title': 'Binary search tree operations', 'summary': 'Covers the implementation of common operations on a binary search tree, including adding, removing, finding min/max values, and checking for the presence of a specific node, with a demonstration of the operations using specific data. it also highlights the complexity of the delete operation, especially when dealing with nodes having two leafs.', 'duration': 63.784, 'highlights': ['The chapter covers the implementation of common operations on a binary search tree, including adding, removing, finding min/max values, and checking for the presence of a specific node, with a demonstration of the operations using specific data. It also highlights the complexity of the delete operation, especially when dealing with nodes having two leafs.', 'The minimum value in the binary search tree is one, the maximum value is seven, and after removing seven, the new maximum value becomes six, demonstrating the dynamic nature of the tree as elements are added or removed.', 'The demonstration includes adding 4, 2, 6, 1, 3, 5, 7 to the binary search tree, removing the value 4, and checking for the presence of the value 4 to illustrate the functionality of the tree operations.', 'The complexity of the delete operation is emphasized, particularly when one node has two leafs, showcasing the challenges and intricacies involved in removing nodes from a binary search tree.']}, {'end': 2884.834, 'start': 2359.324, 'title': 'Tree height & traversal in binary search tree', 'summary': 'Discusses finding the height of a tree, demonstrating tree traversal methods (in-order, pre-order, post-order, and level order), and checking for balance in a binary search tree, with an emphasis on the importance of balanced trees for efficient searching.', 'duration': 525.51, 'highlights': ["The tree's height represents the distance from the root to any given leaf node, with specific examples provided.", 'Demonstrating the determination of the minimum and maximum height, as well as the balance of the tree, with clear examples and code.', 'Explanation and code demonstration for tree traversal methods, including in-order, pre-order, post-order, and level order traversal.']}], 'duration': 589.554, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U2295280.jpg', 'highlights': ['The chapter covers common operations on a binary search tree, including adding, removing, finding min/max values, and checking for specific nodes.', 'The demonstration includes adding 4, 2, 6, 1, 3, 5, 7 to the binary search tree, removing the value 4, and checking for the presence of the value 4.', 'The complexity of the delete operation is emphasized, particularly when one node has two leafs, showcasing the challenges and intricacies involved in removing nodes from a binary search tree.', 'The minimum value in the binary search tree is one, the maximum value is seven, and after removing seven, the new maximum value becomes six, demonstrating the dynamic nature of the tree as elements are added or removed.', 'Demonstrating the determination of the minimum and maximum height, as well as the balance of the tree, with clear examples and code.', 'Explanation and code demonstration for tree traversal methods, including in-order, pre-order, post-order, and level order traversal.', "The tree's height represents the distance from the root to any given leaf node, with specific examples provided."]}, {'end': 3749.54, 'segs': [{'end': 2914.695, 'src': 'embed', 'start': 2886.437, 'weight': 1, 'content': [{'end': 2890.159, 'text': "the in order pre order and post order, there's a lot of similarities to the code.", 'start': 2886.437, 'duration': 3.722}, {'end': 2892.561, 'text': "So let's look at the in order traversal.", 'start': 2890.56, 'duration': 2.001}, {'end': 2901.586, 'text': "First, the only thing that's going to be different and each of these in order pre order and post order are these three lines.", 'start': 2892.641, 'duration': 8.945}, {'end': 2905.669, 'text': "And the only thing that's going to be different in those three lines is the order of the lines.", 'start': 2901.987, 'duration': 3.682}, {'end': 2910.272, 'text': "So for all of them, we're going to check if the route is null and return null.", 'start': 2906.229, 'duration': 4.043}, {'end': 2914.695, 'text': "That's just to check if there's even a binary search tree that exists or if there's any values in it.", 'start': 2910.572, 'duration': 4.123}], 'summary': 'Comparing in order, pre order, and post order traversal with similarities and differences in code structure.', 'duration': 28.258, 'max_score': 2886.437, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U2886437.jpg'}, {'end': 3080.397, 'src': 'embed', 'start': 3051.279, 'weight': 2, 'content': [{'end': 3054.181, 'text': "I'm going to go down to the level order function.", 'start': 3051.279, 'duration': 2.902}, {'end': 3058.143, 'text': 'In this method, we start by adding the root node to a queue.', 'start': 3054.841, 'duration': 3.302}, {'end': 3066.489, 'text': 'Then we begin a loop where we dequeue the first item in the queue, add it to a new array, and then inspect both its child subtrees.', 'start': 3058.564, 'duration': 7.925}, {'end': 3070.411, 'text': 'If its children are not null, they are each enqueued.', 'start': 3067.209, 'duration': 3.202}, {'end': 3073.193, 'text': 'This process continues until the queue is empty.', 'start': 3070.791, 'duration': 2.402}, {'end': 3077.376, 'text': 'We are creating a result array that we are eventually going to return.', 'start': 3073.553, 'duration': 3.823}, {'end': 3080.397, 'text': "Now here's just the queue array.", 'start': 3077.876, 'duration': 2.521}], 'summary': 'Describes a level order function using a queue to process nodes and their child subtrees.', 'duration': 29.118, 'max_score': 3051.279, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3051279.jpg'}, {'end': 3256.912, 'src': 'embed', 'start': 3209.343, 'weight': 0, 'content': [{'end': 3213.846, 'text': 'Hash tables are a common way to implement the map data structure or objects.', 'start': 3209.343, 'duration': 4.503}, {'end': 3217.109, 'text': 'They are widely used because of how efficient they are.', 'start': 3214.527, 'duration': 2.582}, {'end': 3222.452, 'text': 'The average time for each lookup is not tied to the number of elements stored in the table.', 'start': 3217.689, 'duration': 4.763}, {'end': 3230.818, 'text': 'In fact, the average time complexity of hash tables in big notation is O of 1 for search, insert, and delete.', 'start': 3222.912, 'duration': 7.906}, {'end': 3232.319, 'text': "That's very fast.", 'start': 3231.378, 'duration': 0.941}, {'end': 3238.962, 'text': 'The way a hash table works is that it takes a key input, and then runs it through a hash function.', 'start': 3233.119, 'duration': 5.843}, {'end': 3243.045, 'text': 'A hash function basically just maps strings to numbers.', 'start': 3239.603, 'duration': 3.442}, {'end': 3247.047, 'text': 'And usually the numbers just correspond to indexes in an array.', 'start': 3243.565, 'duration': 3.482}, {'end': 3256.912, 'text': 'So, for example, here are the strings we pass through the hash function and then we get the numbers over here. a hash function needs to be consistent.', 'start': 3247.627, 'duration': 9.285}], 'summary': 'Hash tables provide efficient o(1) time complexity for search, insert, and delete operations using a hash function to map keys to indexes in an array.', 'duration': 47.569, 'max_score': 3209.343, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3209343.jpg'}, {'end': 3308.326, 'src': 'embed', 'start': 3282.468, 'weight': 3, 'content': [{'end': 3287.492, 'text': 'So this is a collision because both of these names, once they run through the hash function,', 'start': 3282.468, 'duration': 5.024}, {'end': 3291.915, 'text': 'get turned into the same number or the same index for the array.', 'start': 3287.492, 'duration': 4.423}, {'end': 3298.119, 'text': 'One way to handle collisions is just to store both key value pairs at that index.', 'start': 3292.595, 'duration': 5.524}, {'end': 3304.503, 'text': 'then, upon lookup of either, you would have to iterate through the bucket of items to find the key you are looking for.', 'start': 3298.119, 'duration': 6.384}, {'end': 3308.326, 'text': 'This could take a little extra time because of the iteration.', 'start': 3304.983, 'duration': 3.343}], 'summary': 'Hash collision occurs when different keys produce the same index, leading to potential iteration for lookup.', 'duration': 25.858, 'max_score': 3282.468, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3282468.jpg'}, {'end': 3374.972, 'src': 'embed', 'start': 3349.504, 'weight': 5, 'content': [{'end': 3355.866, 'text': 'Once you want to get the number again, you would just pass in the key, John Smith, into the hash function.', 'start': 3349.504, 'duration': 6.362}, {'end': 3363.448, 'text': 'It would give you the exact same array, index 2, and then you would get the information returned to you, Which is the phone number now?', 'start': 3355.866, 'duration': 7.582}, {'end': 3372.471, 'text': "You'll probably never have to implement hash tables yourself, because most languages, including JavaScript, already have them built in in JavaScript.", 'start': 3363.488, 'duration': 8.983}, {'end': 3374.972, 'text': 'hash tables are usually used to implement objects.', 'start': 3372.471, 'duration': 2.501}], 'summary': 'Hash tables store data efficiently, usually used to implement objects in javascript.', 'duration': 25.468, 'max_score': 3349.504, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3349504.jpg'}], 'start': 2886.437, 'title': 'Binary tree traversal methods and hash tables', 'summary': 'Covers binary tree traversal methods including in order, pre order, and post order, and level order traversal using a queue, and it also discusses hash tables, their implementation in javascript, and their average time complexity of o(1) for search, insert, and delete operations, along with collision handling through a hash function and iteration.', 'chapters': [{'end': 3183.786, 'start': 2886.437, 'title': 'Binary tree traversal methods', 'summary': "Explains the in order, pre order, and post order tree traversal methods, emphasizing the similarities and differences, and provides a detailed explanation of the level order traversal method, demonstrating how it operates using a queue, resulting in a clear understanding of each method's functionality and implementation.", 'duration': 297.349, 'highlights': ['The chapter explains the in order, pre order, and post order tree traversal methods, emphasizing the similarities and differences.', 'Provides a detailed explanation of the level order traversal method, demonstrating how it operates using a queue.']}, {'end': 3749.54, 'start': 3183.786, 'title': 'Hash tables and their implementation', 'summary': 'Explains the concept of hash tables, including their usage, efficiency, and implementation in javascript, highlighting their average time complexity of o(1) for search, insert, and delete operations and the handling of collisions through a hash function and iteration, and provides a demonstration of a basic hash function and hash table implementation in javascript.', 'duration': 565.754, 'highlights': ['Hash tables have an average time complexity of O(1) for search, insert, and delete operations.', 'Collision occurs when two different keys get hashed to the same number, requiring the handling of collisions by storing both key value pairs at the same index and iterating through the bucket of items upon lookup.', 'A hash function is used to map keys to numerical indexes in an array, and it needs to be consistent and map different words to different numbers.', 'The hash table implementation in JavaScript includes methods for adding, removing, and looking up key-value pairs, demonstrating the practical application of hash tables.', 'The provided code demonstrates a basic hash function that maps strings to numerical indexes in an array using a simple addition and modulus operation.']}], 'duration': 863.103, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U2886437.jpg', 'highlights': ['Hash tables have an average time complexity of O(1) for search, insert, and delete operations.', 'The chapter explains the in order, pre order, and post order tree traversal methods, emphasizing the similarities and differences.', 'Provides a detailed explanation of the level order traversal method, demonstrating how it operates using a queue.', 'Collision occurs when two different keys get hashed to the same number, requiring the handling of collisions by storing both key value pairs at the same index and iterating through the bucket of items upon lookup.', 'A hash function is used to map keys to numerical indexes in an array, and it needs to be consistent and map different words to different numbers.', 'The hash table implementation in JavaScript includes methods for adding, removing, and looking up key-value pairs, demonstrating the practical application of hash tables.', 'The provided code demonstrates a basic hash function that maps strings to numerical indexes in an array using a simple addition and modulus operation.']}, {'end': 4498.779, 'segs': [{'end': 3881.737, 'src': 'embed', 'start': 3843.843, 'weight': 0, 'content': [{'end': 3851.866, 'text': 'A benefit to arrays are the random access, which means you can say you want something at index 5 and you can instantly get the thing at index 5.', 'start': 3843.843, 'duration': 8.023}, {'end': 3859.369, 'text': 'However, with linked lists, if you want something at index 5, you have to go through every element in the linked list to get to index 5.', 'start': 3851.866, 'duration': 7.503}, {'end': 3862.37, 'text': 'And then for arrays, they may result on much memory waste.', 'start': 3859.369, 'duration': 3.001}, {'end': 3866.552, 'text': 'To make up for the fact that arrays can only be made at a fixed size.', 'start': 3862.65, 'duration': 3.902}, {'end': 3871.873, 'text': 'sometimes they will be created a lot bigger than what you really need to make sure you have enough room for everything.', 'start': 3866.552, 'duration': 5.321}, {'end': 3876.815, 'text': 'However, in a linked list, because of the dynamic size, there is no wasted memory.', 'start': 3872.314, 'duration': 4.501}, {'end': 3881.737, 'text': 'And then we have really fast sequential access for arrays and slow for linked lists.', 'start': 3877.155, 'duration': 4.582}], 'summary': 'Arrays allow fast random access, but may waste memory. linked lists have dynamic size and no wasted memory, but slow sequential access.', 'duration': 37.894, 'max_score': 3843.843, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3843843.jpg'}, {'end': 3972.754, 'src': 'embed', 'start': 3924.008, 'weight': 2, 'content': [{'end': 3926.89, 'text': 'And this dot next in the picture is the link.', 'start': 3924.008, 'duration': 2.882}, {'end': 3935.434, 'text': 'So it starts off just like the last element where the link is pointing to null next is pointing to null, then we just have a few simple functions.', 'start': 3927.19, 'duration': 8.244}, {'end': 3938.235, 'text': 'This dot size just returns the length.', 'start': 3935.754, 'duration': 2.481}, {'end': 3941.628, 'text': 'And this dot head just returns the head.', 'start': 3939.346, 'duration': 2.282}, {'end': 3948.233, 'text': "And here's the add function, where we're going to pass into the linked list is going to be the element.", 'start': 3942.288, 'duration': 5.945}, {'end': 3953.957, 'text': "So you're going to add the element, and then we're going to create a new node with that element.", 'start': 3948.593, 'duration': 5.364}, {'end': 3961.483, 'text': 'So, after you pass in the element and it creates this new node, the element of the node is set to the element you passed in,', 'start': 3954.518, 'duration': 6.965}, {'end': 3964.145, 'text': 'but the next of the node is set to null.', 'start': 3961.483, 'duration': 2.662}, {'end': 3970.613, 'text': 'So if head equals null, that means there are no nodes in the linked list yet.', 'start': 3965.529, 'duration': 5.084}, {'end': 3972.754, 'text': 'So we just set the head to equal the node.', 'start': 3970.873, 'duration': 1.881}], 'summary': 'A linked list implementation with add function and basic operations.', 'duration': 48.746, 'max_score': 3924.008, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3924008.jpg'}, {'end': 4084.847, 'src': 'embed', 'start': 4057.037, 'weight': 3, 'content': [{'end': 4063.019, 'text': 'the remove method, takes an element and searches the linked list to find and remove the node containing that element.', 'start': 4057.037, 'duration': 5.982}, {'end': 4068.001, 'text': "so you're passing the element that you want to remove and we always start at the head.", 'start': 4063.019, 'duration': 4.982}, {'end': 4074.284, 'text': "current node equals head and then we also need to know the previous node when you're going to remove something.", 'start': 4068.001, 'duration': 6.283}, {'end': 4080.586, 'text': 'so if the current node dot element equals element, if current node element equals element, well,', 'start': 4074.284, 'duration': 6.302}, {'end': 4084.847, 'text': "that just means that the head node is the element we're trying to remove.", 'start': 4080.586, 'duration': 4.261}], 'summary': 'The remove method in a linked list searches and removes a specified element, starting from the head node.', 'duration': 27.81, 'max_score': 4057.037, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4057037.jpg'}, {'end': 4262.371, 'src': 'embed', 'start': 4229.83, 'weight': 6, 'content': [{'end': 4232.332, 'text': 'so we just found the index of an element.', 'start': 4229.83, 'duration': 2.502}, {'end': 4234.714, 'text': "now we're going to find the element at an index.", 'start': 4232.332, 'duration': 2.382}, {'end': 4235.935, 'text': "that's just the opposite.", 'start': 4234.714, 'duration': 1.221}, {'end': 4240.279, 'text': "you're passing an index number and you're going to return the element.", 'start': 4235.935, 'duration': 4.344}, {'end': 4245.443, 'text': "so we have current node equals head, count equals zero and here's the wall loop here.", 'start': 4240.279, 'duration': 5.164}, {'end': 4247.885, 'text': 'well, count is less than index.', 'start': 4245.443, 'duration': 2.442}, {'end': 4249.666, 'text': "that means we haven't gotten to the index.", 'start': 4247.885, 'duration': 1.781}, {'end': 4254.589, 'text': "we're searching for increment count And current node equals current node dot next.", 'start': 4249.666, 'duration': 4.923}, {'end': 4256.389, 'text': 'So that means we hop to the next node.', 'start': 4255.009, 'duration': 1.38}, {'end': 4262.371, 'text': "So we're going to keep going through every node in the list until count is not less than index.", 'start': 4256.409, 'duration': 5.962}], 'summary': 'Finding element at index by iterating through linked list.', 'duration': 32.541, 'max_score': 4229.83, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4229830.jpg'}, {'end': 4299.709, 'src': 'embed', 'start': 4270.937, 'weight': 7, 'content': [{'end': 4279.52, 'text': "In it you're gonna pass in the index and the elements and add Remember, you always add to the end of the linked list, but in add at,", 'start': 4270.937, 'duration': 8.583}, {'end': 4281.181, 'text': 'you can add in the middle of the list.', 'start': 4279.52, 'duration': 1.661}, {'end': 4286.242, 'text': "So, just like yeah, we're gonna create a new node with the element We pass in and the current node is gonna equal head.", 'start': 4281.181, 'duration': 5.061}, {'end': 4287.563, 'text': 'We always start at the beginning.', 'start': 4286.282, 'duration': 1.281}, {'end': 4292.044, 'text': 'We need to keep track of the previous node and the current index is gonna equal zero.', 'start': 4287.563, 'duration': 4.481}, {'end': 4299.709, 'text': "so index is more than length and that means we've passed in an index that's way bigger than the actual length of the linked list.", 'start': 4292.044, 'duration': 7.665}], 'summary': 'Method for adding elements to a linked list, including handling for adding in the middle.', 'duration': 28.772, 'max_score': 4270.937, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4270937.jpg'}, {'end': 4444.135, 'src': 'embed', 'start': 4417.46, 'weight': 8, 'content': [{'end': 4422.483, 'text': "we're just going to keep going through each element on the list and once we find the element we want to remove like, let's say,", 'start': 4417.46, 'duration': 5.023}, {'end': 4429.587, 'text': "we're removing this second element at index one we're going to set previous node dot next to equal current node dot.", 'start': 4422.483, 'duration': 7.104}, {'end': 4432.288, 'text': "next we're going to set the previous node dot next.", 'start': 4429.587, 'duration': 2.701}, {'end': 4437.632, 'text': 'or this link is going to point to whatever was in the link to the current node,', 'start': 4432.288, 'duration': 5.344}, {'end': 4444.135, 'text': "or so this link is going to point to now this node right here And we're going to completely take out this one.", 'start': 4437.632, 'duration': 6.503}], 'summary': 'Explaining how to remove elements from a linked list.', 'duration': 26.675, 'max_score': 4417.46, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4417460.jpg'}, {'end': 4487.113, 'src': 'embed', 'start': 4457.859, 'weight': 5, 'content': [{'end': 4459.38, 'text': 'And let me bring up the console.', 'start': 4457.859, 'duration': 1.521}, {'end': 4461.061, 'text': "So we're going to create this new linked list.", 'start': 4459.4, 'duration': 1.661}, {'end': 4464.822, 'text': "We're going to add some items, kitten, puppy, dog, cat, fish.", 'start': 4461.361, 'duration': 3.461}, {'end': 4466.542, 'text': "We're going to show the size.", 'start': 4465.242, 'duration': 1.3}, {'end': 4469.524, 'text': "We're going to remove the third item on the list.", 'start': 4466.823, 'duration': 2.701}, {'end': 4470.444, 'text': "So we'll run that.", 'start': 4469.764, 'duration': 0.68}, {'end': 4472.865, 'text': "and see, we're going to remove cat.", 'start': 4471.164, 'duration': 1.701}, {'end': 4483.451, 'text': "now let's copy this we're going to do element at, then we'll try index at, and for the element we're going to put puppy.", 'start': 4472.865, 'duration': 10.586}, {'end': 4485.192, 'text': 'look, i mean index of.', 'start': 4483.451, 'duration': 1.741}, {'end': 4487.113, 'text': 'so we remove cat.', 'start': 4485.192, 'duration': 1.921}], 'summary': 'Creating linked list, adding items, showing size, and removing items.', 'duration': 29.254, 'max_score': 4457.859, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4457859.jpg'}], 'start': 3749.94, 'title': 'Linked list implementation and functions', 'summary': 'Explains the implementation of hash table and linked list, highlighting advantages of linked lists compared to arrays, including dynamic size and efficient insertions and deletions. it also covers various linked list functions and examples showcasing the functionality.', 'chapters': [{'end': 4157.406, 'start': 3749.94, 'title': 'Hash table and linked list implementation', 'summary': 'Explains the implementation of a hash table and linked list, highlighting the advantages and disadvantages of linked lists compared to arrays, including dynamic size, efficient insertions and deletions, and the process of adding and removing nodes.', 'duration': 407.466, 'highlights': ['Linked lists have dynamic size, efficient insertions and deletions, and no wasted memory due to dynamic sizing.', 'Arrays have random access, while linked lists require traversal through every element for access, leading to slower sequential access.', 'The process of adding nodes in a linked list involves checking if the head is null, creating a new node, and updating the references accordingly.', 'The remove method in a linked list involves searching for the node containing a specific element, updating the references, and decrementing the length of the list.']}, {'end': 4498.779, 'start': 4159.25, 'title': 'Linked list functions and examples', 'summary': 'Covers the implementation of various linked list functions including finding the index of an element, finding an element at an index, adding elements at specific positions, removing elements at specific positions, and using a linked list with examples showcasing the functionality.', 'duration': 339.529, 'highlights': ['Implementation of various linked list functions', 'Example showcasing the linked list functionality', 'Explanation of finding the index of an element', 'Explanation of adding elements at specific positions', 'Explanation of removing elements at specific positions']}], 'duration': 748.839, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U3749940.jpg', 'highlights': ['Linked lists have dynamic size, efficient insertions and deletions, and no wasted memory due to dynamic sizing.', 'Arrays have random access, while linked lists require traversal through every element for access, leading to slower sequential access.', 'The process of adding nodes in a linked list involves checking if the head is null, creating a new node, and updating the references accordingly.', 'The remove method in a linked list involves searching for the node containing a specific element, updating the references, and decrementing the length of the list.', 'Implementation of various linked list functions', 'Example showcasing the linked list functionality', 'Explanation of finding the index of an element', 'Explanation of adding elements at specific positions', 'Explanation of removing elements at specific positions']}, {'end': 5232.321, 'segs': [{'end': 4555.688, 'src': 'embed', 'start': 4502.757, 'weight': 0, 'content': [{'end': 4513.507, 'text': 'A trie, sometimes called a prefix tree, is a special type of tree used to store associative data structures.', 'start': 4502.757, 'duration': 10.75}, {'end': 4516.149, 'text': 'A trie stores data in steps.', 'start': 4514.387, 'duration': 1.762}, {'end': 4518.371, 'text': 'Each step is a node in the trie.', 'start': 4516.689, 'duration': 1.682}, {'end': 4524.757, 'text': 'This is often used to store words, since there are a finite number of letters that can be put together to make a string.', 'start': 4519.072, 'duration': 5.685}, {'end': 4529.12, 'text': 'A possible use case would be to validate that a word is in a dictionary.', 'start': 4525.377, 'duration': 3.743}, {'end': 4533.765, 'text': 'Each step or node would represent one letter of a word.', 'start': 4530.021, 'duration': 3.744}, {'end': 4537.569, 'text': 'So if you can see over here, this is an example of a try.', 'start': 4534.326, 'duration': 3.243}, {'end': 4540.833, 'text': 'This word right here will be B-A-L-L, ball.', 'start': 4537.849, 'duration': 2.984}, {'end': 4548.481, 'text': 'The steps begin to branch off when the order of the letters diverge from the other words in the try or when a word ends.', 'start': 4541.553, 'duration': 6.928}, {'end': 4555.688, 'text': 'So if you get the word B-A-L-L, but you also have B-A-T, bat.', 'start': 4549.121, 'duration': 6.567}], 'summary': 'A trie is a tree for storing associative data, commonly used for words with finite letters. it can be used to validate words in a dictionary.', 'duration': 52.931, 'max_score': 4502.757, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4502757.jpg'}, {'end': 4666.534, 'src': 'embed', 'start': 4641.485, 'weight': 2, 'content': [{'end': 4649.529, 'text': 'Each node is going to have a list of keys, which is just a list of all the other letters that are inside that folder or inside that node.', 'start': 4641.485, 'duration': 8.044}, {'end': 4652.27, 'text': "And then we're going to have an end data.", 'start': 4649.969, 'duration': 2.301}, {'end': 4655.532, 'text': 'That just means is this the end letter in a word?', 'start': 4652.31, 'duration': 3.222}, {'end': 4666.534, 'text': 'So in this picture, all of the nodes with a star have end set to true and all of the nodes without a star have end set to false.', 'start': 4656.312, 'duration': 10.222}], 'summary': 'Nodes contain keys and end data, with starred nodes indicating end of word.', 'duration': 25.049, 'max_score': 4641.485, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4641485.jpg'}, {'end': 4799.354, 'src': 'embed', 'start': 4778.539, 'weight': 4, 'content': [{'end': 4788.008, 'text': "So if input that length equals equals zero, that means if we're at the end of the word that we passed in, we're just going to do node dot,", 'start': 4778.539, 'duration': 9.469}, {'end': 4791.591, 'text': "set end and then return, and we're done with the add function.", 'start': 4788.008, 'duration': 3.583}, {'end': 4799.354, 'text': "Else if, that means if there's more than zero letters that we've passed into this add function, we're not at the end of the word.", 'start': 4792.552, 'duration': 6.802}], 'summary': 'If the input length equals zero, set end; else, continue with the add function.', 'duration': 20.815, 'max_score': 4778.539, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4778539.jpg'}, {'end': 5126.294, 'src': 'embed', 'start': 5083.606, 'weight': 5, 'content': [{'end': 5094.531, 'text': 'And now we go to this very last line, if node.key.hasWord, which would just be a single letter, because remember, we keep taking the letters off.', 'start': 5083.606, 'duration': 10.925}, {'end': 5100.695, 'text': 'And so if it has the last letter of the word that we passed in, And it is the end.', 'start': 5095.052, 'duration': 5.643}, {'end': 5108.1, 'text': "So is end, then we're going to return true, that word is in the try, else we're going to return false.", 'start': 5101.095, 'duration': 7.005}, {'end': 5112.664, 'text': 'Yeah, so this last one was just the print function is kind of a helper function.', 'start': 5108.521, 'duration': 4.143}, {'end': 5114.886, 'text': "And so we're going to create an array of every word.", 'start': 5112.884, 'duration': 2.002}, {'end': 5117.187, 'text': "But right now it's just gonna be empty.", 'start': 5115.466, 'duration': 1.721}, {'end': 5118.388, 'text': "then we're going to search.", 'start': 5117.187, 'duration': 1.201}, {'end': 5120.75, 'text': "we're going to pass in our search.", 'start': 5118.388, 'duration': 2.362}, {'end': 5123.912, 'text': "if we don't pass anything here, it's gonna set this to the root node.", 'start': 5120.75, 'duration': 3.162}, {'end': 5126.294, 'text': "Actually, I bet we don't even need this.", 'start': 5124.653, 'duration': 1.641}], 'summary': 'Checking if word is in the trie by returning true or false based on the last letter of the word.', 'duration': 42.688, 'max_score': 5083.606, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U5083606.jpg'}], 'start': 4502.757, 'title': 'Implementing trie data structure', 'summary': 'Introduces the trie data structure, used to store associative data structures, and explains its implementation, including node structure, functions for adding words, checking word existence, and printing words in the trie, with a specific use case being to validate words in a dictionary.', 'chapters': [{'end': 4585.136, 'start': 4502.757, 'title': 'Trie data structure', 'summary': 'Introduces the concept of a trie, also known as a prefix tree, used to store associative data structures, which is illustrated using an example of storing words and their letters, with a specific use case being to validate words in a dictionary.', 'duration': 82.379, 'highlights': ['Each node in a trie represents a letter of a word, allowing efficient storage and retrieval of words from a dictionary.', 'Tries are particularly useful for storing words due to the finite number of letters that can be combined to form strings.', "The branching in a trie occurs when the order of letters diverges from other words or when a word ends, as depicted by the example of words 'ball', 'bat', 'doll', 'do', 'dork', and 'dorm' in the trie.", 'The red stars in the trie indicate the end of a word, facilitating efficient word validation and retrieval from the data structure.']}, {'end': 5232.321, 'start': 4585.797, 'title': 'Implementing trie data structure', 'summary': 'Explains the implementation of a trie data structure, highlighting the structure of nodes, functions for adding words, checking word existence, and printing all words in the trie.', 'duration': 646.524, 'highlights': ["The data structure of Trie consists of nodes with key-value pairs, a list of keys, and an 'end' indicator for each node, enabling efficient word search.", "The 'add' function recursively adds a word to the Trie by creating new nodes for each letter and setting the 'end' indicator when the word ends.", "The 'isWord' function efficiently checks if a word exists in the Trie by iterating through the nodes and returning true if the word is found, else false.", "The 'print' function helps to print all the words in the Trie by recursively traversing the nodes and adding words to an array for display."]}], 'duration': 729.564, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U4502757.jpg', 'highlights': ['Each node in a trie represents a letter of a word, allowing efficient storage and retrieval of words from a dictionary.', "The branching in a trie occurs when the order of letters diverges from other words or when a word ends, as depicted by the example of words 'ball', 'bat', 'doll', 'do', 'dork', and 'dorm' in the trie.", 'The red stars in the trie indicate the end of a word, facilitating efficient word validation and retrieval from the data structure.', "The data structure of Trie consists of nodes with key-value pairs, a list of keys, and an 'end' indicator for each node, enabling efficient word search.", "The 'add' function recursively adds a word to the Trie by creating new nodes for each letter and setting the 'end' indicator when the word ends.", "The 'isWord' function efficiently checks if a word exists in the Trie by iterating through the nodes and returning true if the word is found, else false.", 'Tries are particularly useful for storing words due to the finite number of letters that can be combined to form strings.', "The 'print' function helps to print all the words in the Trie by recursively traversing the nodes and adding words to an array for display."]}, {'end': 6774.154, 'segs': [{'end': 5287.312, 'src': 'embed', 'start': 5258.483, 'weight': 0, 'content': [{'end': 5262.545, 'text': 'It has some similarities to a binary search tree except the order is a little different.', 'start': 5258.483, 'duration': 4.062}, {'end': 5265.306, 'text': 'Each node has at most two child nodes.', 'start': 5263.085, 'duration': 2.221}, {'end': 5270.688, 'text': 'The heap property indicates a specific relationship between the parent and child nodes.', 'start': 5265.906, 'duration': 4.782}, {'end': 5276.59, 'text': 'You may have a max heap in which all parent nodes are equal than or greater to the the child nodes.', 'start': 5271.228, 'duration': 5.362}, {'end': 5281.871, 'text': 'So you can see the biggest numbers on top and the smallest numbers are on bottom.', 'start': 5277.29, 'duration': 4.581}, {'end': 5287.312, 'text': 'Or you may have a min heap in which all child nodes are greater than or equal to the parent nodes.', 'start': 5282.451, 'duration': 4.861}], 'summary': 'Describes the properties of a max and min heap with similarities to a binary search tree.', 'duration': 28.829, 'max_score': 5258.483, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U5258483.jpg'}, {'end': 5328.274, 'src': 'embed', 'start': 5300.615, 'weight': 1, 'content': [{'end': 5303.995, 'text': 'you can see that it goes from a small number to a big number to a small number.', 'start': 5300.615, 'duration': 3.38}, {'end': 5305.836, 'text': "the order doesn't matter if they're on the same level.", 'start': 5303.995, 'duration': 1.841}, {'end': 5309.925, 'text': 'binary heaps are also complete binary trees.', 'start': 5306.843, 'duration': 3.082}, {'end': 5313.106, 'text': 'This means that all levels of the tree are fully filled.', 'start': 5310.465, 'duration': 2.641}, {'end': 5316.788, 'text': 'And if the last level is partially filled, it is filled from left to right.', 'start': 5313.546, 'duration': 3.242}, {'end': 5323.531, 'text': "So if you see the example down here, so here's level one, then we have level two here, level three, level three is all the way filled.", 'start': 5317.148, 'duration': 6.383}, {'end': 5328.274, 'text': "Level four is only partially filled because there's nothing over on the right side here.", 'start': 5323.931, 'duration': 4.343}], 'summary': 'Binary heaps are complete binary trees with fully filled levels, and partially filled levels are filled from left to right.', 'duration': 27.659, 'max_score': 5300.615, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U5300615.jpg'}, {'end': 5458.817, 'src': 'embed', 'start': 5427.521, 'weight': 2, 'content': [{'end': 5432.825, 'text': "So if your index four, and you go to index 811, yep, that's the left child.", 'start': 5427.521, 'duration': 5.304}, {'end': 5438.369, 'text': "Now if we start index four, and we do the right child equation, I times two plus one, that's nine.", 'start': 5433.185, 'duration': 5.184}, {'end': 5441.831, 'text': "So if we go to index nine, yep, that's the right child here.", 'start': 5438.769, 'duration': 3.062}, {'end': 5450.354, 'text': "So that's how you can use these equations to find the left and right child from an array representation, you can also figure out the parent.", 'start': 5442.331, 'duration': 8.023}, {'end': 5458.817, 'text': "So the equation for a parent is I divide by two, if we are on 11, that's index eight, eight divided by two is four index four.", 'start': 5450.794, 'duration': 8.023}], 'summary': 'Using equations to find left and right child from array representation, also finding the parent.', 'duration': 31.296, 'max_score': 5427.521, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U5427521.jpg'}, {'end': 5810.016, 'src': 'embed', 'start': 5782.447, 'weight': 3, 'content': [{'end': 5785.688, 'text': 'because, remember, this is the equation for the parent node.', 'start': 5782.447, 'duration': 3.241}, {'end': 5788.009, 'text': 'one is the index of the root node.', 'start': 5785.688, 'duration': 2.321}, {'end': 5796.452, 'text': "So if the parent node is more than the root node, then we're going to set the index to math that for next, divide by two,", 'start': 5788.429, 'duration': 8.023}, {'end': 5803.494, 'text': "that's the parent node which, if you remember, up here we just put the number we passed in into the parent node.", 'start': 5796.452, 'duration': 7.042}, {'end': 5810.016, 'text': 'So now the index is still going to refer to the number we just passed in, because that number has went into the parent node.', 'start': 5803.914, 'duration': 6.102}], 'summary': 'Explaining how to update index if parent node is greater than root node.', 'duration': 27.569, 'max_score': 5782.447, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U5782447.jpg'}], 'start': 5232.321, 'title': 'Binary heaps, min heap, and graph representation', 'summary': 'Covers binary heaps, including heap property, complete binary trees, array representation, min heap data structure, heap sort algorithm with o(n log n) performance, and graph representations in javascript including adjacency list, adjacency matrix, and incidence matrix, with a demonstration of breadth-first search algorithm.', 'chapters': [{'end': 5475.674, 'start': 5232.321, 'title': 'Binary heaps and trees', 'summary': 'Explains binary heaps, including the heap property, complete binary trees, and array representation, and demonstrates how to find child and parent nodes in a binary heap using array representation.', 'duration': 243.353, 'highlights': ['The chapter explains the heap property, which defines the relationship between parent and child nodes in a binary heap, such as in a max heap where all parent nodes are greater than or equal to the child nodes.', 'It describes binary heaps as complete binary trees, where all levels of the tree are fully filled and the last level, if partially filled, is filled from left to right.', 'The chapter demonstrates the array representation of a binary heap and explains the equations for finding left and right child nodes, as well as the parent node, using the array index. For instance, the equation for the left child is i times two, and the right child is i times two plus one.', 'It clarifies the method of finding the parent node in a binary heap using the equation i divide by two, rounded down to the nearest whole number, to locate the parent node in the array representation.']}, {'end': 6119.55, 'start': 5475.674, 'title': 'Understanding min heap data structure', 'summary': 'Explains the concept and implementation of a min heap data structure, demonstrating the insertion and removal process, with a focus on heap sort algorithm and its performance of o(n log n). it elaborates on the code for insertion, removal, and heap sort using a min heap.', 'duration': 643.876, 'highlights': ['The chapter explains the concept and implementation of a min heap data structure, with a demonstration of the insertion and removal process. It also emphasizes the use of heap sort, an efficient sorting algorithm with average and worst case performance of O(n log n).', 'The code for insertion in the min heap involves pushing a number onto the end of the heap and then adjusting its position based on the heap property, where the smallest numbers have to be at the top. The process includes swapping nodes and moving the inserted node up the tree until it reaches the correct position.', 'The removal process in the min heap involves taking out the smallest node from the top of the tree, rearranging the array, and ensuring that the new array contains the original items in least to greatest order, demonstrating the use of the heap sort algorithm.', 'The chapter also covers the use of heap sort by adding each item in the unsorted array into a min heap and then extracting every item out of the min heap into a new array, ensuring that the new array contains the original items in least to greatest order.']}, {'end': 6774.154, 'start': 6119.55, 'title': 'Graph representation and traversal in javascript', 'summary': 'Explains the types of graphs, adjacency list, adjacency matrix, and incidence matrix representations, and demonstrates breadth-first search algorithm in javascript to find distances between nodes in a graph.', 'duration': 654.604, 'highlights': ['The chapter explains the types of graphs, adjacency list, adjacency matrix, and incidence matrix representations', 'Demonstrates breadth-first search algorithm in JavaScript to find distances between nodes in a graph']}], 'duration': 1541.833, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/t2CEgPsws3U/pics/t2CEgPsws3U5232321.jpg', 'highlights': ['The chapter covers the heap property in binary heaps, defining the relationship between parent and child nodes', 'It explains binary heaps as complete binary trees, where all levels are fully filled and the last level is filled from left to right', 'The chapter demonstrates the array representation of a binary heap and explains the equations for finding left and right child nodes', 'It clarifies the method of finding the parent node in a binary heap using the equation i divide by two']}], 'highlights': ['Hash tables have an average time complexity of O(1) for search, insert, and delete operations.', 'Binary search trees have two branches for every node, resulting in time proportional to the logarithm of the number of items stored.', 'Linked lists have dynamic size, efficient insertions and deletions, and no wasted memory due to dynamic sizing.', 'Each node in a trie represents a letter of a word, allowing efficient storage and retrieval of words from a dictionary.', "The stack data structure is illustrated using a stack of books and the browser's back button, highlighting the last in, first out type of service and the stack methods push and pop."]}