answersLogoWhite

0

What is time complexity of stack?

Updated: 8/11/2023
User Avatar

Wiki User

12y ago

Best Answer

All major queue operations (push, pop and front) are constant time operations.

User Avatar

Wiki User

7y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

O(1) for basic operation of popping and pushing

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

the coplexity for stack and queue

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is time complexity of stack?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is time complexity and space complexity?

"Running Time" is essentially a synonym of "Time Complexity", although the latter is the more technical term. "Running Time" is confusing, since it sounds like it could mean "the time something takes to run", whereas Time Complexity unambiguously refers to the relationship between the time and the size of the input.


What is are the time complexity or space complexity of DES algorithm?

time complexity is 2^57..and space complexity is 2^(n+1).


What is the difference between time and space complexity?

BASIC DIFFERENCES BETWEEN SPACE COMPLEXITY AND TIME COMPLEXITY SPACE COMPLEXITY: The space complexity of an algorithm is the amount of memory it requires to run to completion. the space needed by a program contains the following components: 1) Instruction space: -stores the executable version of programs and is generally fixed. 2) Data space: It contains: a) Space required by constants and simple variables.Its space is fixed. b) Space needed by fixed size stucture variables such as array and structures. c) dynamically allocated space.This space is usually variable. 3) enviorntal stack: -Needed to stores information required to reinvoke suspended processes or functions. the following data is saved on the stack - return address. -value of all local variables -value of all formal parameters in the function.. TIME COMPLEXITY: The time complexity of an algorithm is the amount of time it needs to run to completion. namely space To measure the time complexity we can count all operations performed in an algorithm and if we know the time taken for each operation then we can easily compute the total time taken by the algorithm.This time varies from system to system. Our intention is to estimate execution time of an algorithm irrespective of the computer on which it will be used. Hence identify the key operation and count such operation performed till the program completes its execution. The time complexity can be expressd as a function of a key operation performed. The space and time complexity is usually expressed in the form of function f(n),where n is the input size for a given instance of a problem being solved. f(n) helps us to predict the rate of growthof complexity that will increase as size of input to the problem increases. f(1) also helps us to predict complexity of two or more algorithms in order ro find which is more efficient.


What is the time complexity of n queens problem?

Time complexity for n-queens is O(n!).


Calculate the Time and Space complexity for the Algorithm to add 10 numbers?

The algorithm will have both a constant time complexity and a constant space complexity: O(1)


What are the two main measures for the efficiency of an algorithm?

Time complexity and space complexity.


What is time complexity of assembly line scheduling?

time complexity for Assembly line scheduling is linear.i.e O(n)


What is the difference between polynomial and non polynomial time complexity?

Polynomial vs non polynomial time complexity


What is the complexity of reverse the input string using stack?

O(n*2) for n characters. It is more efficient to simply walk from both ends of the string, swapping characters as you go, reducing the complexity to just O(n/2).


What is the time complexity of Dijkstra's algorithm?

Dijkstra's original algorithm (published in 1959) has a time-complexity of O(N*N), where N is the number of nodes.


What is the time complexity of radix sort?

If the range of numbers is 1....n and the size of numbers is k(small no.) then the time complexity will be theta n log..


What is the worst case and best case time complexity of heapsort?

The best and worst case time complexity for heapsort is O(n log n).