| 1. |
How to use isEmpty() memory representation of stack? |
|
Answer» ong>Answer: STEP 1 − Checks if the stack is empty. Step 1 − Checks if the stack is empty.Step 2 − If the stack is empty, produces an error and exit. Step 1 − Checks if the stack is empty.Step 2 − If the stack is empty, produces an error and exit.Step 3 − If the stack is not empty, accesses the data element at which top is pointing. Step 1 − Checks if the stack is empty.Step 2 − If the stack is empty, produces an error and exit.Step 3 − If the stack is not empty, accesses the data element at which top is pointing.Step 4 − Decreases the value of top by 1. Step 1 − Checks if the stack is empty.Step 2 − If the stack is empty, produces an error and exit.Step 3 − If the stack is not empty, accesses the data element at which top is pointing.Step 4 − Decreases the value of top by 1.Step 5 − Returns SUCCESS. |
|