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...
Which directive gives your program access to a library?
a. #include b. #define c. #library d. #stdio e. all of the above
The test-and-set instruction ________.
a) prevents deadlock b) prevents indefinite postponement c) eliminates the possibility that a thread is preempted between reading a value from a memory location and writing a new value to the memory location d) none of the above
Use STROBE to analyze Anna’s written observations about Cher Ware and Paige Prynter. Use two paragraphs to compare and contrast the decision-making style of each person as it is revealed by their offices and clothing.
What will be an ideal response?
A document can be closed by clicking the Close icon in its Thumbnail on the taskbar
Indicate whether the statement is true or false