Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content

Table of Contents

What is Big-O?

What is time complexity?

What is space complexity?

Examples of time complexity

Example algorithms and their time complexities

  1. Linear search - O(n)
  1. Binary search - O(log n)
  1. Bubble sort - O(n^2)
  1. Quick Sort - O(nlog n) on average, O(n^2) worst case
  1. Fibonacci sequence - O(2^n)

Example algorithms and their space complexities

  1. Linear search - O(1)
  1. Fibonacci sequence - O(n)
  1. Merge sort - O(n)
  1. Quick Sort - O(log n) or O(n)
  1. Create Matrix - O(n²)