Course Data Structures Essentials

Computational Complexity

Course's Page 27 min Text by
User Image
Caique Paiva

Hello! Welcome to the first theoretical class of the Data Structures course ๐Ÿ˜„

In this class, you will learn how to analyze the complexity (speed) of your code. This class is divided into 3 parts, which are:

  • What is complexity analysis;
  • Big-O notation;
  • Complexity groups.

So, without further ado, let's get started!

Introduction

To introduce computational complexity, let's understand why we need it. For this, let's look at the Tower problem. Think about it a bit before proceeding with the class.

A possible solution is to calculate for each cell , its value, which will be the sum of the row and column it is in, excluding the cell . Let's see how the code will look:

#include<iostream>

using namespace std;