Skip to content

Commit b57e7e2

Browse files
committedDec 15, 2017
Answered all questions
1 parent 1c195f0 commit b57e7e2

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed
 

‎README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@
66

77
## Questions
88
1. What are the order of insertions/removals for the following data structures?
9-
- **Stack**
10-
- **Queue**
11-
2. What is the retreival time complexity for the following data structures?
12-
- **Linked List**
13-
- **Hash Table**
14-
- **Binary Search Trees**
9+
- **Stack** LIFO - Last In, First Out
10+
- **Queue** FIFO - First In, First Out
11+
2. What is the retrieval time complexity for the following data structures?
12+
- **Linked List** O(n) - Linear Time - It goes up at the same rate as the size of the dataset.
13+
- **Hash Table** O(1) Constant Time - It takes the same amount of time no matter how many elements are in the data set. The hashing time doesn't change with the input or the size of the dataset.
14+
- **Binary Search Trees** O(log(n)) - Logarithmic complexity - it goes up log(n) for a dataset of size n. This is much less of an increase than Linear time, but not as good as a time constant such as in a Hash Table, given a data set that is large enough that O(log(n)) is higher than the time required to hash a single input. Smaller datasets would see faster retrieval if implemented as Binary Search Trees.
15+
1516
2. What are some advantages to using a Hash Tables over an array in JavaScript?
1617

18+
If you have a very large data set, the search/insert/retrieval/deletion times are faster with a Hash Table. Any loss of performance due to resizing the table is temporary.
19+
(They can't be all that great, or Ryan would love them!)
20+
1721
## Challenge
1822
If you take a look at the hash-table.js file you'll notice that it has solution code in it. You'll also notice that if you run the tests, they all pass. Your job is to refactor this hash table solution to use **linked lists** for buckets instead of arrays. You're welcome to add another class to the helper file, following the pattern used with LimitedArray.

0 commit comments

Comments
 (0)
Please sign in to comment.