Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Element {
- int key;
- };
- void BuildHeap(Heap* heap, struct Element A[], int n, int f)
- {
- // n is set to be 12 since its the # of elements in the array A
- struct Element extra[n+1];
- extra[0].key = n;
- for(int p = 1; p <= n; p++)
- {
- extra[p] = A[p-1];
- }
- cout << "size of extra: " << sizeof(extra) << endl;
- // prints out 52 since i set 13 spaces in the array
- cout << "size of extra[0]: " << sizeof(extra[0]) << endl;
- // prints out 4 since there is only one integer held in struct
- Max_Heapify(extra, 1);
- }
- void Max_Heapify( Element Arr[], int i)
- {
- int left = LEFT(i);
- int right = RIGHT(i);
- cout << "size of array: " << sizeof(Arr) << endl;
- int largest = 0;
- int totalsize = (sizeof(Arr) / sizeof(Arr[0])) - 1;
- cout << "total size: " << totalsize << endl;
- }
Add Comment
Please, Sign In to add comment