Your SlideShare is downloading. ×
Ded Algorithm1
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Ded Algorithm1

284

Published on

Published in: Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
284
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Äýä àëãîðèòì áà ôóíêö
  • 2. Àãóóëãà
    • Äýä àëãîðèòì ãýæ þó âý?
    • ßìàð õýëáýðòýé áè÷èõ âý?
    • Õýðõýí äóóäàõ âý?
    • Óòãà äàìæóóëàõ
    • Õýðõýí áóöàõ âý?
    • Õóâüñàã÷
    • Æèøýý
  • 3. Äýä àëãîðèòì ãýæ þó âý?
    • Áèå äààñàí øèíæòýé
    • Òîäîðõîé ¿ð ä¿í ºãäºã, ýñâýë òîäîðõîé ¿éëäýë ã¿éöýòãýäýã
    • Îëîí äàõèí àøèãëàãäàõ áîëîìæûã õàíãàñàí
    • ýõ àëãîðèòìä àøèãëàãäàæ áàéãàà àëãîðèòìûã äýä àëãîðèòì ãýíý.
  • 4. Äýä àëãîðèòì ãýæ þó âý?
    • Àëãîðèòì áîëîõûíõîî õóâüä àëãîðèòìûí á¿õ øèíæèéã õàíãàñàí áàéíà.Æ: çààâàë òºãñºæ ýõ àëãîðèòìä óäèðäëàãûã áóöààäàã áàéõ.
    • Íèéëáýð îëîõ, õàìãèéí èõ áà áàãûã îëîõ, ôàéë íýýõ, õààõ ãýõ ìýò.
    • Õýí íýãíèé áè÷ñýí òîäîðõîé äýä àëãîðèòìûã ÿìàð íýãýí ýõ àëãîðèòìä øóóä àâ÷ àøèãëàæ áîëíî.
  • 5. Äýä àëãîðèòì ãýæ þó âý?
    • Ýõ àëãîðèòì ãýäýã íü äýä àëãîðèòìûã àøèãëàæ áàéãàà àëãîðèòì þì.
    • Ýõ àëãîðèòì íü ¿íäñýí àëãîðèòì ýñâýë ººð íýã äýä àëãîðèòì áàéæ áîëíî.
    • Äýä àëãîðèòìä øààðäàãäàõ àíõíû óòãûã àðãóìåíò ãýíý.
    • Äýä àëãîðèòìààñ ýõ àëãîðèòìä áóöààõ óòãûã äýä àëãîðèòìûí ¿ð ä¿í ãýíý.
  • 6. ßìàð õýëáýðòýé áè÷èõ âý?
    • äýä_àë ã íýð (òºðºë_1 ïàðàìåòð_1,..,òºðºë_n
    • ïàðàìåòð_n)
    • áèå_¿éëäë¿¿ä
    • áóö;
    • Æ: äýä_àëã max (áîäèò x, y)
    • xymax:=x;
    • õýðýâ y>xymax áîë xymax:=y
    • áóö;
    a) procedure b) function
  • 7. ßìàð õýëáýðòýé áè÷èõ âý?
    • Íýð íü ò¿¿íä õàðãàëçàõ íèéëìýë ¿éëäýë þó õèéäýã âý ãýäãèéã õàðóóëàõóéöààð ºãíº. Íýðèéã àøèãëàí äýä àëãîðèòìûã äóóääàã.
    • Áèå íü ýíý ¿éëäýë ÿàæ õèéæ áàéãààã õàðóóëäàã.
    • Áóö ¿éëäýë íü äýä àëãîðèòì òºãñºæ ýõ àëãîðèòì ðóó øèëæèæ áàéãààã èëòãýíý.
  • 8. ßìàð õýëáýðòýé áè÷èõ âý?
    • (òºðºë_1 ïàðàìåòð_1,...,òºðºë_n ïàðàìåòð_n) - äýä àëãîðèòìûí àðãóìåíò
      • òºðºë- àðãóìåíòûí òºðºë. Æ: áîäèò, á¿õýë ãýõ ìýò.
      • ïàðàìåòð- àðãóìåíòûí íýð. Æ: õ, ó ãýõ ìýò.
    • Ýíý àðãóìåíòûí óòãûã ýõ àëãîðèòìààñ äàìæóóëæ ºãºõ人 õóâüñàã÷ àøèãëàäàã.
  • 9. ßìàð õýëáýðòýé áè÷èõ âý?
    • (ïàðàìåòð_1,…,ïàðàìåòð_n) íü õóâü-ñàã÷èéí íýð áàéõ áºãººä ò¿¿íèéã õèéñâýð àðãóìåíò ãýæ íýðëýíý.
    • Õèéñâýð àðãóìåíòàä àðãóìåíòûí æèí-õýíý óòãûã ºãºõã¿é, õàðèí çºâõºí ÿìàð òºðëèéí, õýäýí àðãóìåíòòýé àëãîðèòì áîëîõûã ë çààíà.
    • Õàðèí äýä àëãîðèòìûã äóóäàõ ¿åä õóâüñàã÷óóä óòãàòàé áîëäîã.
  • 10. Õýðõýí äóóäàõ âý?
    • ßìàð íýã àëãîðèòì äîòîð òîäîðõîé äýä àëãîðèòìûã àøèãëàõûí òóëä øààðäëàãàòàé áàéðàíä ò¿¿íèé íýðýýð õàíääàã . ¯¿íèéã äýä àëãîðèòìûã äóóäàõ ¿éëäýë ãýæ íýðëýäýã.
    • Äóóäàõ ¿éëäýë íü: íýð(æ_ïàðàìåòð_1,...,æ_ïàðàìåòð_n); õýëáýðòýé áàéíà.
  • 11. Õýðõýí äóóäàõ âý?
    • Äóóäàõ ¿éëäýë áèåëýõýä àëãîðèòìûã áèåë¿¿ëýõ óäèðäëàãà äýä àëãîðèòìä øèëæèæ ò¿¿íèé ¿éëäë¿¿ä áèåëæ ýõýëäýã.
    • æ_ïàðàìåòð_1,...,æ_ïàðàìåòð_n íü àëãîðèòì áèåëýõ ¿åä õàðãàëçàí ïàðàìåòð_1,...,ïàðàìåòð_n õóâüñàã÷èéí æèíõýíý óòãà áîëæ àøèãëàãäàõ ó÷ðààñ æèíõýíý àðãóìåíò ãýæ íýðëýäýã.
  • 12.
    • Æèíõýíý àðãóìåíòûí òîî áîëîí òºðºë íü õèéñâýð àðãóìåíòûí òîî áîëîí òºðºëòýé õàðãàëçàí òîõèð÷ áàéõ ¸ñòîé.
    • Äóóäàõ ¿éëäýë áèåëæ äýä àëãîðèòìä óäèðäëàãà î÷èõ ¿åä {ïàðàìåòð_1:=æ_ïàðàìåòð_1;...; ïàðàìåòð_n:=æ_ïàðàìåòð_n}; ãýñýí ¿éëäýë àâòîìàòààð õèéãääýã.
    Óòãà äàìæóóëàõ ººðººð õýëáýë õóâüñàã÷óóä óòãàòàé áîëäîã
  • 13. Õýðõýí áóöàõ âý?
    • Äóóäàõ ¿éëäýë áèåëýõýä áóöàõ õàÿã èéã ñàíàæ õàäãàëààä äýä àëãîðèòìä øèëæäýã.
    • ¯éëäë¿¿ä áèåëæ ¿ð ä¿í áýëýí áîëîõîä óäèðäëàãûã ýõ àëãîðèòìä áóö ãýñýí ò¿ëõ¿¿ð ¿ã àøèãëàí áóöààíà.
    • Áóö ¿éëäýë áèåëýõýä ºìíº õàäãàëàãäñàí áóöàõ õàÿã èéí òóñëàìæòàéãààð àëãîðèòì ýõ àëãîðèòìä øèëæäýã.
  • 14. Õóâüñàã÷
    • Äýä àëãîðèòìûí àðãóìåíòèéí óòãûã 2 õýëáýðèéí õóâüñàã÷ààð äàìæóóëäàã.
    • Ãëîáàëü õóâüñàã÷ : Ýõ áà äýä àëãîðèò-ìóóäàä á¿ãäýä íü õýðýãëýæ áîëîõîîð òîäîðõîéëîãäñîí õóâüñàã÷
    • Ëîêàëü õóâüñàã÷ : Äýä àëãîðèòì äîòîð òîäîðõîéëîãäñîí áºãººä çºâõºí òýíä õýðýãëýãäýæ áàéãàà õóâüñàã÷
    Ãëîáàëü õóâüñàã÷èéã àøèãëàõ íü èõýíõäýý òîõèðîìæã¿é áàéäàã.
  • 15. Æèøýý
    • max(x,y)= x, õýðýâ x  y
    • y, õýðýâ x<y
    • ôóíêöèéã àøèãëàí ºãñºí a,b,c áîäèò óòãàíä
    • max(a, b+c)+max(a, a+c)
    • 1+max(a+bc, 3.1415)
    • õýìæèãäýõ¿¿íèé óòãûã áîäîæ îë.
    t=
  • 16. Àëãîðèòì
    • Alg Æ1
      • áîäèò a,b,c,t,x,y,xy max; îðóóë(a,b,c);
      • x:=a;
      • y:=b+c;
      • xymax:=x;
      • õýðýâ y>xymax áîë xymax:=y;
      • t:=xymax;
      • y:=a+c;
      • xymax:=x;
      • õýðýâ y>xymax áîë xymax:=y;
      • t:=t+xymax;
      • x:=a+b*c;
      • y:=3.1415;
      • xymax:=x;
      • õýðýâ y>xymax áîë xymax:=y;
      • t:=t/(1+xymax);
      • ãàðãà(t)
    • òºãñ
  • 17. Àëãîðèòì (ãëîáàëü)
    • AlgÆ2
      • áîäèò a,b,c,t,x,y,xymax;
      • îðóóë(a,b,c);
      • x:=a;
      • y:=b+c;
      • max;
      • t:=xymax;
      • y:=a+c;
      • max;
      • t:=t+xymax;
      • x:=a+b*c;
      • y:=3.1415;
      • max;
      • t:=t/(1+xymax);
      • ãàðãà(t)
    • òºãñ
    • äýä_àëã max
    • xymax:=x;
    • õýðýâ y>xymax áîë
    • xymax:=y
    • áóö;
  • 18. Àëãîðèòì (ëîêàëü)
    • AlgÆ3
      • áîäèò a,b,c,t,xymax;
      • îðóóë(a,b,c);
      • max(a, b+c);
      • t:=xymax;
      • max(a, a+c);
      • t:=t+xymax;
      • max(a+b*c, 3.1415);
      • t:=t/(1+xymax);
      • ãàðãà(t)
    • òºãñ
    • äýä_àëã max(áîäèò x,y)
    • xymax:=x;
    • õýðýâ y>xymax áîë
    • xymax:=y
    • áóö;
  • 19. Ôóíêö áà ïðîöåäóð
    • Òîäîðõîé ¿éëäýë ã¿éöýòãýäýã äýä àëãîðèòì-procedure
    • Òîäîðõîé ÿìàð íýã óòãà îëæ ò¿¿íèéãýý áóöààæ ºãäºã äýä àëãîðèòì-function
  • 20. ßìàð ¿åä ò¿ãýýìýë õýðýãëýäýã âý?
    • Àðãóìåíòûí ºãñºí óòãàíä òîäîðõîé íýã óòãûã õàðãàëçóóëàí áîäîæ ºãäºã äýä àëãîðèòìûã function õýëáýðòýé
    • Áè÷èõ, óíøèõ, íýýõ, õààõ ãýõ ìýò òîäîðõîé ¿éëäýë áèåë¿¿ëýõ ýñâýë õýä õýäýí óòãà áîäîõîä çîðèóëñàí äýä àëãîðèòìûã procedure õýëáýðòýé
  • 21. ßàæ áè÷èõ âý?
    • ôóíêö íýð (òºðºë_1 ïàðàìåòð_1,..,òºðºë_n
    • ïàðàìåòð_n)
    • áèå_¿éëäë¿¿ä
    • áóö(áóöààõ óòãà);
    • Æ:
      • ôóíêö ìàõ(áîäèò õ, ó)
      • õýðýâ ó>õ áîë õ:=ó
      • áóö(õ);
  • 22. Æèøýý
  • 23. Õ¿ñíýãòýí àðãóìåíòòàé äýä àëãîðèòì

×