max_heapify procedure on heap

后端 未结 5 646
無奈伤痛
無奈伤痛 2021-01-22 02:27

i have these procedure

#include 
using namespace std;

int parent(int i ){
    return  i/2;
}

int left(int i ){
    return  2*i;
}

int right(i         


        
5条回答
  •  攒了一身酷
    2021-01-22 03:28

    You don't have a base case to terminate the recursion, so I imagine you're eventually getting a stack overflow. Think about when you can tell that you're done so you can gracefully fall out of the function.

提交回复
热议问题