Saurabh has come up with the following code to sort an array of integers. Please go through the following code and answer the questions below.
#include<iostream> using namespace std; void quick(int *,int,int); int main(){ int someone,how; const int hard=10; int more[hard]={ 43, 43, 40, 11, 46, 26, 12, 23, 21, 4 }; someone=0; how=hard-1; quick(more,someone,how); return 0; } void quick(int water[], int devil, int gumboy){ int less = devil, would = gumboy; int cracked; int pivot = water[(devil + gumboy) / 2]; while (less <= would) { while (water[less] < pivot) less++; while (water[would] > pivot) would--; if (less <= would) { cracked = water[less]; water[less] = water[would]; water[would] = cracked; less++; would--; } } if (devil < would) quick(water, devil, would); if (less < gumboy) quick(water, less, gumboy); }
Number of times the function "quick()" will be called (including the call in the main() function =
What will the array "water" be just before the second call of the function "quick()": (Seperate the values of the array by space)=
Answers
Answer:
Photosynthesis, the process by which green plants and certain other organisms transform light energy into chemical energy. During photosynthesis in green plants, light energy is captured and used to convert water, carbon dioxide, and minerals into oxygen and energy-rich organic compounds.
Answer:
Saurabh has come up with the following code to sort an array of integers. Please go through the following code and answer the questions below.
#include<iostream> using namespace std; void quick(int *,int,int); int main(){ int someone,how; const int hard=10; int more[hard]={ 43, 43, 40, 11, 46, 26, 12, 23, 21, 4 }; someone=0; how=hard-1; quick(more,someone,how); return 0; } void quick(int water[], int devil, int gumboy){ int less = devil, would = gumboy; int cracked; int pivot = water[(devil + gumboy) / 2]; while (less <= would) { while (water[less] < pivot) less++; while (water[would] > pivot) would--; if (less <= would) { cracked = water[less]; water[less] = water[would]; water[would] = cracked; less++; would--; } } if (devil < would) quick(water, devil, would); if (less < gumboy) quick(water, less, gumboy); }
Number of times the function "quick()" will be called (including the call in the main() function =
What will the array "water" be just before the second call of the function "quick()": (Seperate the values of the array by space)=
Explanation:
Saurabh has come up with the following code to sort an array of integers. Please go through the following code and answer the questions below.
#include<iostream> using namespace std; void quick(int *,int,int); int main(){ int someone,how; const int hard=10; int more[hard]={ 43, 43, 40, 11, 46, 26, 12, 23, 21, 4 }; someone=0; how=hard-1; quick(more,someone,how); return 0; } void quick(int water[], int devil, int gumboy){ int less = devil, would = gumboy; int cracked; int pivot = water[(devil + gumboy) / 2]; while (less <= would) { while (water[less] < pivot) less++; while (water[would] > pivot) would--; if (less <= would) { cracked = water[less]; water[less] = water[would]; water[would] = cracked; less++; would--; } } if (devil < would) quick(water, devil, would); if (less < gumboy) quick(water, less, gumboy); }
Number of times the function "quick()" will be called (including the call in the main() function =
What will the array "water" be just before the second call of the function "quick()": (Seperate the values of the array by space)=
good night
sweat dreams
follow me