In this example, we have the following map:
KeyValue
nameJohn
cityNew York
countryUSA

We prove that, when the key "country" and its value is deleted, the map will change to:
KeyValue
nameJohn
cityNew York
This proof iterates through the entries in the map. The first key is "name", which doesn't match "country," so we just move it to processed. The first key in the map is now "city," which does not match the key we are looking for, so we just move the entry to "processed." The first (and last) key in the map is now "country." This matches the key we are looking for. Thus, we pop this from the map but we don't paste it into "processed." Now "processed" has all the entries except the entry with the key "country." From there, we just need to reverse "processed."

Quiz (1 point)

Prove that:
result of deleting the entry with key "country" from map [ entry "name": "John", [ entry "city": "New York", [ entry "country": "USA", [ ] ] ] ] = [ entry "name": "John", [ entry "city": "New York", [ ] ] ]

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!