Discuss the effect on all operations on a stack if there were not a count variable in the implementation.
What will be an ideal response?
Push and pop would be minimally affected. The only difference would be that the count variable would not have to be updated. Peek would not be affected at all. The isEmpty operation would have to check the contents of the stack to see if anything is on the stack, instead of looking at the count variable. The biggest impact would be on the size operation, which would have to count the number of elements in the stack one by one; instead of a O(1) operation, size would become a O(n) operation.
You might also like to view...
On a firewall how would a technician make sure that all external website traffic goes to the right computer?
A. Configure all interior traffic appropriately B. In the exceptions list put in the IP address of the local website C. Configure firewall NAT D. Configure port forwarding
What are the two main purposes for feedback in organizations?
What will be an ideal response?