Data Structures: Difference between revisions

From David's Wiki
No edit summary
Line 1: Line 1:
Data Structures from CMSC420 and more.
Data Structures from CMSC420 and more.
==Lists==
==XOR Linked List==
===Skip List===
Technically a linked-list but looks like a tree if you squint.
==Hash==
Use this all the time if you don't need to iterate through the data structure in order.<br>
Probabilistic O(1) insertion.
====Linear Probing====
One way to handle collisions.
====Double hashing====
Another way to handle collisions.
====Separate chaining====
Another way to handle collisions. Each bucket is a pointer to a linked-list of values.


==Trees==
==Trees==
===Heap===
===AVL===
===AVL===
===Red-Black===
===Red-Black===
Line 10: Line 26:
Insert using BST insert and then heapify using AVL rotations.
Insert using BST insert and then heapify using AVL rotations.
===Splay Tree===
===Splay Tree===
===Skip List===
Technically a linked-list but looks like a tree if you squint.


==Spatial Data Structures==
==Spatial Data Structures==
===PM Quadtree===
===PM Quadtree===
Simple to implement. See my implementation [https://github.com/dli7319/unity-data-structures here].
===PR Quadtree===
===PR Quadtree===
===MX Quadtree===
===MX Quadtree===
===K-d Tree===
===K-d Tree===

Revision as of 03:52, 5 November 2019

Data Structures from CMSC420 and more.

Lists

XOR Linked List

Skip List

Technically a linked-list but looks like a tree if you squint.

Hash

Use this all the time if you don't need to iterate through the data structure in order.
Probabilistic O(1) insertion.

Linear Probing

One way to handle collisions.

Double hashing

Another way to handle collisions.

Separate chaining

Another way to handle collisions. Each bucket is a pointer to a linked-list of values.

Trees

Heap

AVL

Red-Black

2-3

Treap

A tree and a heap. O(logn) with high probability.

Insertion

Insert using BST insert and then heapify using AVL rotations.

Splay Tree

Spatial Data Structures

PM Quadtree

Simple to implement. See my implementation here.

PR Quadtree

MX Quadtree

K-d Tree