Logo 
Search:

C++ Programming FAQ

Submit Interview FAQ
Home » Interview FAQ » C++ ProgrammingRSS Feeds

Write an algorithm for Poping the Topmost element of stack using Singly Linked List in dfs.

  Shared By: Arnelle Schmidt    Date: Dec 24    Category: C++ Programming    Views: 1363

Answer:

PROCEDURE POP_STACK(TOP)
[Where top of the stack has been caught in pointer ‘TOP’]

1. [Removing the top node of stack]

P <-- T
T <-- LINK (T)
Call REMOVE NODE(P)
return (T).

2. [FINISH]
return.

Share: 
 


Related Topics:

Your Comment
  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].


Tagged: