Video: Yuav ua li cas koj xam qhov complexity?
2024 Tus sau: Lynn Donovan | [email protected]. Kawg hloov kho: 2023-12-15 23:47
Pab txhawb Qhov chaw : yog ib ntus qhov chaw (tsis suav cov tswv yim loj) faib los ntawm koj lub algorithm los daws qhov teeb meem, hais txog qhov loj me. Chaw complexity suav nrog ob tus pab qhov chaw thiab qhov chaw siv los ntawm kev nkag. Chaw complexity = Input Size + Auxiliary qhov chaw.
Ib yam li ntawd, qhov chaw complexity nrog piv txwv yog dab tsi?
Chaw complexity yog ib qho kev ntsuas ntawm tus nqi ntawm kev ua hauj lwm cia algorithm xav tau. Qhov ntawd txhais tau tias ntau npaum li cas nco, nyob rau hauv qhov phem tshaj plaws, yuav tsum tau nyob rau hauv txhua lub sij hawm nyob rau hauv lub algorithm. Raws li lub sijhawm nyuaj , peb feem ntau txhawj xeeb txog yuav ua li cas qhov chaw xav tau kev loj hlob, nyob rau hauv loj-Oh cov ntsiab lus, raws li qhov loj N ntawm cov tswv yim teeb meem loj hlob.
Tsis tas li ntawd, qhov algorithm twg muaj qhov chaw siab tshaj plaws? Soj ntsuam algorithms
Algorithm | Cov ntaub ntawv qauv | Qhov chaw complexity: phem tshaj |
---|---|---|
Ceev ceev | Array | O(n) |
Sib koom ua ke | Array | O(n) |
Heap kev | Array | O(1) |
Yooj yim | Array | O(1) |
Tsis tas li ntawd, qhov chaw complexity thiab lub sij hawm complexity yog dab tsi?
Lub sijhawm nyuaj yog ib txoj haujlwm piav txog tus nqi ntawm sij hawm ib tug algorithm yuav siv sij hawm nyob rau hauv cov nqe lus ntawm tus nqi ntawm cov tswv yim rau lub algorithm. Chaw complexity yog ib txoj haujlwm piav qhia txog tus lej ntawm lub cim xeeb ( qhov chaw ) ib qho algorithm siv nyob rau hauv cov nqe lus ntawm tus nqi ntawm cov tswv yim rau lub algorithm.
Qhov chaw nyuaj puas suav nrog kev nkag?
Space complexity suav nrog ob leeg pab qhov chaw thiab qhov chaw siv los ntawm nkag.
Pom zoo:
Yuav ua li cas sib koom ua ke complexity xam?
2 Teb. Kev sib faib ntawm ib lub node A[L,R] mus rau hauv ob lub nodes siv R − L + 1 lub sij hawm thiab ces muab ob tug me nyuam nodes A[L,M] thiab A[M+1,R] dua yuav siv A[R−L. +1] lub sijhawm. Yog li rau txhua qhov node, tus naj npawb ntawm kev ua haujlwm algorithm ua tau yog sib npaug li ob npaug ntawm qhov loj ntawm cov array sib thooj rau cov node
Koj xam koj li RSA li cas?
Ib qho piv txwv yooj yim heev ntawm RSA encryption Xaiv primes p=11, q=3. n = pq = 11.3 = 33. phi = (p-1)(q-1) = 10.2 = 20. Xaiv e=3. Kos gcd(e, p-1) = gcd(3, 10) = 1 (ie 3 thiab 10 tsis muaj yam xwm txheej tshwj tsis yog 1), suav d xws li ed ≡ 1 (mod phi) piv txwv li suav d = (1/e ) mod phi = (1/3) mod 20. Public key = (n, e) = (33, 3)
Yuav suav li cas cyclomatic complexity?
Cyclomatic complexity yog qhov kev ntsuas qhov ntsuas qhov nyuaj uas cuam tshuam nrog ntau qhov yuam kev coding. Nws yog xam los ntawm kev tsim lub Control Flow Graph ntawm cov cai uas ntsuas tus naj npawb ntawm linearly-independent txoj kev los ntawm ib qho kev pab cuam module
Yuav ua li cas koj xam qhov siab tshaj voltage ntawm RMS?
Peak qhov tseem ceeb tuaj yeem xam los ntawm RMS qhov tseem ceeb los ntawm cov qauv saum toj no, uas txhais tau hais tiasVP = VRMS × √ 2, piv txwv tias qhov chaw yog sine yoj ntshiab. Yog li lub ncov tus nqi ntawm cov mains voltage nyob rau hauv lub teb chaws USA yog hais txog 120 × √ 2, los yog txog 170 volts. Lub ncov-rau-peak voltage, ua ob npaug no, yog hais txog 340 volts
Tus nqi huab xam xam li cas?
Thaum teeb tsa tus nqi, cov chaw muab huab txiav txim siab cov nuj nqis los tswj lub network. Lawv pib los ntawm kev suav cov nqi rau cov khoom siv hauv lub network, kev tu vaj tse hauv network, thiab kev ua haujlwm. Cov nuj nqis no tau ntxiv ua ke thiab tom qab ntawd muab faib los ntawm tus lej ntawm cov khib nyiab ib lub lag luam yuav xav tau rau nws IaaS huab