Data structures

A data structure is a format for organizing, managing, and storing data so that it can be efficiently accessed or modified.

Examples of data structures include:

  • Array
  • Queue
  • Stack
  • Dictionary
  • Linked list
  • Graph
  • Tree
  • Binary tree

Array

An array stores values of the same type at contiguous memory locations, allowing the indexing of individual elements.

Queue

A queue is a first in first out (FIFO) data structure.

Methods:

  • enqueue
  • dequeue

Stack

A stack is a last in first out (LIFO) data structure.

Methods:

  • push
  • pop

Linked list

A linked list is a dynamic data structure comprised of nodes pointing to other nodes.

Dictionary

A dictionary is a set of associated key/value pairs.

Graph

A graph represents data as nodes and edges.

Tree

A tree represents data as parent nodes linked to child nodes by edges.

Binary tree

A binary tree is a tree structure that adheres to the following properties:

  • The value of the left sub-tree is less than the value of its parent node
  • The value of the right sub-tree is greater than or equal to the value of its parent node