Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
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

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

  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.

Tarefa

  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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

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

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

  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.

Tarefa

  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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

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

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

  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.

Tarefa

  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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo

Tudo estava claro?

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

  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.

Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Seção 2. Capítulo 1
Mude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
We're sorry to hear that something went wrong. What happened?
some-alt