Computers and Technology
Computers and Technology, 17.08.2020 01:01, Paigex3

You are given an array of integers a. A new array b is generated by rearranging the elements of a in the following way: b[0] is equal to a[0];
b[1] is equal to the last element of a;
b[2] is equal to a[1];
b[3] is equal to the second-last element of a;
and so on.
Your task is to determine whether the new array b is sorted in strictly ascending order or not.
Example
For a = [1, 3, 5, 6, 4, 2], the output should be alternatingSort(a) = true.
The new array b will look like [1, 2, 3, 4, 5, 6], which is in strictly ascending order, so the answer is true.
For a = [1, 4, 5, 6, 3], the output should be alternatingSort(a) = false.
The new array b will look like [1, 3, 4, 6, 5], which is not in strictly ascending order, so the answer is false.
Input/Output
[execution time limit] 3 seconds (java)
[input] array. integer a
The given array of integers.
Guaranteed constraints:
1 ≤ a. length ≤ 105,
-109 ≤ a[i] ≤ 109.
[output] boolean
A boolean representing whether the new array bwill be sorted in strictly ascending order or not.

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:50, AmbitiousAndProud
Representa os dados de um banco de dados como uma coleç? o de tabelas constituídas por um conjunto de atributos, que definem as propriedades ou características relevantes da entidade que representam. marque a alternativa que representa o modelo descrito no enunciado. escolha uma:
Answers: 3
image
Computers and Technology, 23.06.2019 06:30, wwesuplexcity28
To become an audio technician, the most successful tactics might include the following. (select all that apply). learning how to persuade other people gaining different types of experience in audio technology learning as much as possible about art history establishing a reputation as a reliable professional
Answers: 1
image
Computers and Technology, 23.06.2019 07:30, kimhoss2
What are ways to switch windows in excel? check all that apply. on the status bar, click the windows button, and then click the file name. on the task bar, click to display the excel jump list, and then click the file name. on the view tab, in the window group, click switch windows, and then click the file name. on the review tab, in the viewing group, click files, and then click the file name.
Answers: 1
image
Computers and Technology, 23.06.2019 11:00, abdulbasharee99
In the context of the box model, what is the difference between a margin and a padding? a. a padding lies outside a box border, while a margin lies inside it. b. a padding lies inside a box border, while a margin lies outside it. c. a padding can be adjusted independently, while a margin depends on the size of its box. d. a padding depends on the size of its box, while a margin can be adjusted independently.
Answers: 3
Do you know the correct answer?
You are given an array of integers a. A new array b is generated by rearranging the elements of a in...

Questions in other subjects:

Konu
Physics, 31.01.2020 01:03
Konu
Mathematics, 31.01.2020 01:03
Konu
Mathematics, 31.01.2020 01:03