강의

멘토링

커뮤니티

Inflearn Community Q&A

andantej99's profile image
andantej99

asked

Jeong Hye-kyung Fantastic Data Structure in C

Lecture 34. Implementation of Heap Data Structure (create, insert)

reHeapUp while문

Written on

·

269

0

parent = child / 2;
    while (hp->heap[parent] > hp->heap[child])
    {
        tmp = hp->heap[parent];
        hp->heap[parent]=hp->heap[child] ;
        hp->heap[child] = tmp;
        child = parent;
        parent = child / 2;
    }

 

저는 이렇게 작성했는데 선생님과 답이 달라서 

이것도 가능한지 궁금해 질문드립니다!

c

Answer 1

0

lectopia1님의 프로필 이미지
lectopia1
Instructor

네에~

코드에 정답이 있는것은 아니니 같은 결과가 나온다면 모두 정답이라고 보면 될듯요~^^

andantej99's profile image
andantej99

asked

Ask a question