Skip to content

Commit

Permalink
updated the complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
GauravWalia19 committed Dec 15, 2018
1 parent 3bfe7b6 commit e0d1a0a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion docs/complexity.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,22 @@ SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of S

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Push an element or Insert element | O(n) -- Constant | O(log(n)) -- Constant
1 | Push an element or Insert element | O(n) -- Linear | O(log(n)) -- Logarithmic
2 | Pop an element or Delete element | O(1) -- Constant | O(1) -- Constant
3 | Get value of top | O(1) -- Constant | O(1) -- Constant
4 | Is empty or not | O(1) -- Constant | O(1) -- Constant
5 | Printing the stack | O(n) -- Linear | O(1) -- Constant

##### LINKED STACK

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Push an element or Insert element | O(1) -- Constant | O(1) -- Constant
2 | Pop an element or Delete element | O(1) -- Constant | O(1) -- Constant
3 | Get value of top | O(1) -- Constant | O(1) -- Constant
4 | Is empty or not | O(1) -- Constant | O(1) -- Constant
5 | Printing the stack/deletestack | O(n) -- Linear | O(1) -- Constant

#### TWO WAY

##### ARRAY-STACK
Expand Down

0 comments on commit e0d1a0a

Please sign in to comment.