@BiancaGando
Constructor:
- storage
- root
Methods:
search(key): This searches for the key in the tree and returns true if it exists and returns false if the node doesn't
min/max: This returns the min or max value/key in the tree
remove(key): This removes the key from the tree
A linked list is a tree structure with only one child per node.
Each node in the list contains:
1. Constructor Function
- head
2. Methods
- .addToTail(val) //adds node to tail
- .remove(node) //removes node from list & returns it
//Constructor //Add to tail //Remove node
//Constructor //Add a child
Adding nodes: O(1)*
Removing nodes: O(1)*
Searching: O(n)
*when you have a reference to the node.
Fast addition
Fast removal
Slow look-up without reference to the node
Create a scavenger hunt game using a Linked List.
Let's discuss how you think we may go about doing that before diving in.
By Bianca Gandolfo
Day 2
Slide decks for learning JavaScript