Проблемы с поиском правильного алгоритма для получения вывода, C++, сортировкаC++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Проблемы с поиском правильного алгоритма для получения вывода, C++, сортировка

Сообщение Anonymous »

Question
Two friends Niya and Druva visited a math’s magic zone. They had decided to play a puzzle game that asked them to alternate the order of Negative numbers and perfect square numbers. By using a quick sort algorithm and some rearranging logic to help them do the task. Identify the approach used by them to play the game and implement a C++ program with STL libraries. Don’t use arrays and sort algorithms for this program.
Sample Input
[-1, -3, 8, 12, -4, 4, 9, -7, 19, 25, 16]
Sample Output
[-3, 16, -7, 4, -1, 9, -4, 25]

#include #include #include using namespace std; void show(const vector &arr, const string &msg = "") { cout

Источник: https://stackoverflow.com/questions/780 ... -c-sorting
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»