answersLogoWhite

0


Best Answer

One way to emulate a stack with a data structure is with a singly linked list wherein you can only add and remove nodes from the head or tail of the list (depending on implementation). An easy and straightforward application of this type of data structure would be a reverse polish notation calculator where values can be pushed onto the data structure and then popped when one comes across an arithmetic symbol.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Stacks provide an automatic means of backtracking because variables are popped from the stack in the reverse order they were pushed onto the stack. Thus you can always find your way back to a given state. Every thread in a process has its own built-in stack, making it possible for functions to know from where they were called and thus return control to their callers. The callers simply push the return address onto the stack before passing control to the callee. The return address stays on the stack until the callee is ready to return control to the caller. Thus functions can call functions (including recursive calls to themselves) without losing track of where each individual call came from. The stack essentially provides a "breadcrumb trail". The stack is also used to store a function's local arguments since these only need to remain in memory when the function is actually invoked (they will fall from scope as soon as the function returns). Callers can also pass arguments to functions by pushing them onto the stack immediately after the return address. The stack can also be used to store a function's exception handlers, so when an exception occurs, the stack can automatically "unwind" back through the return addresses to locate a suitable handler.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

stack is data structure used to store the continues block memory and operations insertion,deletion takes place at only at one end called TOP.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

'Cos' it is one-dimensional.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is a stack data explain with example in data structure?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Explain The merits of using a deque to implement a stack in data structure?

Explain The merits of using a deque to implement a stack in data structure


Can stack be called fifo data structure?

No. A stack is a LIFO (Last In First Out) data structure.A queue is a FIFO (First In First Out) data structure.


What is the resource requirement of stack in a data structure?

no answer


Which type of data structure is used in ATM to take the printout of last 5 transactions?

stack data structure.


What is a stack in data structure?

A stack is a linear data structure that follows the Last In, First Out (LIFO) principle, where elements are added and removed from the same end called the top. Elements can only be added or removed from the top of the stack, making it a simple and efficient data structure for storing and accessing data.


What is the difference between a queue and a stack with example?

A stack is a data structure in which last item inserted is taken out first . That's why they are known as LIFO (last in first out). Inserting an item in stack is termed as push and taking an item out from stack I s termed as pop. Stack pointer is the pointer that points to the top of the stack or that points the item at the top of the stack and help in adding or deleting the item from the top of stack. The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. types of queues : circular, linear, double ended and priority


How do you determine symmetry of a data structure For example how do you know if a Stack or a queue or a priority queue or a double ended queue are symmetric?

You can determine symmetry of a data structure in two ways. One is when the stacks and queues data are put in the application and when the stacks are put in during run-time.


How can you add different type of data in a stack?

stack is a linear data structure in which data item is either inserted or deleted at one end there are mainly two operations performed on stack.they're push poppush:writing a value to the stack is push or moving the stack pointer up to accomodatethe new item. pop:reading a value from stack or moving the stack pointer down.


What is forest in data structure explain?

forest


Which data structure is needed to convert infix notations to post fix notations?

stack is the basic data structure needed to convert infix notation to postfix


Is stack a physical data structure?

Traditional implementations of stacks, particularly those implemented in hardware, are generally physical data structures. That is, the data structure dictates how elements are arranged in memory.Modern software implementations take a more abstract approach however. Characteristic for a stack is not the physical arrangement of items in memory, but the set of characteristic operations and their behavior: a simple stack can execute push operations to add an item and pop operations to remove the most recently added item. More advanced stacks support additional stack operations to manipulate implicitly addressed stack elements, for example though common operations such as dup, swap, drop.Nothing in the behavior of these stack operations dictate that the stack shall be implemented as a physical data structure; in fact many modern runtime kits use higher order data structures such as linked lists to implement stacks and other basic data structures. Such a choice would be made to support an infinite size stack, for example, and in order to base the runtime kit on the smallest number of fundamental tools in order to promote robustness.


The best data structure to check whether an arithmetic expression has balanced parentheses is a?

stack