Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Problem C | Problems
Sorting Algorithms
course content

Contenido del Curso

Sorting Algorithms

Sorting Algorithms

1. Simple Algorithms
2. Divide and Conquer Algorithms
3. Problems

Problem C

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 3. Capítulo 3
toggle bottom row

Problem C

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Sección 3. Capítulo 3
toggle bottom row

Problem C

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones

¿Todo estuvo claro?

Tarea

Given an array arr of integer values. Create the function isProgression() to check if it is possible to present the values of arr as arithmetic progression. It returns True or False. Call it for 3 arrays and print the results in the next order: arr1, arr2, arr3.

Example 1

Input: arr=[5, 7, 1, 3, -1]

Output: true. Rearrange elements like [-1, 1, 3, 5, 7] or [7, 5, 3, 1, -1].

Example 2

Input: arr=[2, 4, 16]

Output: false.

Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Sección 3. Capítulo 3
Cambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
We're sorry to hear that something went wrong. What happened?
some-alt