Skip to content

Commit 24f5dbf

Browse files
shaontyshaonty
authored andcommitted
Heap readme file add
1 parent c2d18dc commit 24f5dbf

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Data Structure/Heap/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
A **Heap** is a tree based data structure and it is a complete binary tree which satisfies the heap ordering property. The ordering can be one of two types:
44

55
the **min-heap property:** the value of each node is greater than or equal to the value of its parent, with the minimum-value element at the root.
6+
67
the **max-heap property:** the value of each node is less than or equal to the value of its parent, with the maximum-value element at the root.
78

9+
![heap](max_heap_deletion_animation.gif)
10+
811
**Basic Operations:**
912

1013
Following are the basic operations supported by a list.
@@ -19,13 +22,11 @@ Following are the basic operations supported by a list.
1922

2023

2124
#### Complexity Analysis
22-
Algorithm Average Worst case
23-
Space O(n) O(n)
24-
Search O(n) O(n)
25-
Insert O(1) O(log n)
26-
Delete O(log n) O(log n)
27-
Peek O(1) O(1)
28-
25+
- Space - O(n)
26+
- Search - O(n)
27+
- Insertion - O(1)
28+
- Delete - O(log n) (Deletion from beginning)
29+
- Peek - O(1)
2930
### More on this topic
3031
- https://en.wikipedia.org/wiki/Heap_(data_structure)
3132
- https://www.hackerearth.com/practice/data-structures/trees/heapspriority-queues/tutorial/
Loading

0 commit comments

Comments
 (0)