Data structure cheat sheet: Difference between revisions

From Celeste@Hoppinglife
Jump to navigation Jump to search
Line 19: Line 19:
=== Heap ===
=== Heap ===


A (binary) heap is a complete binary tree that keeps a sepcific condition of its nodes: For a max-heap, <math>A[parent[i]] >= A[i]</math>, for a min-heap, <math>A[parent[i]] <= A[i]</math>.
A (binary) heap is a complete binary tree that keeps a sepcific condition of its nodes: For a max-heap, <math>A[parent[i]] >= A[i]</math>, for a min-heap, <math>A[parent[i]] <= A[i]</math>. A heap can be used to maintain a priority queue.
 
==== Heapify ====
 
<syntaxhighlight>
heapify(A)
</syntaxhighlight>


=== n-ary Tree ===
=== n-ary Tree ===

Revision as of 03:08, 25 October 2020

A quick cheat sheet on common algorithms and data structures:

Linear Structures

Linked Lists

Basic Implementation

String

Related Algorithms

Arrays

Sorting

Tree-based Structures

Binary Tree

Property

Traversal

Heap

A (binary) heap is a complete binary tree that keeps a sepcific condition of its nodes: For a max-heap, A[parent[i]]>=A[i], for a min-heap, A[parent[i]]<=A[i]. A heap can be used to maintain a priority queue.

Heapify

heapify(A)

n-ary Tree

Union Find

Hashing Table

Graphs

Storage

Traverse

Properties

Algorithms

Dynamic Programming

Recursion

Searching