1,425 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.

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

Related questions

3 votes
3 votes
3 answers
2
Ibtisam Sayyad asked Jan 12, 2018
7,927 views
What are the minimum enqueue and dequeue operations needed to perform pop operation for a stack which is implemented with two queues if there are already 10 elements in t...
6 votes
6 votes
2 answers
4
SSrawat asked Oct 9, 2017
6,020 views
A queue is implemented using 2 stacks. Minimum no. of stack operations (PUSH and POP) required for the sequence of 3 insertions and 2 delete operations in the queue is ...