2,391 views
2 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 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
Position:
Show:

Related questions

1 1 vote
0 0 answers
2.7k
2.7k views
Na462 asked May 5, 2018
2,723 views
In implementation of queue using stack, deletion of second element from front take Ο(n) time, when insertion take Ο(1) time.Is it a true statement ?Well it can be true is...
3 3 votes
3 3 answers
8.5k
8.5k views
Ibtisam Sayyad asked Jan 12, 2018
8,534 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...
2 2 votes
1 1 answer
1.9k
1.9k views
Parshu gate asked Nov 11, 2017
1,860 views
Suppose Stack operations are implemented using Queue Operation. Push(x) and Pop() are stack operations whereas enqueue(x) and dequeue are Queue operations.Consider the co...
6 6 votes
2 2 answers
6.7k
6.7k views
SSrawat asked Oct 9, 2017
6,722 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 ...