in Programming in C
1,416 views
2 votes
2 votes

true/false ?

  1. ) if stack is implemented as a array,all operation push ,pop ,is emptystack(),delete stack() can be performed in constant time.
  2. )if stack is implemented as a linked list ,all operation ,is emptystack(),delete stack() can be performed in constant time.
in Programming in C
1.4k views

4 Comments

ok thank now in the first option you said  

delete stack() -> I think it can be done by ignore data in the array and override. If this is true then 1st statement is TRUE

what about this logic ?

after watching the answer

0
0
This we can manage right... We will have the index till  top of the stack so we can restrict ourselves by not going beyond that index for read access. And for write if we go we will overwrite with new value
0
0
edited by
1st is True

2nd is False

 

becuse when we apply Delete Stack in case of linked list we need to delete all the element which take O(n) time if there is “n” element ,

but in case of array if  we want to delete a Stack we just overwrite from begining .
0
0

2 Answers

0 votes
0 votes
1st is True

2nd is False
because when we apply Delete Stack in case of the linked list we need to delete all the element which take O(n) time if there is “n” element but in case of array we just overwrite from beginning when we want to delete a Stack

Correct me if i am wrong
edited by
0 votes
0 votes
true and false.….……...

Related questions