Introduction to stack

527 views
360 views

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
527
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to stack

  1. 1.        Introduction Primitive Operations Done On Stack Representation Of Stack On Array Diagram Of Stack During Push & Pop Operation Push Operation (Insertion) Pop Operation (Deletion) Applications Of Stack
  2. 2. The linear data structure linked lists and array, allows us to insert and delete elements at any place in the list,at the beginning,at the end,or in the middle. A stack is a linear structure in which assition or deletion of element takes place at the same end. This end is often called the top of stack.
  3. 3. Stacks can be also be defined as Abstract Data Types(ADT). A stack of elements of any particular type is finite sequence of elements of that type together
  4. 4. 1. 2. 3. 4. 5. 6. Intialize the stack to be empty. Determine whether stack is empty or not. Determine if stack is full or not. Is stack is not full,then add or insert a new node at one end of the stack called top. This operation is called as PUSH. If the stack is not empty ,then retrieve the node at its top. if the stack is not empty,then delete the node at its top. This is called POP operation.
  5. 5. Stacks can be represented in the memory through arrays. Using this concepts, to maintain a linear array STACK, a pointer variable Top which contains the location of top element. The maxstack gives the maximum no of element in a satck  1  Item 1 2 3 4 5 item2 MAXSTACK
  6. 6. PUSH POP A B B C C D D E F E F BC DEF
  7. 7. Push Operation: The process of adding new element to the top of the stack is called a push operation pushing of an element is nothing but just adding an element to a stack. Pop Operation: the process of deleting an element from top of the stack is called pop operation as deletion takes place from top of the stack.
  8. 8.  One of the simple applications of stack is reversal of list. As the characteristic of stacks are reversing the order of the execution.  Which can simply by pushing an individual characters and when complete line is pushed into the stack, then the individual elements of stacks are popped off.

×