Created
January 9, 2018 00:24
-
-
Save joboccara/7ff4de5262e11655b315d830f856416f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#include <iostream> | |
#include <vector> | |
#include <queue> | |
size_t leftChild(size_t index) | |
{ | |
return (index + 1) * 2 - 1; | |
} | |
size_t rightChild(size_t index) | |
{ | |
return (index + 1) * 2; | |
} | |
std::vector<int> extractSubHeap(std::vector<int> const& heap, size_t subRootIndex) | |
{ | |
return {}; | |
} | |
int main() | |
{ | |
std::vector<int> heap = {9, 8, 6, 7, 4, 5, 2, 0, 3, 1}; | |
std::vector<int> subHeap = extractSubHeap(heap, 1); | |
for (int node : subHeap) | |
{ | |
std::cout << node << ' '; | |
} | |
std::cout << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment