What does the following pseudocode axiom mean in English 1
What does the following pseudocode axiom mean, in English?
1. ( aStack.push( item ) ).pop() = aStack
2. aList.getLength() = ( aList.insert( i, item ) ).getLength() - 1
3. ( aList.insert( i, item ) ).remove( i ) = aList
4. aList.getEntry( i ) = ( aList.insert( i, item ) ).getEntry( i+1 )
Solution
Please let me know in case of any issue
1. ( aStack.push( item ) ).pop() = aStack
pishing an item in stack and then removing, it means stack came in same state as it was before these two operation
2. aList.getLength() = ( aList.insert( i, item ) ).getLength() - 1
length of list = length if list that has one more element - 1
3. ( aList.insert( i, item ) ).remove( i ) = aList
Adding an item at index i, then removing same item, that means list has same set of elements as
it was before these two operation
4. aList.getEntry( i ) = ( aList.insert( i, item ) ).getEntry( i+1 )
aList.getEntry( i ) =>getting an elemets at index i
aList.insert( i, item ) => insert an item at i
( aList.insert( i, item ) ).getEntry( i+1 ) => inserting an item at index i and then getting elemnts from index (i+1)
