Appending to a List Property
result of appending y to xs = reverse of [ y, reverse of xs ]
This property states that appending an element to a list is the same as reversing the list, prepending the element to it, and then reversing it again.
Examples
result of appending 7 to [ ] = reverse of [ 7, reverse of [ ] ]
result of appending 3 to [ 37, [ ] ] = reverse of [ 3, reverse of [ 37, [ ] ] ]
result of appending 5 to [ 17, [ 19, [ 21, [ ] ] ] ] = reverse of [ 5, reverse of [ 17, [ 19, [ 21, [ ] ] ] ] ]
result of appending 8 to [ 6, [ 4, [ 2, [ ] ] ] ] = reverse of [ 8, reverse of [ 6, [ 4, [ 2, [ ] ] ] ] ]
What is the reverse of [3, [2, [1, []]]]?
When we prepend 4 to [1, [2, [3, []]]], the result is:
What is the reverse of [4, [1, [2, [3, []]]]]?
Comments
Please log in to add comments