456 views
1 votes
1 votes
What is difference between $pop\left ( \right )$,$empty Stack\left ( \right )$,$delete Stack\left ( \right )$?

Can all be performed in $O\left ( 1 \right )$ time?

2 Answers

0 votes
0 votes

in practise, we use a single stack but there are many stacks linked together in single linked list manner.Every stack will have same property as the simple stack.

pop()-It means deleting and returning the top element of the stack. time complexity O(1)

deleteStack()-it is used to delete the particular stack from the list. If from beginning time complexity O(1)

emptyStack()- it is used to create a empty stack.If insert at beginning in that case time complexity O(1)

https://books.google.co.in/books?id=mgYiBAAAQBAJ&pg=PT143&lpg=PT143&dq=deletestack()&source=bl&ots=OGrC4UPlmr&sig=xMK_kEUn8asHGq89FGCs2xk8p40&hl=en&sa=X&ved=0ahUKEwi29r_y4efbAhWXbysKHS58BigQ6AEIWjAE#v=onepage&q=emptystack()&f=false

 

 

 

Related questions

2 votes
2 votes
2 answers
1
1 votes
1 votes
2 answers
2
Shamim Ahmed asked Dec 11, 2018
723 views
Every recursive program uses strictly more stack space compared to its iterative equivalent.This statement is false. Please explain with examples
2 votes
2 votes
0 answers
3
1 votes
1 votes
1 answer
4
radha gogia asked Jul 24, 2018
1,406 views
Suppose one character at a time comes as an input from a string of letters . There is an option either to 1) print the incoming letter or to 2) put the incoming letter on...