guess the next step: Hash table that grows
Before each step plays, guess what it does. The page then shows the step as the run takes it and says why, the same sentence the watch page says there.
Step 1 of 51
Question 1 of 34
Step 1 of 51
Step 2 of 51
Step 3 of 51
Step 4 of 51
Step 5 of 51
Step 6 of 51
Step 7 of 51
Step 8 of 51
Question 1 of 34
Question 1 of 34
Not this time.
You guessed: The home of 1 is slot 0.
What the run did:
1 leaves 1 when divided by 2, so its home is slot 1.
Question 1 of 34
Right.
You guessed: The home of 1 is slot 1.
What the run did:
1 leaves 1 when divided by 2, so its home is slot 1.
Question 1 of 34
Not this time.
You guessed: The home of 1 is slot 2.
What the run did:
1 leaves 1 when divided by 2, so its home is slot 1.
Question 2 of 34
Question 2 of 34
Right.
You guessed: Slot 1 is empty, so 1 is not in the table yet.
What the run did:
Slot 1 is empty, so 1 is not in the table yet.
Question 2 of 34
Not this time.
You guessed: Slot 1 holds another number, so look at the next.
What the run did:
Slot 1 is empty, so 1 is not in the table yet.
Question 2 of 34
Not this time.
You guessed: Slot 1 already holds 1, so turn it away.
What the run did:
Slot 1 is empty, so 1 is not in the table yet.
Question 3 of 34
Question 3 of 34
Right.
You guessed: With 1, no more than half the slots would hold a number, so they stay.
What the run did:
With 1, 1 of the 2 slots would hold a number. That is no more than half, so the slots stay as they are.
Question 3 of 34
Not this time.
You guessed: With 1, more than half the slots would hold a number, so double them.
What the run did:
With 1, 1 of the 2 slots would hold a number. That is no more than half, so the slots stay as they are.
Question 4 of 34
Question 4 of 34
Right.
You guessed: The home of 2 is slot 0.
What the run did:
2 leaves 0 when divided by 2, so its home is slot 0.
Question 4 of 34
Not this time.
You guessed: The home of 2 is slot 1.
What the run did:
2 leaves 0 when divided by 2, so its home is slot 0.
Question 4 of 34
Not this time.
You guessed: The home of 2 is slot 2.
What the run did:
2 leaves 0 when divided by 2, so its home is slot 0.
Question 5 of 34
Question 5 of 34
Right.
You guessed: Slot 0 is empty, so 2 is not in the table yet.
What the run did:
Slot 0 is empty, so 2 is not in the table yet.
Question 5 of 34
Not this time.
You guessed: Slot 0 holds another number, so look at the next.
What the run did:
Slot 0 is empty, so 2 is not in the table yet.
Question 5 of 34
Not this time.
You guessed: Slot 0 already holds 2, so turn it away.
What the run did:
Slot 0 is empty, so 2 is not in the table yet.
Question 6 of 34
Question 6 of 34
Not this time.
You guessed: With 2, no more than half the slots would hold a number, so they stay.
What the run did:
With 2, 2 of the 2 slots would hold a number, more than half. Double them to 4, and take the number out to move.
Question 6 of 34
Right.
You guessed: With 2, more than half the slots would hold a number, so double them.
What the run did:
With 2, 2 of the 2 slots would hold a number, more than half. Double them to 4, and take the number out to move.