• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
September 20, 2023 |150 Views
SDE Sheet - Implement Stack using Linked List
  Share   Like
Description
Discussion

This video is a part of Linked List section under GFG SDE Sheet.

In this video, you have a linked list and you have to implement the functionalities push and pop of stack using this given linked list. Your task is to use the class as shown in the comments in the code editor and complete the functions push() and pop() to implement a stack.

Example :

Input: 
push(2)
push(3)
pop()
push(4) 
pop()

Output: 3 4

Explanation: 
push(2)    the stack will be {2}
push(3)    the stack will be {2 3}
pop()      poped element will be 3,
          the stack will be {2}
push(4)    the stack will be {2 4}
pop()      poped element will be 4

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article: https://www.geeksforgeeks.org/implement-a-stack-using-singly-Linked-list/
Problem: https://practice.geeksforgeeks.org/problems/implement-stack-using-linked-list/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More