Explore the concept of the heap data structure and the difference between a min heap and a max heap. Learn how a heap adds elements and swaps nodes to keep itself in an organized but not completely sorted order.
- You may be familiar with the term heap…as meaning an area of memory where you allocate objects,…but that's not what we're talking about here.…A heap is a data structure that's implemented…as a binary tree.…Remember, a binary tree is where each parent…had a maximum of two direct child nodes.…What makes a heap special?…Like a binary search tree,…we add additional constraints.…So the basics.…Heaps are a collection of objects.…As we add items to the heap,…they are always added top to bottom, left to right.…
We completely fill in the level before moving onto the next.…This means we don't have to worry…about the tree becoming imbalanced,…like a binary search tree can.…But it's not just random things added in any random order.…Depending on the type of heap,…we care about the minimum or maximum value.…What this means is do we want the top of the heap,…our root node, to always contain the lowest value…in the entire heap,…or do we want the top of the heap…to always contain the highest value?…It all depends on what data we want to access most.…
- Data types: Booleans, numbers, strings, and more
- Multidimensional arrays
- Jagged arrays
- Search and sort arrays
- Linked lists
- Stacks and queues
- Hash functions and hash tables
- Trees and graphs
Skill Level Intermediate
Understand data structures1m 25s
1. Introduction to Data Structures
4. Stacks and Queues
5. Hash-Based Data Structures
6. Trees and Graphs
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.