Data Structure: Heap

Summary

Data Structure NameHeap
TypeLinear Data Structure
Tagline
Use cases
Types
ImplementationsRust

Definition

Heap is a tree-based data structure. The specialty of the heap is in the ordering of the nodes.

In a heap the parent node is smaller than the child nodes(in case of min heap) or the parent is larger than the child nodes(in case of max heap).

Heap Overview
Heap Overview

NOTE

There is no rule for the nodes. There are no ordering guarantees between the siblings.
Binary Heap is very compact, as all nodes are as full as they can be.
The left node is filled first.

Types

Heaps can be of 2 types-

Min Heap– The parent node is always smaller than the children.
Max Heap– the parent node is always larger than the child nodes.

Use Cases

When we have a long data list, and we don’t need random access to an element, then we should use a linked list.

NOTE

Characteristics

Elements

A Heap data structure has the following info-

  • Vertice(node)
  • Arc(edge)

NOTES

Functionality

Code Implementations

Use the following links to check Heap data structure implementation in specific programming languages.

Rust

Leave a Comment


The reCAPTCHA verification period has expired. Please reload the page.