Created
January 11, 2018 00:51
-
-
Save nerohoop/8d1eee4eba9901a6c7de24a5dd7a3f0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool BinaryHeap::isArrayHeap(int *arr, int size) { | |
for (int i=0; i<(size-2)/2; i++) { | |
if(2* arr[2*i+1] > arr[i]) return false; | |
if(arr[2*i+2] > arr[i]) return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment