Question

In: Computer Science

Stack ADT What would you say is the most important drawback of using the stack that...

Stack ADT

What would you say is the most important drawback of using the stack that should be considered before choosing it for use in a real application? Typed out please.

Solutions

Expert Solution

Stack ADT:

The stack ADT is stack Abstract data type which is same as the implementation of stack with a small difference in the way it is implemented.

The stack follow the principle Last In First Out.

The element which is inserted at last in the stack is popped out first.

In the implementation of stack ADT, the pointer to the data is stored in each node, which means that to access the data,the pointer that is stored in the node can be used to access the data.

Drawback:

In the functionalities of the stack, there are only two basic operations that are allowed by a stack.

  • Push
  • pop

The stack is generally considered as a limited access data structure due to its limit of performing operations only on the top element of the stack.

The elements that are present below the top element are not accessible unless the top elements are popped out from stack.

consider the real time example of pushing the commands to be executed onto the stack.

Then, the command instruction that is given last by the user gets executed first while the old commands wait at the bottom of the stack.

consider a situation when we want to access the random element in a stack.We need to pop all the elements that are above the required element and then access it and push again all the popped elements back to stack.

These are the major issues and drawbacks that are associated with the stack

The better understanding of physical structure of the stack can be as shown below.


Related Solutions

Using the Stack ADT: Create a program that uses a stack. Your program should ask the...
Using the Stack ADT: Create a program that uses a stack. Your program should ask the user to input a few lines of text and then outputs strings in reverse order of entry. (Optional) Create a similar program that uses a stack. Your new program should ask the user to input a line of text and then it should print out the line of text in reverse. To do this your application should use a stack of Character. In Java...
Using a single queue (linkedQueue), re-implement the concept of Stack ADT, what is the complexity of...
Using a single queue (linkedQueue), re-implement the concept of Stack ADT, what is the complexity of the method push, pop, top, isEmpty, and size. You should not use any extra data structure. Related codes: public interface Stack<E> { int size( ); boolean isEmpty( ); void push(E e); E top( ); E pop( ); } public class LinkedStack<E> implements Stack<E> { private SinglyLinkedList<E> list = new SinglyLinkedList<>( );    public LinkedStack( ) { }    public int size( ) { return...
2. Using the Stack ADT: Create a program that uses a stack. Your program should ask...
2. Using the Stack ADT: Create a program that uses a stack. Your program should ask the user to input a few lines of text and then outputs strings in reverse order of entry. In Java please.
3.1 Implement the stack ADT using array (4 marks) 3.1.1 Implement the pop() operation in the...
3.1 Implement the stack ADT using array 3.1.1 Implement the pop() operation in the stack (1 mark) Implement a stack class named Stack2540Array using array. The starter code is as follows. The instance variables and most operations are provided. You need to implement the pop operation. Make sure that your program checks whether the stack is empty in the pop operation. import java . io .*; import java . util .*; public class Stack2540Array { int CAPACITY = 128; int...
What issues would you consider to be the most important for an organization that is considering...
What issues would you consider to be the most important for an organization that is considering implementation of a new program or tactic? How would you get everyone working together?
Based on what you have read and discussed this week, what would be the most important...
Based on what you have read and discussed this week, what would be the most important elements that you could share with a hiring manager in the limited 5 minutes she has available to talk? With this in mind, develop a script for your 5-Minute Pitch as your first professional reflection that cohesively addresses the following: After synthesizing the Discussion Board posts with this week’s resources, identify the three most important attributes—skills, behaviors, and characteristics—of effective managers and why you...
IN 150 WORDS OR MORE what type of analytics would you say your employer uses most....
IN 150 WORDS OR MORE what type of analytics would you say your employer uses most. Do you think they are overlooking anything?
Based on Chabris’ findings, would you say that genetics or environment is more important in the...
Based on Chabris’ findings, would you say that genetics or environment is more important in the determination of IQ?
What aseptic technique practices would be most important with this patient?
What aseptic technique practices would be most important with this patient?
Which part of the news media do you rely on most? Which would you say you...
Which part of the news media do you rely on most? Which would you say you trust the most? Should all news-oriented media use the same journalistic standards in determining what to broadcast or publish?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT