Skip to content

[WIP] The repository for revising and practicing data structures and algorithms. [TODO] move to practice with python

Notifications You must be signed in to change notification settings

quang-pham-dev/ds-a

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Structures and Algorithms

1. Data Structures

Data structures are ways of organizing and storing data so that it can be accessed and modified efficiently. Here are some common data structures:

  • Array: A collection of elements of the same type stored in contiguous memory locations. Example: [1, 2, 3, 4].
  • Linked List: A sequence of elements where each element (node) contains a value and a reference to the next node.
  • Stack: A data structure that follows the Last In, First Out (LIFO) principle. Example: managing function calls.
  • Queue: A data structure that follows the First In, First Out (FIFO) principle. Example: processing tasks in order of arrival.
  • Hash Table: A data structure that stores data in key-value pairs, allowing for fast data retrieval based on a key.
  • Tree: A hierarchical data structure with a root node and child nodes. Examples include binary trees and binary search trees.
  • Graph: A collection of nodes (vertices) and edges connecting pairs of nodes.

Additional Data Structures

  • Binary Search Trees
  • Heaps
  • Tries
  • Union Find

2. Algorithms

Algorithms are step-by-step procedures or formulas for solving problems. Here are some common algorithms:

  • Sorting Algorithms: Techniques for arranging data in a particular order. Examples include Quick Sort, Merge Sort, and Bubble Sort.
  • Searching Algorithms: Techniques for finding specific data. Examples include Binary Search and Linear Search.
  • Graph Algorithms: Techniques for working with graphs, such as Dijkstra's Algorithm for finding the shortest path.

Additional Algorithms

  • Bit Manipulation
  • Tree Traversal (InOrder, PreOrder, PostOrder)
  • Depth First Search
  • Breadth First Search
  • Topological Sort
  • Minimum Spanning Tree
  • Recursion
  • Dynamic Programming
  • Greedy Algorithms
  • Backtracking

3. Complexity Analysis

Complexity analysis helps evaluate the efficiency of an algorithm in terms of time and space.

Time Complexity

Measures the amount of time an algorithm takes to complete, often expressed using Big O notation (O-notation). Common time complexities include:

  • O(1): Constant time
  • O(n): Linear time
  • O(log n): Logarithmic time
  • O(n^2): Quadratic time

Space Complexity

Measures the amount of memory an algorithm requires. Also expressed using Big O notation.

Examples

  1. Searching in an Array:

    • Linear Search: O(n)
    • Binary Search: O(log n)
  2. Sorting an Array:

    • Bubble Sort: O(n^2)
    • Merge Sort: O(n log n)

Problem Solving Techniques

  • Two Pointers
  • Sliding Window
  • Prefix Sum
  • Fast and Slow Pointers
  • Divide and Conquer
  • Greedy
  • Recursion
  • Backtracking
  • Dynamic Programming
  • Top 'K' Elements

Key Concepts

  • Big O Notation
  • Time Complexity
  • Space Complexity

About

[WIP] The repository for revising and practicing data structures and algorithms. [TODO] move to practice with python

Topics

Resources

Stars

Watchers

Forks