Data Structures Flashcards
What is the goal of a hash table?
To immediately find an item in a sorted or unsorted list without the need to compare other items in the data set
Compare the efficiency of a binary search tree to a hash table when searching for data
Binary search trees are less efficient than hash tables as hash tables can find data immediately without checking other values.
Compare the efficiency of a binary search tree to a linked list when searching for data
Binary search trees are more efficient than linked lists because binary search trees don’t need to check every value, as the tree removes half the values each time.
How can binary trees represented in memory?
with dictonaries.
tree = {“E”: [“B”,”G”]}
Name some uses for binary trees
- Database applications - for efficient searching and sorting is required without moving items.
- Wireless Networking and router tables.
- Operating systems scheduling processes
What does each node contain in a binary tree?
Data
Left Pointer
Right Pointer
How do you sort a binary search tree?
Using alphabetical / numerical order.
If a word is larger than the parent node, then its moved to the right vise versa…
if the next word was “Spratt” where would you put it. (1 or 2)
Jack
1 2
2 because “S”pratt is larger than “J”ack alphabetically wise.