Data Structures and Algorithms

Data Structures and Algorithms (DSA)

Data Structures is about how data can be stored in different structures.

Algorithms is about how to solve different problems, often by searching through and manipulating data structures.

Theory about Data Structures and Algorithms (DSA) helps us to use large amounts of data to solve problems efficiently.

Data Structures together with Algorithms

Data structures and algorithms (DSA) go hand in hand. A data structure is not worth much if you cannot search through it or manipulate it efficiently using algorithms, and the algorithms in this tutorial are not worth much without a data structure to work on.

DSA is about finding efficient ways to store and retrieve data, to perform operations on data, and to solve specific problems.

By understanding DSA, you can:

  • Decide which data structure or algorithm is best for a given situation.
  • Make programs that run faster or use less memory.
  • Understand how to approach complex problems and solve them in a systematic way.

Theory and Terminology

TermDescription
Time ComplexityA measure of the amount of time an algorithm takes to run, depending on the amount of data the algorithm is working on.
Space ComplexityA measure of the amount of memory an algorithm uses, depending on the amount of data the algorithm is working on.
Big O NotationA mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity. Used in this tutorial to describe the time complexity of an algorithm.
RecursionA programming technique where a function calls itself.
Divide and ConquerA method of solving complex problems by breaking them into smaller, more manageable sub-problems, solving the sub-problems, and combining the solutions. Recursion is often used when using this method in an algorithm.
Brute ForceA simple and straight forward way an algorithm can work by simply trying all possible solutions and then choosing the best one.

Classifications of Data Structures

Classifications of Data Structures

  • Binary
  • Array
  • Matrix
  • Stack
  • Vector
  • Queue
  • Singly Linked List
  • Doubly Linked List
  • Circular Linked List
  • Map
  • Union

  • Lists
  • HashTable
  • Dictionary
  • Hashset
  • SortedList
  • SortedSet
  • Sorted Dictionary
  • ArrayList
  • ObservableCollection in C#
  • BitArray
  • Jagged arrays
  • Tuples in C#
  • Tree
  • General Tree
  • Binary Tree

Some Algorithms

Searching

  • Linear Search
  • Binary Search

Sorting

  • Bubble Sort
  • Selection Sort
  • Insertion Sort
  • Quicksort
  • Counting Sort
  • Radix Sort
  • Merge Sort

Tree Algorithms

Tree Traversal

  • Pre-order
  • In-order
  • Post-order
  • Level-order Traversal (BFS)
  • Binary Search Tree (BST)
  • Balanced Tree - AVL Tree
  • Balanced Trees - Red-Black Tree

https://www.w3schools.com/dsa/dsa_theory_trees.php (opens in a new tab)