Please enable JavaScript.
Coggle requires JavaScript to display documents.
Data Structures - Coggle Diagram
Data Structures
-
Trees
-
-
-
-
AVL Tree
-
-
-
Work like BSTs, only you also check to see if the node is balanced after you added the new node
-
-
Applying Tree Algorithms
-
-
Graphs
-
It's sort of like working with Trees, but without parent-child relationships
Instead there are cycles ( A -> B, B -> C, C -> A)
Depth-first Traversal
preorder traversal
you process the node (save it in an array), then recursively call the method on the left subtree and then the right subtree
inorder traversal
you first recursively call the method on the left tree, then process the node, and then call the method on the right tree.
Lists
LinkedList
-
Every node in a LinkedLists has two properties, the value of whatever is being store and a pointer to the next node in the list
-
Look Ups
-
-
The 1 node points to the 2 node, etc
-
-
ArrayList
Imagine there are no Arrays, only Objects
-
Since everything is already laid out in the order it's in memory, it makes look-ups really simple
Just by knowing where the start of the array is and the index, we know where the thing we're looking for in memory
-
Heap Sort
A heap is an array that represents a tree data structure and has to be sorted in a particular way to represent that tree
Process
-
Loop over the array / max array, dequeuing the root node, and swapping that with last item in the array
After dequeuing each item, run heapify again, once to find the next root node
Next loop you'll dequeue the root node and swap it with the second-to-last item in the array and run heapify again.
Once you've run out of items to dequeue, you have a sorted array