Advertisement
Guest User

showHeap

a guest
Mar 27th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. void showHeap(int A[]) {
  2. int index=1, align=39, j=0;
  3. gotoxy(39,19);
  4. int max=calculateMax(A);
  5. for (; index<=A[0]; index++) {
  6. max=generateLength(A[p(A[index])]);
  7. if (index>=pow(2,j)) {
  8. align=align - max;
  9. gotoxy(align,wherey()+1);
  10. j++;
  11. }
  12. else
  13. if ((index>2) && (p(A[index])) != p(A[index-1]))
  14. printSpacesAfterTheText(max-generateLength(A[p(A[index])]));
  15. printf("%d",A[index]);
  16. printSpacesAfterTheText(max);
  17. }
  18. printf("\n\n\n");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement