c++ - Recursive largestS integers -
int* m = new int [d1*d2];
this array.
( j = 0; j < d2; j++ ) { ( = j; < d1*d2; +=d2){ cout << *(m+i); } cout << endl; }
and using can group , print largest integer in each column if think multidimensional array.
hard explain want do. i'll try giving example.
assume input 1 4 2 5 2 1 0 3 4
output
1 5 0 4 2 3 2 1 4
i want largest integer , keep listing following largest integers behind of integer.
for first row want 5, 0
for second row want 4 , 3.
for third row want 4.
output be:
5, 0, 4, 3, 4
if a[]
contains row, looks want is:
int = column_count - 1; deque<int> largests_list; largests_list.push_front(a[i]); int largest_found = a[i]; while (i-- > 0) { if (a[i] > largest_found) { largests_list.push_front(a[i]); largest_found = a[i]; } }
Comments
Post a Comment