KEMBAR78
Link List STACK and Queue USING LINKED LIST | PPTX
STACK USING LINKED LIST
PUSH
30
STACK USING LINKED LIST
POP
31
STACK USING LINKED LIST
ALGORITHM FOR PUSH OPERATION
1. Input the VALUE to be pushed
2. Creat a New Node
3. NewNode → DATA = VALUE
4. NewNode → Next = TOP
5. TOP = NewNode
6. Exit
32
STACK USING LINKED LIST
• ALGORITHM FOR POP OPERATION
1. if (TOP is equal to NULL)
Display "The stack is
empty"
2. Else
(a) TEMP = TOP
(b) Display "The popped
element TOP → DATA"
(c) TOP = TOP → Next
(d) Free the TEMP node
3. Exit
33
34
QUEUE USING LINKED LIST
ADD to queue
QUEUE USING LINKED LIST
REMOVE from queue
35

Link List STACK and Queue USING LINKED LIST

  • 1.
    STACK USING LINKEDLIST PUSH 30
  • 2.
    STACK USING LINKEDLIST POP 31
  • 3.
    STACK USING LINKEDLIST ALGORITHM FOR PUSH OPERATION 1. Input the VALUE to be pushed 2. Creat a New Node 3. NewNode → DATA = VALUE 4. NewNode → Next = TOP 5. TOP = NewNode 6. Exit 32
  • 4.
    STACK USING LINKEDLIST • ALGORITHM FOR POP OPERATION 1. if (TOP is equal to NULL) Display "The stack is empty" 2. Else (a) TEMP = TOP (b) Display "The popped element TOP → DATA" (c) TOP = TOP → Next (d) Free the TEMP node 3. Exit 33
  • 5.
    34 QUEUE USING LINKEDLIST ADD to queue
  • 6.
    QUEUE USING LINKEDLIST REMOVE from queue 35