Skip to content

Commit

Permalink
added complexity for queues
Browse files Browse the repository at this point in the history
  • Loading branch information
GauravWalia19 committed Dec 17, 2018
1 parent b0819ea commit c943734
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
14 changes: 14 additions & 0 deletions C/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@
* [Minimum bracket reversal for balanced expression](Data-Structures/STACKS/MISC-STACKS/minimum_bracket_reversal_for_balanced_expression.c)
* [Postfix Evaluation](Data-Structures/STACKS/MISC-STACKS/postfix_evaluation.c)

#### QUEUES

* SIMPLE QUEUE
* FIXED ARRAY
* DYNAMIC ARRAY
* LINKED
* CIRCULAR QUEUE
* FIXED ARRAY
* LINKED
* PRIORITY QUEUE
* FIXED ARRAY
* DYNAMIC ARRAY
* LINKED

#### HEAPS

* [1D ARRAYS USING HEAPS](Data-Structures/HEAPS/dynamicarray.c)
Expand Down
73 changes: 73 additions & 0 deletions docs/complexity.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ This page contains the complexities of different algorithms in this repository.
* C++
* [MISC STACKS](#misc-stacks)
* QUEUES
* SIMPLE QUEUE
* FIXED ARRAY SIMPLE QUEUE
* DYNAMIC ARRAY SIMPLE QUEUE
* LINKED SIMPLE QUEUE
* CIRCULAR QUEUE
* FIXED ARRAY CIRCULAR QUEUE
* LINKED CIRCULAR QUEUE
* PRIORITY QUEUE
* FIXED ARRAY PRIORITY QUEUE
* LINKED PRIORITY QUEUE
* HEAPED PRIORITY QUEUE
* HASHTABLE
* TREES
* HEAPS
Expand Down Expand Up @@ -386,6 +397,68 @@ SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of S

### QUEUES

#### SIMPLE QUEUE

##### FIXED ARRAY SIMPLE QUEUE

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Enqueue an element or Insert element | O(1) -- Constant | O(1) -- Constant
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant

##### DYNAMIC ARRAY SIMPLE QUEUE

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Enqueue an element or Insert element | O(1) -- Constant | O(log n) -- Logarthmic
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant

##### LINKED SIMPLE QUEUE

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Enqueue an element or Insert element | O(n) -- Linear | O(1) -- Constant
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant

#### CIRCULAR QUEUE

##### FIXED ARRAY CIRCULAR QUEUE

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Enqueue an element or Insert element | O(1) -- Constant | O(1) -- Constant
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant

##### LINKED CIRCULAR QUEUE

#### PRIORITY QUEUE

##### FIXED ARRAY PRIORITY QUEUE

##### LINKED PRIORITY QUEUE

SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
---- | ---------- | -------------------------------------- | ----------------------------------
1 | Insert element with priority | O(n) -- Linear | O(1) -- Constant
2 | Delete element with highest priority | O(1) -- Constant | O(1) -- Constant
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant

##### HEAPED PRIORITY QUEUE

### HASHTABLE

### TREES
Expand Down

0 comments on commit c943734

Please sign in to comment.