• recategorized by
972 views

1 Answer

0 0 votes

Basic Operations of stack -:push and Pop takes constant time $\Omega \left ( 1 \right )$,But searching an element will take $O\left ( n \right )$ as in the worst case you may have to pop 'n' element to get the key if the key is present at the bottom of stack.

Note -:Searching is not basic operation of stack.

Position:
Show:

Related questions

9 9 votes
2 2 answers
391
391 views
GO Classes asked Jul 27
391 views
Given a stack $S$ with $5$ elements from top to bottom as:$2, 4, 6, 8, 10$and an empty queue $Q$.First, remove the elements one by one from $S$ and insert them into $Q$.T...
7 7 votes
1 1 answer
456
456 views
GO Classes asked Jul 27
456 views
Which of the following statements are true?$\text{S1.}$ Stack operations $\texttt{push}$, $\texttt{pop}$, and $\texttt{isEmpty}$ can be worst-case $O(1)$ for a linked-lis...
7 7 votes
1 1 answer
304
304 views
GO Classes asked Jul 10
304 views
Assume there are $n$ elements in the data structure. Consider the following statements:$\text{S1}:$ A stack can be implemented using a linked list such that each individu...
5 5 votes
2 2 answers
243
243 views
GO Classes asked Jul 9
243 views
A stack is used to check whether parentheses, braces, and brackets are properly balanced.Consider the following two inputs:Input $1: \texttt{[()]\{\}\{[()()]()\}}$Input $...