Skip to content

Commit c943734

Browse files
committed
added complexity for queues
1 parent b0819ea commit c943734

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

C/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838
* [Minimum bracket reversal for balanced expression](Data-Structures/STACKS/MISC-STACKS/minimum_bracket_reversal_for_balanced_expression.c)
3939
* [Postfix Evaluation](Data-Structures/STACKS/MISC-STACKS/postfix_evaluation.c)
4040

41+
#### QUEUES
42+
43+
* SIMPLE QUEUE
44+
* FIXED ARRAY
45+
* DYNAMIC ARRAY
46+
* LINKED
47+
* CIRCULAR QUEUE
48+
* FIXED ARRAY
49+
* LINKED
50+
* PRIORITY QUEUE
51+
* FIXED ARRAY
52+
* DYNAMIC ARRAY
53+
* LINKED
54+
4155
#### HEAPS
4256

4357
* [1D ARRAYS USING HEAPS](Data-Structures/HEAPS/dynamicarray.c)

docs/complexity.md

+73
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,17 @@ This page contains the complexities of different algorithms in this repository.
8686
* C++
8787
* [MISC STACKS](#misc-stacks)
8888
* QUEUES
89+
* SIMPLE QUEUE
90+
* FIXED ARRAY SIMPLE QUEUE
91+
* DYNAMIC ARRAY SIMPLE QUEUE
92+
* LINKED SIMPLE QUEUE
93+
* CIRCULAR QUEUE
94+
* FIXED ARRAY CIRCULAR QUEUE
95+
* LINKED CIRCULAR QUEUE
96+
* PRIORITY QUEUE
97+
* FIXED ARRAY PRIORITY QUEUE
98+
* LINKED PRIORITY QUEUE
99+
* HEAPED PRIORITY QUEUE
89100
* HASHTABLE
90101
* TREES
91102
* HEAPS
@@ -386,6 +397,68 @@ SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of S
386397

387398
### QUEUES
388399

400+
#### SIMPLE QUEUE
401+
402+
##### FIXED ARRAY SIMPLE QUEUE
403+
404+
SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
405+
---- | ---------- | -------------------------------------- | ----------------------------------
406+
1 | Enqueue an element or Insert element | O(1) -- Constant | O(1) -- Constant
407+
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
408+
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
409+
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
410+
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant
411+
412+
##### DYNAMIC ARRAY SIMPLE QUEUE
413+
414+
SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
415+
---- | ---------- | -------------------------------------- | ----------------------------------
416+
1 | Enqueue an element or Insert element | O(1) -- Constant | O(log n) -- Logarthmic
417+
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
418+
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
419+
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
420+
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant
421+
422+
##### LINKED SIMPLE QUEUE
423+
424+
SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
425+
---- | ---------- | -------------------------------------- | ----------------------------------
426+
1 | Enqueue an element or Insert element | O(n) -- Linear | O(1) -- Constant
427+
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
428+
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
429+
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
430+
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant
431+
432+
#### CIRCULAR QUEUE
433+
434+
##### FIXED ARRAY CIRCULAR QUEUE
435+
436+
SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
437+
---- | ---------- | -------------------------------------- | ----------------------------------
438+
1 | Enqueue an element or Insert element | O(1) -- Constant | O(1) -- Constant
439+
2 | Dequeue an element or Delete element | O(1) -- Constant | O(1) -- Constant
440+
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
441+
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
442+
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant
443+
444+
##### LINKED CIRCULAR QUEUE
445+
446+
#### PRIORITY QUEUE
447+
448+
##### FIXED ARRAY PRIORITY QUEUE
449+
450+
##### LINKED PRIORITY QUEUE
451+
452+
SNo. | Operations | Order and Type of Time Complexity O(n) | Order and Type of Space Complexity
453+
---- | ---------- | -------------------------------------- | ----------------------------------
454+
1 | Insert element with priority | O(n) -- Linear | O(1) -- Constant
455+
2 | Delete element with highest priority | O(1) -- Constant | O(1) -- Constant
456+
3 | Print the queue | O(n) -- Linear | O(1) -- Constant
457+
4 | Size of the queue | O(1) -- Constant | O(1) -- Constant
458+
5 | Queue is Empty or not | O(1) -- Constant | O(1) -- Constant
459+
460+
##### HEAPED PRIORITY QUEUE
461+
389462
### HASHTABLE
390463

391464
### TREES

0 commit comments

Comments
 (0)