Task1
1. You must build binary tree:
{7, 3, 5, 2, 8, 1, 6, 10, 9, 4, 11}
2. Using “bubble sort” algorithm sort the following array.
3 |
10 |
2 |
1 |
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Task2
Write the program code according to this flowchart
Task3
1. Given an array of size N and integers K and L (1≤K≤L≤N). Find the sum of array elements with indices from K to L inclusive.
2. Given an array of size N. Find two neighboring elements whose sum is maximal, and output the indices of these elements.
3. Given an array of size N. Find the indices of those elements of the array that are larger than its right neighbor, and the number of such elements. The indices found are displayed in the order of their increase.
Homework
4. Given an array of size N. Find the index of its first local minimum (the local minimum is an element that is smaller than any of its neighbors).
5. Given an array of size N. Find the number of its last local maximum (the local maximum is an element that is larger than any of its neighbors).
6. Given an array of N. Find the second maximum element of the array
Материалы на данной страницы взяты из открытых источников либо размещены пользователем в соответствии с договором-офертой сайта. Вы можете сообщить о нарушении.