What changes will need to be made to the other methods for


Problem

Consider a linked stack that includes a method size. This method size requires a loop that moves through the entire stack to count the entries, since the number of entries in the stack is not kept as a separate member in the stack record.

(a) Write a method size for a linked stack by using a loop that moves a pointer variable from node to node through the stack.

(b) Consider modifying the declaration of a linked stack to make a stack into a structure with two members, the top of the stack and a counter giving its size. What changes will need to be made to the other methods for linked stacks? Discuss the advantages and disadvantages of this modification compared to the original implementation of linked stacks.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: What changes will need to be made to the other methods for
Reference No:- TGS02642963

Expected delivery within 24 Hours