SE: Data Structure

A data structure is a way of organizing, storing, and managing data in a computer so that it can be accessed and modified efficiently.

A data structure is a way of organizing, storing, and managing data in a computer so that it can be accessed and modified efficiently.

Different data structures are suited for different kinds of tasks.

Arrays

A collection of elements, identified by index or key.

Linked Lists:

A collection of elements where each element points to the next, forming a chain.

  • Singly Linked List: Each node points to the next.
  • Doubly Linked List: Each node points to both the next and previous nodes.

Stacks

A data structure where elements follow a Last In First Out (LIFO) principle.

Queues

A First In First Out (FIFO) data structure.

Hash Tables

A data structure that stores data in an associative manner, where a key is mapped to a value.

Trees

A hierarchical data structure made up of nodes, where each node has a value and children nodes.

  • Binary Tree: Each node has at most two children.
  • Binary Search Tree (BST): A binary tree with a special condition that left children are smaller than the node, and right children are larger.
  • Heaps: A special tree-based data structure that satisfies the heap property (either max-heap or min-heap).
  • Graphs: A collection of nodes (vertices) connected by edges. Can be directed or undirected.