Sitemap
Data Structures and Algorithms

Basic Data Structures and Algorithms every software engineer should know

Member-only story

Basic Algorithms You Need to Know

--

  • This article covers the algorithms topics which is important to ace a data structure and algorithms interview.
  • Main material of this article is: G4G.
  • The code snippets are written in C/C++.

Table of Contents

  • Analysis of Algorithms
  • Recursion
  • Searching
  • Sorting
  • Dynamic Programming
  • Greedy Algorithms
  • Bit Algorithms

Analysis of Algorithms

Asymptotic Notations

  • Big O Notation (Upper bound, worst case):
T(N) = O(f(N)) if there are positive constants c and n0 such that T(N) ≤ cf(N) when N ≥ n0.
e.g. T(N) = N^2, f(N) = N^3, f(N) = N^2
  • Ω Notation (Lower bound, best case):
T(N) = Ω(g(N)) if there are positive constants c and n0 such that T(N) ≥ cg(N) when N ≥ n0.
e.g: T(N) = N^3, g(N) = N^3, g(N) = N^2
  • Θ Notation:
T(N) = Θ(h(N)) if and only if T(N) = O(h(N)) and T(N) = Ω(h(N)).
e.g. T(N) = N^3, h(N) = N^3
  • Small o Notation:
T(N) = o(p(N)) if, for all positive constants c, there exists an n0 such that T(N) < cp(N) when N > n0. Less formally, T(N) = o(p(N)) if T(N) = O(p(N)) and T(N) ̸= Θ(p(N)).
e.g. T(N) = N^2, f(N) = N^3

--

--

Larry | Peng Yang
Larry | Peng Yang

Written by Larry | Peng Yang

Software Engineer in Tokyo. Aim to understand computer science very well. www.buymeacoffee.com/yangpeng. www.linkedin.com/in/yangpeng-tech.

Data Structures and Algorithms
Data Structures and Algorithms

Published in Data Structures and Algorithms

Basic Data Structures and Algorithms every software engineer should know