Dab tsi sorting algorithm muaj qhov zoo tshaj plaws asymptotic complexity?
Dab tsi sorting algorithm muaj qhov zoo tshaj plaws asymptotic complexity?

Video: Dab tsi sorting algorithm muaj qhov zoo tshaj plaws asymptotic complexity?

Video: Dab tsi sorting algorithm muaj qhov zoo tshaj plaws asymptotic complexity?
Video: Dab Ntub Hlub - Cheng Xiong Ft. Douachi Yang (Official Music Video) 2024, Hlis ntuj nqeg
Anonim

Heap Sib

Ib yam li ntawd, qhov kev txheeb xyuas algorithm twg muaj lub sijhawm zoo tshaj plaws?

Rau qhov zoo tshaj plaws Insertion Cai thiab Heap Sib yog qhov zoo tshaj plaws raws li lawv cov ntaub ntawv zoo tshaj plaws khiav lub sij hawm nyuaj yog O (n). Rau qhov nruab nrab qhov zoo tshaj plaws asymptotic khiav lub sij hawm nyuaj yog O (nlogn) uas yog muab los ntawm Merge Sort, Heap Sib , Ceev Sort. Rau qhov phem tshaj plaws khiav lub sij hawm complexity yog O (nlogn) uas yog muab los ntawm Merge Sort, Heap Sib.

Tsis tas li ntawd, dab tsi yog asymptotic runtime complexity? asymptotic sij hawm nyuaj . (Definition) Txhais: Qhov txwv tus cwj pwm ntawm lub sij hawm ua tiav ntawm ib qho algorithm thaum qhov loj ntawm qhov teeb meem mus rau infinity. Qhov no feem ntau yog qhia nyob rau hauv loj-O cim. Saib thiab asymptotic qhov chaw nyuaj.

Dhau li ntawm no, qhov algorithm twg yog qhov zoo tshaj rau kev txheeb xyuas?

Quicksort

Dab tsi yog qhov nyuaj ntawm sorting algorithm?

Sijhawm Complexities ntawm tag nrho Sorting algorithms

Algorithm Lub sij hawm nyuaj
Zoo tshaj phem tshaj
Npuas Sort Ω(n) O(n^2)
Insertion Sort Ω (n) O(n^2)
Heap Sib Ω(n log(n)) O(n log(n))

Pom zoo: