Lub sij hawm complexity ntawm Prim lub algorithm yog dab tsi?
Lub sij hawm complexity ntawm Prim lub algorithm yog dab tsi?

Video: Lub sij hawm complexity ntawm Prim lub algorithm yog dab tsi?

Video: Lub sij hawm complexity ntawm Prim lub algorithm yog dab tsi?
Video: Lub Sij Hawm - TJHENNY 2024, Plaub Hlis Ntuj
Anonim

Cov lub sij hawm complexity ntawm Prim'sAlgorithm yog O ((V + E) l o g V) vim hais tias txhua qhov vertex yog inserted nyob rau hauv qhov tseem ceeb queue tsuas yog ib zaug thiab insertion nyob rau hauv priorityqueue coj logarithmic sij hawm.

Tsis tas li ntawd, lub sijhawm nyuaj ntawm Kruskal algorithm yog dab tsi?

nyuaj . Kruskal lub algorithm tuaj yeem ua rau khiav hauv O (E log E) sij hawm , los yog sib npaug, O (E log V) sij hawm , qhov twg E yog tus naj npawb ntawm cov npoo hauv daim duab thiab V yog tus naj npawb ntawm cov vertices, tag nrho nrog cov ntaub ntawv yooj yim.

Ib yam li ntawd, qhov twg zoo dua Prims lossis Kruskal? Kruskal cov Algorithm: ua zoo dua intypical xwm txheej (sparse graphs) vim nws siv cov ntaub ntawv yooj yim dua. Prim cov Algorithm: yog qhov nrawm nrawm dua nyob rau hauv qhov txwv thaum koj tau txais daim duab ntom ntom nrog ntau ntau cov npoo ntawm qhov vertices.

Kuj nug, Prim's algorithm siv rau dab tsi?

Hauv computer science, Prim cov (tseem hu ua Jarník's) algorithm yog tus siab hlob algorithm uas nrhiav qhov tsawg kawg nkaus spanning ntoo rau ib tug hnyav undirected graph. Qhov no txhais tau tias nws pom ib qho kev sib txuas ntawm cov npoo uas tsim ib tsob ntoo uas suav nrog txhua qhov vertex, qhov twg tag nrho qhov hnyav ntawm tag nrho cov npoo hauv tsob ntoo raug txo qis.

Lub sij hawm complexity ntawm insertion sort algorithm yog dab tsi?

Insertion kev yog ib qho ruaj khov xaiv nrog aspace nyuaj ntawm O (1) O (1) O (1). Rau cov npe hauv qab no, uas ob sorting algorithms muaj tib yam khiav sij hawm (tsis quav ntsej qhov xwm txheej tas li)?

Pom zoo: