In this example, we prove that if we pop the following list

[3, [2, [1, []]]]

At index 2, and the "visited" list is empty, the resulting list is

[3, [2, []]]

First, we use the induction step to pop 3, then 2, from the list and add them to the "visited" list. The index is also decremented twice. Then in step 7, we claim that we need to 1) reverse and insert the remaining list to the "visited" list, then 2) reverse the resulting list. Since the remaining list is empty, we really just need to reverse the "visited" list.

And in the remaining steps, we use the Transitive Property to reach the conclusion.

Quiz (1 point)

Prove that:
remaining elements after [ 3, [ 2, [ 1, [ ] ] ] ] is popped at index 2 and visited stack is [ ] = [ 3, [ 2, [ ] ] ]

The following properties may be helpful:

Please write your proof in the table below. Each row should contain one claim. The last claim is the statement that you are trying to prove.

Step Claim Reason (optional) Error Message (if any)
1
2
3
4
5
6
7
8
9
10

Become a subscriber to save your progress, see the correct answer, and more!