Implementation of stack using linked lists, Data Structure & Algorithms

In the last subsection, we have implemented a stack by using an array. While a stack is implemented by using arrays, it suffers from the basic restriction of an array - i.e., its size cannot be increased or decreased once it is declared. Consequently, one ends up reserving either too much space or too less space for an array and in turn for a stack. This difficulty can be conquering if we implement a stack using a linked list. In the case of a linked stack, we will push and pop nodes from one end of any linked list.

The stack, as linked list is represented as a singly linked list. In the linked list each node contains the data & a pointer which gives location of the next node in the list. Program 2 implements a stack by using linked lists.

Posted Date: 4/10/2013 1:05:29 AM | Location : United States







Related Discussions:- Implementation of stack using linked lists, Assignment Help, Ask Question on Implementation of stack using linked lists, Get Answer, Expert's Help, Implementation of stack using linked lists Discussions

Write discussion on Implementation of stack using linked lists
Your posts are moderated
Related Questions
How do you rotate a Binary Tree?  Rotations in the tree: If after inserting a node in a Binary search tree, the balancing factor (height of left subtree - height of right

A useful tool which is used for specifying the logical properties of a data type is called the abstract data type or ADT. The term "abstract data type" refers to the fundamental ma

In this sorting algorithm, multiple swapping occurs in one pass. Smaller elements move or 'bubble' up to the top of the list, so the name given to the algorithm. In this method,

Document processing is quickly becoming one of the dominant functions of computers. Computers are utilized to edit, search & transport documents over the Internet, and to display d

As we have seen, as the traversal mechanisms were intrinsically recursive, the implementation was also easy through a recursive procedure. Though, in the case of a non-recursive me

This is a unit of which targeted on the emerging data structures. Red- Black trees, Splay trees, AA-trees & Treaps are introduced. The learner must explore the possibilities of app

Define Merge Sort  Merge sort is a perfect example of a successful application of the divide and conquer method. It sorts a given array A[0...n-l] by separating it into two ha

Program: Creation of a linked list In the next example, wewill look to the process of addition of new nodes to the list with the function create_list(). #include #includ

Determination of Time Complexity The RAM Model The random access model (RAM) of computation was devised through John von Neumann to study algorithms. In computer science,

What is the difference between a grounded header link list and a circular header link list? A header linked list is a linked list which always having a special node, known as t