Heap 시간 복잡도

hankyulee·2022년 5월 30일
0

Swift coding test 준비

목록 보기
56/57

max heap

make hip : n 또는 insert로 할경우 nlogn
insert: log n
find-max : 1
delete max : log n

search : n . because we don't know whethere the thing is on left or right side.

it works well when we need to insert / delete and
it works not well when we search .

heap sort : (max heap) - replace the top node with the last node, and heapify repeatedly.

0개의 댓글