Cộng đồng Hỏi & Đáp của Inflearn
else if 질문 있습니다.
Đã giải quyết
Viết
·
369
1
힙 삽입에서
getInsertingParent(){
if(this.lastInsertedNode.getParent() == null){
return this.lastInsertedNode;
}else{
if(this.lastInsertedNode == this.lastInsertedNode.getParent().getLeftSubTree()){
return this.lastInsertedNode.getParent();
}else{
let current = this.lastInsertedNode;
let firstRightSibling = null;
while(current.getParent().getParent() != null){
current = current.getParent();
firstRightSibling = this.getRightSibling(current);
if(firstRightSibling != null){
break;
}
}마지막으로 삽입된 노드가 루트노드일때를 if문으로 처리하시고 그다음 else 안에 서 if문으로 다시 처리하셨는데 이유가 있을까요? else if로 안쓰시고 else 안에서 if를 쓰신 이유가 궁금합니다..!!
알고리즘algorithm
Quiz
47% người trả lời sai. Hãy thử ngay!
표준 큐(Queue)와 우선순위 큐(Priority Queue)의 가장 큰 차이점은 무엇일까요?
데이터가 삽입되는 순서
데이터가 제거되는 순서
데이터 저장 방식 (배열 vs 연결 리스트)
데이터의 최대 저장 개수





