Skip to content

KITSCTCLab/exercise-6-a-linked-list-implementation-of-stack-URK21CO2013

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Problem

Implement Stack using Linked list. To implement a stack using the singly linked list concept, all the singly linked list operations are performed based on Stack operations LIFO(last in first out).
Assume all nodes in the linked list are 0-indexed.

ds-linked-list-implementation-stack2

Implement the Stack class:

push(data) : Add data to the stack and adjust the head pointing to top.
pop() : Remove data from the stack and adjust the head pointing to top.
status() : Display the elements of stack.

Constraints

Data should be integer value.

Sample Input - 1

push, push, push, push
1, 2, 3, 4

Sample Output - 1

4=>3=>2=>1=>None

Sample Input - 2

push, pop, push, pop
10, -, 20, -

Sample Output - 2

None

Sample Input - 3

push, push, push, pop, pop, pop, pop, pop, push
1, 2, 3, -, -, -, -, -, 10

Sample Output - 3

10=>None

About

exercise-6-a-linked-list-implementation-of-stack-URK21CO2013 created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages