Note: This course is a subset of our much longer course 'From 0 to 1: Data Structures & Algorithms' so please don't sign up for both:-)
This is an animated, visual and spatial way to learn data structures and algorithms
Note: This course is a subset of our much longer course 'From 0 to 1: Data Structures & Algorithms' so please don't sign up for both:-)
This is an animated, visual and spatial way to learn data structures and algorithms
What's Covered:
The queue belongs to the same linear data structure family as the stack but it's behavior is very different. Queues are much more intuitive as there are plenty of real world examples where a queue is the fair and correct way of processing.
We know the stack, and we know the queue. This problem brings them together. It's possible to mimic the behavior of a queue using 2 stacks in the underlying implementation. Let's write the most efficient code possible to make this work.
The binary tree is an incredibly useful hierarchical data structure. Many other, more complex data structures, use the binary tree as the foundation. Let's see what a binary tree looks like and learn some simple terminology associated with the tree.
Depth first traversal can be of 3 types based on the order in which the node is processed relative to it's left and right sub-trees. Pre-order traversal processes the node before processing the left and then the right sub trees.
Depth first traversal can be of 3 types based on the order in which the node is processed relative to it's left and right sub-trees.
In-order traversal processes the left subtree, then the node itself and then it's right sub trees. Post-order traversal processes the node *after* it's left and right subtrees.
The algorithms are all remarkably similar and very easy once you use recursion.
Insertion and Lookup are operations which are very fast in a Binary Search Tree. See how they work and understand their performance and complexity.
Find the minimum value in a binary search tree, find the maximum depth of a binary tree and mirror a binary tree. Learn to solve these problems recursively and see implementation details.
Check if a path from root node to leaf node has a specified sum, print all paths from the root node to all leaf nodes and find the least common ancestor for two nodes in a binary tree. Learn to solve these problems and understand the implementation details.
Priority Queues allow us to make decisions about which task or job has the highest priority and has to be processed first. Common operations on a Priority Queue are insertion, accessing the highest priority element and removing the highest priority element.
The Binary Heap is the best implementation of the Priority Queue.
The Binary Heap is logically a Binary Tree with specific constraints. Constraints exist on the value of a node with respect to it's children and on the shape of the tree. The heap property and the shape property determine whether a Binary Tree is really a Heap.
Let's build a real heap in Java!
The Binary Heap may logically be a tree, however the most efficient way to implement it is using an array. Real pointers from parent to child and from child to parent become implicit relationships on the indices of the array.
OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.
Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.
Find this site helpful? Tell a friend about us.
We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.
Your purchases help us maintain our catalog and keep our servers humming without ads.
Thank you for supporting OpenCourser.