Skip to content

Heap code and test file added #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Heap readme file add
  • Loading branch information
shaonty authored and shaonty committed Mar 25, 2018
commit 24f5dbf8b8f9905d1727088c21fa3e273d1a6bdc
15 changes: 8 additions & 7 deletions Data Structure/Heap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
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:

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.

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.

![heap](max_heap_deletion_animation.gif)

**Basic Operations:**

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


#### Complexity Analysis
Algorithm Average Worst case
Space O(n) O(n)
Search O(n) O(n)
Insert O(1) O(log n)
Delete O(log n) O(log n)
Peek O(1) O(1)

- Space - O(n)
- Search - O(n)
- Insertion - O(1)
- Delete - O(log n) (Deletion from beginning)
- Peek - O(1)
### More on this topic
- https://en.wikipedia.org/wiki/Heap_(data_structure)
- https://www.hackerearth.com/practice/data-structures/trees/heapspriority-queues/tutorial/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.