answersLogoWhite

0


Best Answer

A Linked-List is basically a series of Nodes. Each Node contains two things: The contents, and the pointer to the next Node in the Linked-List. So you can traverse the Linked-List by following the "next" pointers in each Node, a bit like following road directions from city to city.

A stack is an abstract data type where you have two operations: "push" and "pop". Pushing means to put an item in the stack, Popping means to get the first element of the stack. When you push an item onto a stack, you put the item at the top: so its like cutting in line to the very front. The last one in is now first, and thus, the first one out. Another helpful image is a "stack" of trays at a cafeteria -- you can only get the tray from the top of the stack, or put a tray on top of the stack. The very first tray in the stack is actually the one at the very bottom, and thus, the last one to be used. "First in, Last Out."

A stack deals with what comes first/last, while a Linked-List describes how data is stored. A stack needs to store data, so a stack can be implemented as a Linked-List.

User Avatar

Wiki User

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

Wiki User

8y ago

Stacks don't have to be implemented using linked lists. A stack can also be implemented using an array which makes better use of memory. Linked lists have the advantage in that they can grow and shrink dynamically which can often improve stack performance. To achieve similar performance with an array you must allocate more memory than is required each time the array grows, typically by doubling the size of the allocation.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

The stack is a memory structure where your programs can store data. The stack pointer is the variable that "points" to the current location of the top of the stack.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why stack is implemented by link list?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the front of the stack in a stacked linked list?

The top of a stack implemented as a linked list is the head of the list. All insertions and extractions occur at the head thus a forward list (singly-linked list) is sufficient to implement a stack.


How do you copy all the elements from a given stack implemented in a linked list to a new one and returns the pointer to the new stack?

LIFO


How do you implement stack without array?

Stacks are often implemented using the same node structure as a linked list.


How do you use push operation in stack give the exampale of the program?

A stack can be implemented as an array or a list. If an array, simply push the new element onto the end of the array. If a list, point the new node at the head node then make the new node the new head of the list.


Why BFS is implemented using queue and DFS is implemented using stack?

yes pagal


How does a linked list differ from stack and queue?

A linked list is a data structure that allows bi-directional traversal with constant-time access to both the head and the tail of the list. Elements may be pushed and popped from anywhere in the list. A stack is a structure where elements are pushed and popped only at the head of the stack. A stack is typically implemented using an array (either fixed-length or variable-length) where elements are pushed and popped from the end of the array (you need to keep track of where the last-used element is). However, a stack can also be implemented as a singly-linked list, pushing and popping at the head of the list. Stacks generally do not allow traversal of the elements.


What is hardware stack and software stack?

A hardware stack refers to the physical components of a computer system, typically arranged in layers. It includes the processor, memory (RAM), storage (hard drive or SSD), and input/output devices (keyboard, mouse, monitor, etc.).


Stack example in c using push and pop?

http://www.osix.net/modules/article/?id=275muzzy writes "Here's some code for you kids. It demonstrates the concept of stack, implemented with a linked list mechanism to support virtually infinitely large stack sizes. Happy reading."/* Simple Dynamically Allocating Stack Implementation in C** Copyright (C) 2002 Muzzy of Worst Coders*/


Is it possible to implement stack and queues using linkes list?

Yes it is possible to implement stack and queue using linked list


What are the different between stack and queue?

A stack is generally First In, Last Out, and a queue is First In First Out.Item can be added or removed only at one end in stack and in a queue insertion at the rear and deletion from the front.The basic operation of stack are 'push' and 'pop', on other hand of queue are 'enque' and 'dequeue'.


What is the Data structures used for stack?

A stack is a linear last-in first-out list type data structure. Several implementations are possible. Two examples are the array and the linked list. The array is quick, but is limited in size. The linked list requires overhead to allocate, link, unlink, and deallocate, but (except for total available memory) is not limited in size. One compromise might be a linked list of arrays. Another compromise might be to not necessarily unlink and delete when an element is popped off the stack.


Can a linked list implemented using an array be accessed by giving the location?

A linked list implemented with an array defeats the purpose of using a linked list, which is to address the memory allocation problems associated with arrays.