• Save
Lecture916
Upcoming SlideShare
Loading in...5
×
 

Lecture916

on

  • 300 views

 

Statistics

Views

Total Views
300
Views on SlideShare
300
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Lecture916 Lecture916 Presentation Transcript

  • 03/16/10 Ìýäýýëëèéí ñèñòåì, àëãîðèòìèéí ¿íäýñ Ëåêö ¹16
  • Àãóóëãà 1. Ðåóðñèâ ôóíêö 03/16/10
  • 03/16/10 ¯íýíäýý n óðòòàé àþóëã¿é ãèíæ¿¿äèéã • õàð òóãàëãàí ýðõèýýð òºãññºí ãèíæ • ïëóòîíè ýðõèýýð òºãññºí ãèíæ ãýñýí õî¸ð á¿ëýãò õóâààæ àþóëã¿é ãèíæéè òîîã c(n), n óðòòàé àþóëã¿é ãèíæèéí òîîã I(n) ïëóòîíè ýðõýýð òºãññºí n óðòòàé àþóëã¿é ãèíæèéí òîîã p(n) ãýæ òýìäýãëýâýë c(n)=I(n)+p(n) áàéõ íü ìýäýýæ.
  • 03/16/10 ªºðººð õýëáýë; I(n)=c(n-1) (1) p(n)=I(n-1) p(n)=I(n-1)=c(n-2) Èéì ó÷ðààñ áèä c(n)=I(n)+p(n)=c(n-1)+c(n-2) áóþó c(n)=c(n-1)+c(n-2) òîìü¸ã ãàðãàëàà. Äýýðõ áîäëîãûã äàðààõààð áè÷èæ áîëíî.
  • 03/16/10 ôóíêö ñ ( íàò n) íàò k ; õýðýâ n=1 áîë k:=2 ýñâýë õýðýâ n=2 áîë k:=3 ýñâýë k:=c(n-1)+c(n-2) áóö (k)
  • 03/16/10 Ýíý øèéäèéí òóñëàìæòàéãààð ò¿¿íèé çºâ øèéäèéã ÿàæ îëîõ âý? Ýíý ôóíêö áèåëýõ ïðîöåññ ºìíºõ æèøýýíèéíõýýñ èë¿¿ ýýäðýýýòýé òóë c(5) c(5) n=5 c(4) n=4 c(3) n=3 c(2) n=2 k=2
  • 03/16/10 áóö (3) c(1) n=1 k=2 áóö (2) k=3+2 áóö(5) c=(2) n=2 k=3 áóö(3) k=5+3 áóö(8)
  • 03/16/10 c(3) n=3 c(2) n=2 k=3 áóö(3) c(1) n=1 k=2 áóö (2) k=3+2 áóö (5) k=8+5 áóö (13)
  • 03/16/10 Õ¿ñíýãòýýñ õàðàõàä ôóíêö ººðèé㺺 8 óäàà äóóäñàí áàéíà. Òýãýõäýý ñ(3),ñ(1) òóñ á¿ð õî¸ð óäàà, (2) ãóðâàí óäàà áîäîãäîæ áàéãàà íü ðåêóðñèâ àðãûí íýã ñóë òàë þì.ªºðºº õýëáýë, ðåêóðñèâ àëãîðèòì áèåëýõ ¿åä íýã óòãûã äàõèí äàõèí áîäîõ òîõèîëäîë ãàð÷ áîëíî.
  • 03/16/10 Æèøýý íü: t 1 ,t 2 ,…….t n (á¿õ i -ãèéí õóâüä t i –íàòóðàë òîî áàéõ ) óòãàòàé n øèðõýã äýâñãýðò òºãðºã õýðýãëýäýã îðîíä ºãñºí Ì òºãðºãèéã ýíý äýâñãýðò¿¿äýýð çàäàëæ áîëîõ á¿õ áîëîìæèéí òîîã îëîõ ôóíêö çîõèî.
  • 03/16/10 Ýõëýýä çàäëàõ òºãðºã, çàäëàõàä àøèãëàõ äýâñãýðòèéí òîî ôóíêö áèåòýõ ¿åä ººð÷ëºãäºæ áîëîõ óòãóóä ó÷ðààñ ýíý õî¸ð õýìæèãäýõ¿¿íèéã õèéñâýð àðãóìåíò áîëãîí òîäîðõîéëîõ íü ç¿éòýé. Èéì ó÷ðààñ m òºãðºãèéã t 1 ,t 2 ,…….t n õ¿ñíýãòýýð ºãºäñºí n òîîíû äýâýñãýðòýýð çàäëàõ òîîã îëîõ ch (íàò m,n) ôóíêöèéã çîõèîæ áè÷üå.
  • 03/16/10 à.n-ä¿ãýýð òºãðºãèéã îðóóëàõã¿é çàäëàõ á¿õ áîëîìæèéã òîî áóþó ch (m,n-1) óòãûã îëîõ á.n ä¿ãýýð äýâñãýðò íýãèéã àâ÷ ¿ëäñýí òºãðºãèéã çàäëàõ á¿õ áîëîìæèéí òîî áóþó ch (m-t n ,n) óòãûã îëîõ .
  • 03/16/10 ôóíêö ch(íàò m;n) íàò ó; õýðýâ n=1 áîë õýðýâ m ‡ 0 and m 1 =0 áîë y:=1 ýñâýë y:=0 ýñâýë ó:ch(m,n-1) õýðýâ m=t n
  • 03/16/10 áîë ó:1+ y ýñâýë õýðýâ m > t n áîë y:=y+ ch(m-t n , n) áóö(y); m òºãðºãèéí t1 äýâñãýðýýð çàäàëæ ÷àäàõ ýñýõèéã øàëãàõäàà äàâõàð m ‡ 0 íºõöëèéã ýíä äàâõàð øàëãàæ áàéãàà þì.
  • 03/16/10 Ðåêóðñèâ àðãà íü óãààñàà ðåêóðñèâýýð òîäîðõîéëîãäñîí áîäëîãûã áîäîõîä áîëîí ººð àðãààð áîäîõîä íèéëýýä õ¿íä áàéõ òèéì áîäëîãûí àëãîðèòìûã çîõèîõîä õýðýãëýãääýã ìàø õ¿÷òýé õýðýãñýë þì.
  • 03/16/10 Ðåêóðñèâ õàíäàëòûã êîìïüþòåðò õýðýãæ¿¿ëñýí áàéäëààñ õàìààð÷ ðåêóðñèâ àëãîðèòìòàé ïðîãðàì ìàø óäààí áèåëýõ òîõèîëäîë ãàð÷ áîëíî.Èéì àëãîðèòì ïðîãðàìûã çîõèîæ áýëýí áîëãîõîä çàðöóóëàõ õóãàöàà áîëîí ïðîãðàìûã áèåë¿¿ëýõ
  • 03/16/10 ¿åèéí (áèåëýõ õóãàöàà áà øààðäàãäàõ ñàíàõ îéí õýìæýý çýðýã ) ºðòºã õî¸ðûã ¿íäýñëýí ðåêóðñèâ àðãûã õýðýãëýõ ýñýõýý øèéäâýë çîõèíî.