Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Sqrt(n) | Problems
Binary Search in Python
course content

Conteúdo do Curso

Binary Search in Python

Binary Search in Python

1. Binary Search
2. Problems

book
Sqrt(n)

In this section, we will practice with the BS algorithm.

The first task will be to find the square root of the number.

Look at the explanation of the task! How does it work?

Use hints if needed! Be careful with the tabulation!

Let's practice!

Tarefa

Swipe to start coding

  1. Set condition if the x equals 0 or 1.
  2. Set the while loop to work while the left is lower or equals the right.
  3. Set condition if the square of the middle elements equals x.
  4. Set condition if the square of the middle elements is lower than x.
  5. Update the left. The left equals the middle + 1.
  6. Update the result. The result equals the middle.
  7. Update the right. The right equals the middle - 1.
  8. Test the function.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 1
toggle bottom row

book
Sqrt(n)

In this section, we will practice with the BS algorithm.

The first task will be to find the square root of the number.

Look at the explanation of the task! How does it work?

Use hints if needed! Be careful with the tabulation!

Let's practice!

Tarefa

Swipe to start coding

  1. Set condition if the x equals 0 or 1.
  2. Set the while loop to work while the left is lower or equals the right.
  3. Set condition if the square of the middle elements equals x.
  4. Set condition if the square of the middle elements is lower than x.
  5. Update the left. The left equals the middle + 1.
  6. Update the result. The result equals the middle.
  7. Update the right. The right equals the middle - 1.
  8. Test the function.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 1
Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Sentimos muito que algo saiu errado. O que aconteceu?
some-alt