Hom algorithms hauv computer science: piv txwv

Cov txheej txheem:

Hom algorithms hauv computer science: piv txwv
Hom algorithms hauv computer science: piv txwv
Anonim

Thaum kawm computer science, ntau qhov kev mloog yog them rau kev kawm ntawm algorithms thiab lawv hom. Yog tsis paub cov ntaub ntawv tseem ceeb ntawm lawv, koj tsis tuaj yeem sau ib qho kev pab cuam lossis txheeb xyuas nws txoj haujlwm. Txoj kev kawm ntawm algorithms pib hauv chav kawm computer science. Niaj hnub no peb yuav xav txog lub tswv yim ntawm ib qho algorithm, cov khoom ntawm ib qho algorithm, hom.

Txoj kev xav

Ib qho algorithm yog ib ntu ntawm kev ua uas ua rau kev ua tiav ntawm ib qho txiaj ntsig. Thaum muab tso ua ke ib qho algorithm, txhua qhov kev ua ntawm tus neeg ua yeeb yam tau sau meej meej, uas tom qab ntawd yuav coj nws los daws qhov teeb meem.

Duab
Duab

Ntau zaus, algorithms tau siv hauv lej los daws qee yam teeb meem. Yog li, ntau tus neeg paub cov algorithm rau kev daws qhov sib npaug ntawm plaub qhov sib npaug nrog kev tshawb nrhiav rau tus neeg sib cais.

Properties

Ua ntej xav txog hom algorithms hauv computer science, nws yog ib qho tsim nyog yuav tsum paub txog lawv cov yam ntxwv.

Ntawm cov khoom tseem ceeb ntawm algorithms, cov hauv qab no yuav tsum tau qhia:

  • Determinism, i.e.qhov tseeb. Nws nyob hauv qhov tseeb tias ib qho algorithm cuam tshuam nrog kev tau txais qee qhov txiaj ntsig rau qhov muab thawj zaug.
  • Productivity. Nws txhais tau tias yog tias muaj cov ntaub ntawv thawj zaug, tom qab ua tiav cov kauj ruam, ib qho kev xav tau, yuav ua tiav.
  • Mass character. Ib qho algorithm sau ib zaug tuaj yeem siv los daws txhua yam teeb meem ntawm ib hom muab.
  • Kev tsis sib haum xeeb. Nws txhais tau hais tias ib qho algorithm tuaj yeem muab faib ua ntau theem, txhua tus muaj nws lub hom phiaj.

Kev Sau Ntawv

Txawm li cas los xij ntawm computer science algorithms koj xav txog, muaj ntau txoj hauv kev los sau lawv.

  1. Vim lus.
  2. Formulative-verbal.
  3. nraaj.
  4. Algorithm lus.

Cov algorithm feem ntau yog piav qhia hauv daim duab thaiv, siv cov npe tshwj xeeb kho los ntawm GOSTs.

hom tsiaj

Muaj peb lub tswv yim tseem ceeb:

  1. Linear algorithm.
  2. Branching algorithm, lossis branching.
  3. Cyclic.

Tom ntej no, peb yuav saib cov hom algorithms hauv computer science, piv txwv uas yuav pab koj nkag siab tias lawv ua haujlwm li cas ntxiv.

Linear

Duab
Duab

Qhov yooj yim tshaj plaws hauv kev tshawb fawb hauv computer yog linear algorithm. Nws suav tias yog ib ntu ntawm kev ua. Cia peb muab qhov piv txwv yooj yim ntawm ib qho algorithm ntawm hom no. Wb hu ua "School collection".

1. Peb sawv thaum lub tswb nrov.

2. Ntxuav tes.

3. Txhuam peb cov hniav.

4. Peb ua exercises.

5. Hnav khaub ncaws.

6. Noj.

7. Hnav khau thiab mus kawm ntawv.

8. Xaus ntawm algorithm.

Branching algorithm

Duab
Duab

Thaum xav txog hom algorithms hauv kev tshawb fawb hauv computer, ib tus tsis tuaj yeem tab sis nco qab txog cov qauv ceg. Hom no xav tias muaj qhov xwm txheej hauv qab no, yog tias nws ua tiav, qhov kev txiav txim tau ua nyob rau hauv ib qho kev txiav txim, thiab nyob rau hauv cov ntaub ntawv ntawm tsis ua hauj lwm, nyob rau hauv lwm yam.

Piv txwv li, ua raws li hauv qab no - tus neeg taug kev hla txoj kev.

1. Tuaj txog ntawm lub teeb tsheb.

2. Peb saib lub teeb tsheb.

3. Nws yuav tsum yog ntsuab (qhov no yog ib qho mob).

4. Yog tias muaj xwm txheej, peb hla txoj kev.

4.1 Yog tsis yog, tos kom txog thaum lub teeb ntsuab tig.

4.2 Hla txoj kev.

5. Xaus ntawm algorithm.

Cyclic algorithm

Duab
Duab

Kawm cov hom algorithms hauv computer science, peb yuav tsum nyob ntawm cov txheej txheem cyclic kom ntxaws. Qhov algorithm no suav tias yog ib feem ntawm kev suav lossis kev ua haujlwm uas tau ua kom txog thaum muaj qee qhov xwm txheej tau ntsib.

Ua piv txwv yooj yim. Yog hais tias cov lej yog los ntawm 1 txog 100. Peb yuav tsum nrhiav txhua tus lej tseem ceeb, uas yog, cov uas tau faib los ntawm ib tus thiab lawv tus kheej. Wb hu rau algorithm "Prime Numbers".

1. Peb muab tus lej 1.

2. Xyuas seb nws tsawg dua 100.

3. Yog tias muaj, xyuas seb tus lej no puas yog thawj zaug.

4. Yog tias ua tau raws li qhov xwm txheej, sau cia.

5. Peb muab tus lej 2.

6. Xyuas seb nws tsawg dua 100.

7. Xyuas seb nws puas yooj yim.

…. Coj tus lej 8.

Kuaj seb nws tsawg dua 100.

Kuaj seb tus lej puas yog thawj.

No, hlais.

Tau tus lej 9.

Yog li, rov hais dua txhua tus lej mus txog 100.

Raws li koj pom, cov kauj ruam 1-4 yuav rov ua ntau zaus.

Ntawm cov kev sib tw cyclic, muaj cov algorithms nrog precondition, thaum tus mob raug kuaj thaum pib ntawm lub voj voog, los yog nrog ib tug postcondition, thaum lub check yog nyob rau hauv lub kawg ntawm lub voj voog.

Lwm txoj kev xaiv

Lub algorithm tuaj yeem sib xyaw. Yog li, nws tuaj yeem ua cyclic thiab branched tib lub sijhawm. Hauv qhov no, cov xwm txheej sib txawv yog siv ntawm cov ntu sib txawv ntawm cov algorithm. Cov qauv zoo li no yog siv thaum sau cov kev pab cuam thiab kev ua si.

Notation in the block diagram

Peb tau txiav txim siab seb hom algorithms yog dab tsi hauv computer science. Tab sis peb tsis tau tham txog dab tsi cov cim siv hauv lawv cov duab kaw.

  1. Qhov pib thiab qhov kawg ntawm cov algorithm yog sau nyob rau hauv ib tug oval ncej.
  2. Txhua pab neeg raug kho nyob rau hauv daim duab plaub.
  3. Tus mob yog sau rau hauv lub rhombus.
  4. Txhua qhov chaw ntawm lub algorithm txuas nrog siv cov xub.

Cov Lus Qhia

Peb tau txiav txim siab lub ntsiab lus "Algorithms, hom, khoom". Computer science siv sijhawm ntau rau kev kawm txog algorithms. Lawv siv thaum sau ntau yam kev pab cuam rau kev daws teeb meem lej thiab tsim kev ua si thiab ntau yam kev siv.

Pom zoo: