C, ce am gresit?
1 prog merge! (HeapSortul p/t 100 numere luate RANDOM)2 prog - nivkakoi(( poate nu stiu s folosesk > ? sau gresesc la cout & cin? (Heapsort p/t tabel unidim)si cum as putea gasi eroeile in C/C++ (folosesc Microsoft Visual C++ 6.0)?//1)HeapSortul p/t 100 numere luate RANDOM#include #include #define NUM_ITEMS 100void heapSort(int numbers[], int array_size);void siftDown(int numbers[], int root, int bottom);int numbers[NUM_ITEMS];int main(){ int i; //seed random number generator srand(getpid()); //fill array with random integers for (i = 0; i = 0; i--) siftDown(numbers, i, array_size); for (i = array_size-1; i >= 1; i--) { temp = numbers[0]; numbers[0] = numbers[i]; numbers[i] = temp; siftDown(numbers, 0, i-1); }}void siftDown(int numbers[], int root, int bottom){ int done, maxChild, temp; done = 0; while ((root*2 numbers[root * 2 + 1]) maxChild = root * 2; else maxChild = root * 2 + 1; if (numbers[root] #include #include #define NUM_ITEMS 100void heapSort(int numbers[], int array_size);void siftDown(int numbers[], int root, int bottom);int numbers[NUM_ITEMS];int main(){ int i,n;cout > n;for (i=0, i> numbers[i]; //perform heap sort on array heapSort(numbers, n); printf("\n_Elementele sortate in HeapSort sunt:\n"); for (i = 0; i = 0; i--) siftDown(numbers, i, array_size); for (i = array_size-1; i >= 1; i--) { temp = numbers[0]; numbers[0] = numbers[i]; numbers[i] = temp; siftDown(numbers, 0, i-1); }}void siftDown(int numbers[], int root, int bottom){ int done, maxChild, temp; done = 0; while ((root*2 numbers[root * 2 + 1]) maxChild = root * 2; else maxChild = root * 2 + 1; if (numbers[root]