19cse212-StackLinkedListPython-CSEA


Submit solution

Points: 20 (partial)
Time limit: 5.0s
Memory limit: 12M

Author:
Problem type
Allowed languages
Python

Implement Stack using Linked List.

Input:
  • The First line of the input contains an integer N denoting the number of test cases.
  • The Second line of the input contains an integer N denoting the number of operations
  • Then for each input line of operation has the following format:

    P <element>        Insert into stack
    O                  Delete from stack
    S          Number of elements in stack
    I          Checks if stack is Empty     
    T          Returns Top element
Constraints
  • 1 <= N <= 20
Sample Input:
    1
    10
    P 1
    P 2 
    S
    O
    O
    I
    S
    T
    P 10
    S
Sample Output:
    1 
    2 1 
    2
    2
    1 
    1

    True
    0
    Stack Empty Exception
    None
    10 
    1

Comments

There are no comments at the moment.