heeap implemented in C++