ﺑﻪ ﻧﺎﻡ ﺧﺪﺍﻭﻧﺪ ﻣﻬﺮﺑﺎﻥ درس داده ﺳﺎﺧﺘﺎرﻫﺎ و اﻟﮕﻮرﻳﺘﻢ ﻫﺎ ﭘﺮوژه ي ﺷﻤﺎره ﻳﻚ ﻣﻮﻋﺪ ﺗﺤﻮﻳﻞ1389/9/3 : ﻓﺎﻳﻞ ﻫﺎﯼ ﻻﺯﻡ ﺑﺮﺍﯼ ﺍﺟﺮﺍﯼ ﺑﺮﻧﺎﻣﻪ ﯼ ﻣﺮﺑﻮﻁ ﺑﻪ ﻫﺮ ﺳﻮﺍﻝ ﺭﺍ ﺩﺭ ﭘﻮﺷﻪ ﺍﯼ ﻣﺠﺰﺍ ﻗﺮﺍﺭ ﺩﻫﻴﺪ ،ﺍﻳﻦ ﭘﻮﺷﻪ ﻫﺎ ﺭﺍ ﺩﺭ ﻳﮏ ﭘﻮﺷﻪ ﺑﺎ ﻧﺎﻡ stdID_Project1ﮐﻪ ﺑﻪ ﺟﺎﯼ stdIDﺷﻤﺎﺭﻩ ﺩﺍﻧﺸﺠﻮﻳﯽ ﺧﻮﺩ ﺭﺍ ﻗﺮﺍﺭ ﻣﯽ ﺩﻫﻴﺪ ﺑﮕﺬﺍﺭﻳﺪ ﻭ ﺍﻳﻦ ﭘﻮﺷﻪ ﺭﺍ ﺗﺎ ﻗﺒﻞ ﺍﺯ ۱۲ﻧﻴﻤﻪ ﺷﺐ ﺳﻮﻡ ﺁﺫﺭ ﺑﻪ ﺁﺩﺭﺱ ds891hw@gmail.comﺍﺭﺳﺎﻝ ﮐﻨﻴﺪ) .ﻋﻨﻮﺍﻥ ﺍﻳﻤﻴﻞ ﻫﻤﺎﻥ ﻧﺎﻡ ﭘﻮﺷﻪ ﯼ ﺿﻤﻴﻤﻪ ﺷﺪﻩ ﺑﺎﺷﺪ(. ﺍﮔﺮ ﻫﺮﮔﻮﻧﻪ ﺍﺑﻬﺎﻡ ﻳﺎ ﭘﺮﺳﺸﯽ ﺩﺭ ﻣﻮﺭﺩ ﺳﻮﺍﻻﺕ ﺩﺍﺷﺘﻴﺪ ﺑﻪ ﺁﺩﺭﺱ ds891hw@gmail.comﺍﻳﻤﻴﻞ ﺑﺰﻧﻴﺪ. ﺳﻮﺍﻝ ﺍﻭﻝ :ﺩﺍﻳﺮﻩ ﯼ ﭼﺮﺧﺎﻥ ﺗﻌﺮﻳﻒ ﻣﺴﺎﻟﻪ ﻫﺪﻑ ﺍﻳﻦ ﭘﺮﻭﮊﻩ ﭘﻴﺎﺩﻩﺳﺎﺯﯼ ﺩﺍﺩﻩ ﺳﺎﺧﺘﺎﺭﯼ ﻣﻨﺎﺳﺐ ﺑﺮﺍﯼ ﻧﮕﻪﺩﺍﺭﯼ ﺍﻋﺪﺍﺩ ﺭﻭﯼ ﻳﮏ ﺩﺍﻳﺮﻩ ﻭ ﺍﺟﺮﺍﯼ ﺩﺳﺘﻮﺭﺍﺕ ﺧﻮﺍﺳﺘﻪ ﺷﺪﻩ ﺑﺮ ﺭﻭﯼ ﺁﻥﻫﺎ ،ﺑﻪ ﮐﻤﮏ ﻳﮏ ﻟﻴﻨﮏ ﻟﻴﺴﺖ ﺩﻭﻃﺮﻓﻪ ﺍﺳﺖ. ﺩﺭ ﺍﺑﺘﺪﺍ ﺩﻧﺒﺎﻟﻪﺍﯼ nﺗﺎﻳﯽ ﺍﺯ ﺍﻋﺪﺍﺩ ﻫﻤﭽﻮﻥ v1, v2, … , vnﺩﻭﺭ ﻳﮏ ﺩﺍﻳﺮﻩ ﻗﺮﺍﺭ ﮔﺮﻓﺘﻪﺍﻧﺪ ﻭ ﺍﺷﺎﺭﻩﮔﺮﯼ ﺑﻪ v1ﺍﺷﺎﺭﻩ ﻣﯽﮐﻨﺪ .ﺍﺯ ﺍﻳﻦ ﺑﻪ ﺑﻌﺪ ﺑﻪ ﺟﺎﻳﮕﺎﻫﯽ ﮐﻪ ﺍﺷﺎﺭﻩﮔﺮ ﺑﻪ ﺁﻥ ﺍﺷﺎﺭﻩ ﻣﯽﮐﻨﺪ" ،ﺩﺳﺘﻪ "١ﻣﯽﮔﻮﻳﻴﻢ. ﺣﺎﻝ ﺩﻧﺒﺎﻟﻪﺍﯼ ﺍﺯ ﺩﺳﺘﻮﺭﺍﺕ ﺑﻪ ﻋﻨﻮﺍﻥ ﻭﺭﻭﺩﯼ ﮔﺮﻓﺘﻪ ﻣﯽﺷﻮﻧﺪ ﻭ ﺑﻪ ﺗﺮﺗﻴﺐ ﺑﺮ ﺭﻭﯼ ﺍﻋﺪﺍﺩ ﺩﻭﺭ ﺩﺍﻳﺮﻩ ﺍﻋﻤﺎﻝ ﻣﯽﺷﻮﻧﺪ. ﺩﺳﺘﻮﺭﺍﺕ ۳ﻧﻮﻉ ﻫﺴﺘﻨﺪ: handle 1 ﺣﺬﻑ ﻋﺪﺩ ٢ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﻳﮏ ﻋﺪﺩ ﺑﻪ ﻋﻨﻮﺍﻥ ﺁﺭﮔﻮﻣﺎﻥ ﻭﺭﻭﺩﯼ ﻣﯽﮔﻴﺮﺩ )ﮐﻪ ﺁﻥ ﺭﺍ aﻣﯽﻧﺎﻣﻴﻢ( .ﺑﺎ ﺩﻳﺪﻥ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺼﻮﺭﺕ ﺳﺎﻋﺘﮕﺮﺩ aﺧﺎﻧﻪ ﺟﻠﻮ ﻣﯽﺭﻭﻳﻢ ،ﺩﺳﺘﻪ ﺭﺍ ﺑﺮﺍﺑﺮ ﺧﺎﻧﻪ ﺑﻌﺪ )ﻳﻌﻨﯽ a+1ﺍﻣﻴﻦ ﺟﺎﻳﮕﺎﻩ ﭘﺲ ﺍﺯ ﺩﺳﺘﻪ( ﻗﺮﺍﺭ ﺩﺍﺩﻩ ﻭ ﺧﺎﻧﻪﯼ aﺍﻡ ﺭﺍ ﺣﺬﻑ ﻣﯽﮐﻨﻴﻢ .ﺑﻄﻮﺭ ﻣﺜﺎﻝ ﺍﮔﺮ ﺩﻧﺒﺎﻟﻪﯼ ﺍﻋﺪﺍﺩ 5, ‐2, 3, 4, 0 ﺑﻮﺩﻩ )ﺍﻳﻦ ﺍﻋﺪﺍﺩ ﺍﺯ ﺳﻤﺖ ﭼﭗ ﺑﺼﻮﺭﺕ ﺳﺎﻋﺘﮕﺮﺩ ﺭﻭﯼ ﺩﺍﻳﺮﻩ ﻗﺮﺍﺭ ﺩﺍﺭﻧﺪ( ﻭ ﺩﺳﺘﻪ ﺩﺭﺟﺎﻳﮕﺎﻩ ﺳﻮﻡ )ﺧﺎﻧﻪﯼ ﻣﺤﺘﻮﯼ (3 ﺑﺎﺷـﺪ ،ﺩﺭ ﺻﻮﺭﺕ ﺩﻳﺪﻥ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺎ ﺁﺭﮔﻮﻣﺎﻥ ،2ﭘﺲ ﺍﺯ ﺣﺬﻑ ﺧﺎﻧﻪﯼ ﻣـﺤﺘﻮﯼ ،0ﺩﻧﺒﺎﻟﻪ ﺑـﺼﻮﺭﺕ 5, ‐2, 3, 4ﺩﺭﺁﻣﺪﻩ ﻭ ﺩﺳﺘﻪ ﺑﺮ ﺭﻭﯼ ﺧﺎﻧﻪﯼ ﻣﺤﺘﻮﯼ 5ﻗﺮﺍﺭ ﻣﯽﮔﻴﺮﺩ. ﺍﮔﺮ aﻋﺪﺩﯼ ﻣﻨﻔﯽ ﺑﺎﺷﺪ ،ﺑﻪ ﺍﻧﺪﺍﺯﻩﯼ –aﺑﺼﻮﺭﺕ ﭘﺎﺩﺳﺎﻋﺘﮕﺮﺩ ﺣﺮﮐﺖ ﻣﯽﮐﻨﻴﻢ.ﺩﺭ ﻣﺜﺎﻝ ﻗﺒﻞ ﺍﮔﺮ ﺁﺭﮔﻮﻣﺎﻥ ﻭﺭﻭﺩﯼ ﻋﺪﺩ ‐2ﺑﺎﺷـﺪ ،ﺑﻌﺪ ﺍﺯ ﺍﺟﺮﺍﯼ ﺩﺳﺘـﻮﺭ ﺧﺎﻧﻪﯼ ﻣـﺤﺘﻮﯼ 5ﺣـﺬﻑ ﻣـﯽﺷﻮﺩ ﻭ ﺩﻧﺒﺎﻟﻪ ﺑـﺼﻮﺭﺕ ‐2, 3, 4, 0ﺩﺭﺁﻣﺪﻩ ﻭ ﺩﺳﺘﻪ ﺑﺮ ﺭﻭﯼ ﺧﺎﻧﻪﯼ ﻣﺤﺘﻮﯼ ‐2ﻗﺮﺍﺭ ﺧﻮﺍﻫﺪ ﺩﺍﺷﺖ. ﺩﺭﺝ ﻋﺪﺩ ٣ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺩﻭ ﻋﺪﺩ ﺑﻪ ﻋﻨﻮﺍﻥ ﺁﺭﮔﻮﻣﺎﻥ ﺧﻮﺩ ﻣﯽﮔﻴﺮﺩ )ﮐﻪ ﺁﺭﮔﻮﻣﺎﻥ ﺍﻭﻝ ﺭﺍ aﻭ ﺁﺭﮔﻮﻣﺎﻥ ﺩﻭﻡ ﺭﺍ bﻣﯽ ﻧﺎﻣﻴﻢ( .ﺑﺎ ﺩﻳﺪﻥ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺼﻮﺭﺕ ﺳﺎﻋﺘﮕﺮﺩ aﺧﺎﻧﻪ ﺟﻠﻮ ﻣﯽﺭﻭﻳﻢ ﻭ ﺑﻌﺪ ﺍﺯ ﺍﻳﻦ ﺧﺎﻧﻪ )ﻳﻌﻨﯽ ﺑﻴﻦ aﺍﻣﻴﻦ ﻭ a+1ﺍﻣﻴﻦ ﺧﺎﻧﻪ ﺑﻌﺪ ﺍﺯ ﺩﺳﺘﻪ( ﻳﮏ ﺟﺎﻳﮕﺎﻩ ﺟﺪﻳﺪ ﺍﻳﺠﺎﺩ ﻣﯽﮐﻨﻴﻢ ﻭ ﻋﺪﺩ ﺁﻥ ﺧﺎﻧﻪ ﺭﺍ ﺑﺮﺍﺑﺮ bﻗﺮﺍﺭ ﻣﯽﺩﻫﻴﻢ. ﻫﻤﭽﻨﻴﻦ ﺩﺳﺘﻪ ﺭﺍ ﺑﺮ ﺭﻭﯼ ﺟﺎﻳﮕﺎﻩ ﺟﺪﻳﺪ ﻗﺮﺍﺭ ﻣﯽﺩﻫﻴﻢ .ﺑﻄﻮﺭ ﻣﺜﺎﻝ ﺍﮔﺮ ﺩﻧﺒﺎﻟﻪﯼ ﺍﻋﺪﺍﺩ 1, 4, ‐2, 4, 0 ﺑﻮﺩﻩ ﻭ ﺩﺳﺘﻪ ﺩﺭ ﺟﺎﻳﮕﺎﻩ ﺳﻮﻡ )ﺧﺎﻧﻪﯼ ﻣﺤﺘﻮﯼ (‐2ﺑﺎﺷﺪ ،ﺑﺎ ﺩﻳﺪﻥ ﺍﻳﻦ ﺩﺳﺘﻮﺭ ﺑﺎ ﺁﺭﮔﻮﻣﺎﻥﻫﺎﯼ ) (3, 5 ) 3ﺁﺭﮔﻮﻣﺎﻥ ﺍﻭﻝ ﻭ 5ﺁﺭﮔﻮﻣﺎﻥ ﺩﻭﻡ ﺍﺳﺖ( ،ﭘﺲ ﺍﺯ ﺩﺭﺝ 5ﺑﻴﻦ 1ﻭ ،4ﺩﻧﺒﺎﻟﻪ ﺑﺼﻮﺭﺕ 1, 5, 4, ‐2, 4, 0 ﺩﺭﺁﻣﺪﻩ ﻭ ﺩﺳﺘﻪ ﺑﺮ ﺭﻭﯼ ﺧﺎﻧﻪﯼ ﻣﺤﺘﻮﯼ 5ﻗﺮﺍﺭ ﻣﯽﮔﻴﺮﺩ. ﭼﺎﭖ ٤ ﺩﺭ ﺧﺮﻭﺟﯽ ﺍﺳﺘﺎﻧﺪﺍﺭﺩ ﺗﻨﻬﺎ ﻋﺪﺩ ﺟﺎﻳﮕﺎﻩ ﺩﺳﺘﻪ ﺭﺍ ﭼﺎﭖ ﻣﯽﮐﻨﺪ. 2 delete insert 4 print 3 ﻭﺭﻭﺩﯼ ﻭﺭﻭﺩﯼ ﺍﺯ ﻭﺭﻭﺩﯼ ﺍﺳﺘﺎﻧﺪﺍﺭﺩ ﺧﻮﺍﻧﺪﻩ ﻣﯽﺷﻮﺩ .ﺍﻭﻟﻴﻦ ﺧﻂ ﻭﺭﻭﺩﯼ ،nﺗﻌﺪﺍﺩ ﺍﻭﻟﻴﻪ ﺍﻋﺪﺍﺩ ﺁﻣﺪﻩ ﺍﺳﺖ ﻭ ﺩﺭ ﺧﻂ ﺩﻭﻡ n ﻋﺪﺩ ﺍﻭﻟﻴﻪ ﺑﻪ ﺗﺮﺗﻴﺐ ﺳﺎﻋﺘﮕﺮﺩ ،ﺑﺎ ﺷﺮﻭﻉ ﺍﺯ ﻣﮑﺎﻥ ﺍﻭﻟﻴﻪﯼ ﺩﺳﺘﻪ ﺁﻣﺪﻩﺍﻧﺪ. ﺑﺎ ﺷﺮﻭﻉ ﺍﺯ ﺧﻂ ﺳﻮﻡ ،ﺩﺳﺘﻮﺭﺍﺕ ﻫﺮﮐﺪﺍﻡ ﺩﺭ ﻳﮏ ﺧﻂ ﻭ ﺑﺼﻮﺭﺕ ﻳﮑﯽ ﺍﺯ ﺳﻪ ﻧﻮﻉ ﺯﻳﺮ ﺁﻣﺪﻩﺍﻧﺪ: Del a delete command with an integer argument Ins a b insert command with two integer argument Print print command ﺩﺭ ﺍﻧﺘﻬﺎ ﺩﺭ ﻳﮏ ﺧﻂ ﮐﻠﻤﻪﯼ ENDﺑﻪ ﻣﻌﻨﺎﯼ ﭘﺎﻳﺎﻥ ﺩﺳﺘﻮﺭﺍﺕ ﺁﻣﺪﻩﺍﺳﺖ. ﻭﺭﻭﺩﯼ ﻭ ﺧﺮﻭﺟﯽ ﻧﻤﻮﻧﻪ ﺧﺮﻭﺟﯽ ﻭﺭﻭﺩﯼ 3 4 5 1 ‐2 3 0 4 Ins 2 0 Del ‐2 Print Del 2 Print END ﻣﺤﺪﻭﺩﻳﺖﻫﺎ ﻭﺍﺿﺢ ﺍﺳﺖ ﮐﻪ ﺍﺳﺘﻔﺎﺩﻩ ﺍﺯ ﮐﻼﺱﻫﺎﯼ ﺁﻣﺎﺩﻩ ﻣﺎﻧﻨﺪ LinkedListﻣﺠﺎﺯ ﻧﻤﯽﺑﺎﺷﺪ. ﻗﺪﺭﻣﻄﻠﻖ ﻋﺪﺩ ﻧﻮﺷﺘﻪ ﺷﺪﻩ ﺩﺭ ﻫﺮ ﺧﺎﻧﻪ ﺑﻴﺶ ﺍﺯ 100 ﻧﺨﻮﺍﻫﺪ ﺑﻮﺩ . ﭘﺲ ﺍﺯ ﺍﻧﺠﺎﻡ ﻫﺮ ﺩﺳﺘﻮﺭ ،ﺗﻌﺪﺍﺩ ﺍﻋﺪﺍﺩ ﻫﻤﻮﺍﺭﻩ ﮐﻤﺘﺮ ﺍﺯ 5000ﺧﻮﺍﻫﺪ ﺑﻮﺩ. ﺳﻮﺍﻝ ﺩﻭﻡ :ﺑﺎﺯﺷﻨﺎﺳﯽ ﺭﺷﺘﻪ ﻫﺎﯼ ﻣﮑﻤﻞ-ﻣﺘﻘﺎﺭﻥ ﻣﻘﺪﻣﻪ ﻫﺮ ﺭﺷﺘﻪ ﯼ DNAﺭﺍ ﻣﯽ ﺗﻮﺍﻥ ﺑﺎ ﻳﮏ ﺭﺷﺘﻪ ﺍﺯ ﮐﺎﺭﺍﮐﺘﺮ ﻫﺎﯼ } {A,C,G,Tﻧﺸﺎﻥ ﺩﺍﺩ .ﻫﺮ ﻳﮏ ﺍﺯ ﺍﻳﻦ ﮐﺎﺭﺍﮐﺘﺮ ﻫﺎ ﻧﺸﺎﻥ ﺩﻫﻨﺪﻩ ﯼ ﻳﮑﯽ ﺍﺯ ﭘﺮﻭﺗﺌﻴﻦ ﻫﺎﯼ ﺳﺎﺧﺘﺎﺭﯼ ﺭﺷﺘﻪ ﯼ DNAﺍﺳﺖ ،ﭘﺮﻭﺗﺌﻴﻦ Aﻣﮑﻤﻞ ﭘﺮﻭﺗﺌﻴﻦ Tﻭ ﭘﺮﻭﺗﺌﻴﻦ C ﻞ ﺩﻭ ﺭﺷﺘﻪ ﯼ ،DNAﺳﺎﺧﺘﺎﺭ ﻧﺮﺩﺑﺎﻧﯽ ﻣﻮﻟﮑﻮﻟﻬﺎﯼ ﻣﮑﻤﻞ ﭘﺮﻭﺗﺌﻴﻦ Gﺍﺳﺖ .ﺑﺎ ﺟﻔﺖ ﺷﺪﻥ ﭘﺮﻭﺗﺌﻴﻦ ﻫﺎﯼ ﻣﮑﻤ ِ DNAﺷﮑﻞ ﻣﯽ ﮔﻴﺮﺩ . ﺭﺷﺘﻪ ﯼ ﻣﮑﻤﻞ -ﻣﺘﻘﺎﺭﻥ ﻳﮏ ﺭﺷﺘﻪ ﺩﺭ ﺻﻮﺭﺗﯽ ﻣﮑﻤﻞ-ﻣﺘﻘﺎﺭﻥ ﺍﺳﺖ ﮐﻪ ﺍﮔﺮ ﺗﺒﺪﻳﻼﺕ A↔Tﻭ C↔Gﺭﺍ ﺩﺭ ﺁﻥ ﺍﻧﺠﺎﻡ ﺩﻫﻴﻢ ،ﺭﺷﺘﻪ ﯼ ﺣﺎﺻﻞ ﻋﮑﺲ ﺭﺷﺘﻪ ﯼ ﺍﻭﻟﻴﻪ ﺑﺎﺷﺪ .ﺑﻪ ﻋﻨﻮﺍﻥ ﻣﺜﺎﻝ ﺍﮔﺮ ﺗﺒﺪﻳﻼﺕ ﺑﺎﻻ ﺭﺍ ﺭﻭﯼ ﺭﺷﺘﻪ ﯼ AACGTTﺍﻧﺠﺎﻡ ﺩﻫﻴﻢ ،ﺭﺷﺘﻪ ﯼ ﺣﺎﺻﻞ TTGCAAﺧﻮﺍﻫﺪ ﺑﻮﺩ .ﺍﺯ ﺁﻥ ﺟﺎ ﮐﻪ ﺭﺷﺘﻪ ﯼ ﺑﻪ ﺩﺳﺖ ﺁﻣﺪﻩ ﻋﮑﺲ ﺭﺷﺘﻪ ﯼ ﺍﻭﻟﻴﻪ ﺍﺳﺖ ،ﺭﺷﺘﻪ ﯼ AACGTT ﻣﮑﻤﻞ-ﻣﺘﻘﺎﺭﻥ ﻣﯽ ﺑﺎﺷﺪ. ﺷﮑﻞ -١ﻣﺜﺎﻟﯽ ﺍﺯ ﻳﮏ ﺭﺷﺘﻪ ﯼ ﻣﮑﻤﻞ -ﻣﺘﻘﺎﺭﻥ ﺭﺷﺘﻪ ﻫﺎﯼ DNAﻣﮑﻤﻞ-ﻣﺘﻘﺎﺭﻥ ﻭﻳﮋﮔﯽ ﻫﺎﯼ ﺯﻳﺴﺖ ﺷﻨﺎﺧﺘﯽ ﻣﻬﻤﯽ ﺩﺍﺭﻧﺪ ،ﺑﺮﺍﯼ ﻣﺜﺎﻝ ﺍﻳﻦ ﺭﺷﺘﻪ ﻫﺎ ﺑﺎ ﺗﺎ ﺷﺪﻥ ﺭﻭﯼ ﺧﻮﺩﺷﺎﻥ ﻣﯽ ﺗﻮﺍﻧﻨﺪ ﻳﮏ ﻣﻮﻟﮑﻮﻝ DNAﺗﺸﮑﻴﻞ ﺩﻫﻨﺪ ،ﺑﻪ ﺍﻳﻦ ﺗﺮﺗﻴﺐ ﻣﯽ ﺗﻮﺍﻥ ﺑﺮﺧﯽ ﮊﻥ ﻫﺎ ﺭﺍ ﺗﺮﻣﻴﻢ ﮐﺮﺩ. ﺻﻮﺭﺕ ﻣﺴﺌﻠﻪ ﺑﺮﻧﺎﻣﻪ ﺍﯼ ﺑﻨﻮﻳﺴﻴﺪ ﮐﻪ ﻳﮏ ﺭﺷﺘﻪ ﺍﺯ ﮐﺎﺭﺍﮐﺘﺮﻫﺎﯼ } {A,C,G,Tﺍﺯ ﻭﺭﻭﺩﯼ ﺑﺨﻮﺍﻧﺪ ﻭ ﺗﻌﻴﻴﻦ ﮐﻨﺪ ﮐﻪ ﺁﻳﺎ ﺍﻳﻦ ﺭﺷﺘﻪ ﻣﮑﻤﻞ -ﻣﺘﻘﺎﺭﻥ ﻫﺴﺖ ﻳﺎ ﺧﻴﺮ. ﺩﺭ ﻧﻮﺷﺘﻦ ﺍﻳﻦ ﺑﺮﻧﺎﻣﻪ ﺑﻪ ﻧﮑﺎﺕ ﺯﻳﺮ ﺗﻮﺟﻪ ﮐﻨﻴﺪ: ﺩﺭ ﺍﻳﻦ ﺑﺮﻧﺎﻣﻪ ﺗﻨﻬﺎ ﻣﺠﺎﺯﻳﺪ ﺍﺯ ﺩﻭ ﭘﺸﺘﻪ ٥ﺑﺮﺍﯼ ﺗﺸﺨﻴﺺ ﻣﮑﻤﻞ -ﻣﺘﻘﺎﺭﻥ ﺑﻮﺩﻥ ﺍﺳﺘﻔﺎﺩﻩ ﮐﻨﻴﺪ ﻭ ﻧﺒﺎﻳﺪ ﺳﺎﺧﺘﻤﺎﻥ ﺩﺍﺩﻩ ﻫﺎﯼ ﺩﻳﮕﺮ ﻧﻈﻴﺮ ﺁﺭﺍﻳﻪ ،ﻟﻴﺴﺖ ،ﺻﻒ ﻭ ...ﺭﺍ ﻣﻮﺭﺩ ﺍﺳﺘﻔﺎﺩﻩ ﻗﺮﺍﺭ ﺩﻫﻴﺪ .ﺑﻪ ﻋﺒﺎﺭﺕ ﺩﻳﮕﺮ ،ﻗﺒﻞ ﺍﺯ ﻗﺮﺍﺭ ﺩﺍﺩﻥ ﺗﻤﺎﻡ ﺩﺍﺩﻩ ﻫﺎ ﺩﺭ ﺍﻳﻦ ﺩﻭ ﭘﺸﺘﻪ ﺍﺟﺎﺯﻩ ﯼ ﺍﻧﺠﺎﻡ ﻫﻴﭻ ﭘﺮﺩﺍﺯﺷﯽ ﺭﺍ ﺭﻭﯼ ﻭﺭﻭﺩﯼ ﻧﺪﺍﺭﻳﺪ .ﺑﻪ ﺑﺮﻧﺎﻣﻪ ﻫﺎﻳﯽ ﮐﻪ ﺍﺯ ﺩﺍﺩﻩ ﺳﺎﺧﺘﺎﺭﻫﺎﯼ ﺩﻳﮕﺮ ﺍﺳﺘﻔﺎﺩﻩ ﮐﺮﺩﻩ ﺑﺎﺷﻨﺪ ﻧﻤﺮﻩ ﺍﯼ ﺗﻌﻠﻖ ﻧﺨﻮﺍﻫﺪ ﮔﺮﻓﺖ . )ﺭﺍﻫﻨﻤﺎﻳﯽ :ﻭﻗﺘﯽ ﺩﻭ ﭘﺸﺘﻪ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ﻭ ﺑﺨﻮﺍﻫﻴﻢ ﺑﻪ ﻋﻨﺼﺮ ﺯﻳﺮﻳﻦ ﻳﮑﯽ ﺍﺯ ﺁﻥ ﻫﺎ ﺩﺳﺘﺮﺳﯽ ﺩﺍﺷﺘﻪ ﺑﺎﺷﻴﻢ ،ﻣﯽ ﺗﻮﺍﻧﻴﻢ ﻳﮑﯽ ﻳﮑﯽ ﻋﻨﺎﺻﺮ ﺭﺍ ﺍﺯ ﻳﮑﯽ ﺍﺯ ﺁﻥ ﻫﺎ popﻭ ﺩﺭ ﺩﻳﮕﺮﯼ pushﮐﻨﻴﻢ ،ﺑﻪ ﺍﻳﻦ ﺗﺮﺗﻴﺐ ﻣﯽ ﺗﻮﺍﻧﻴﻢ ﺑﻪ ﻋﻨﺼﺮ ﺯﻳﺮﻳﻦ ﻫﺮ ﭘﺸﺘﻪ ﺩﺳﺘﺮﺳﯽ ﭘﻴﺪﺍ ﮐﻨﻴﻢ(. ﺳﺎﺧﺘﻤﺎﻥ ﺩﺍﺩﻩ ﯼ stackﺭﺍ ﺑﺎﻳﺪ ﺧﻮﺩﺗﺎﻥ )ﺑﻪ ﻳﮑﯽ ﺍﺯ ﺭﻭﺵ ﻫﺎﯼ ﮔﻔﺘﻪ ﺷﺪﻩ ﺩﺭ ﮐﻼﺱ( ﭘﻴﺎﺩﻩ ﺳﺎﺯﯼ ﮐﻨﻴﺪ .ﺍﻳﻦ ﺳﺎﺧﺘﻤﺎﻥ ﺩﺍﺩﻩ ﺑﺎﻳﺪ ﺩﺭ ﻳﮏ ﻓﺎﻳﻞ stack.javaﻳﺎ stack.cppﺑﺎﺷﺪ ﻭ ﻣﺘﺪﻫﺎﯼ pushﻭ popﺩﺭ ﺁﻥ ﭘﻴﺎﺩﻩ ﺳﺎﺯﯼ ﺷﺪﻩ ﺑﺎﺷﻨﺪ . ﺗﺎﺑﻊ )( mainﺑﺮﻧﺎﻣﻪ ﯼ ﺷﻤﺎ ﺑﺎﻳﺪ ﺩﺭ ﻳﮏ ﻓﺎﻳﻞ Main.javaﻳﺎ Main.cppﺑﺎﺷﺪ . ﻭﺭﻭﺩﯼ ﻭ ﺧﺮﻭﺟﯽ ﺑﺮﻧﺎﻣﻪ: ﺑﺮﻧﺎﻣﻪ ﯼ ﺷﻤﺎ ﺑﺎﻳﺪ ﺧﻂ ﺑﻪ ﺧﻂ ﺭﺷﺘﻪ ﻫﺎﯼ ﻭﺭﻭﺩﯼ ﺭﺍ ﺍﺯ consoleﺑﺨﻮﺍﻧﺪ )ﺩﺭ ﻫﺮ ﺧﻂ ﻳﮏ ﺭﺷﺘﻪ ﺩﺍﺩﻩ ﺷﺪﻩ ﻭ ﺩﺭ ﻫﺮ ﺭﺷﺘﻪ ﺗﻨﻬﺎ ﺍﺯ ﮐﺎﺭﺍﮐﺘﺮﻫﺎﯼ T،G،C،Aﺍﺳﺘﻔﺎﺩﻩ ﺷﺪﻩ ﺍﺳﺖ (.ﻭ ﺑﻪ ﺍﺯﺍﯼ ﻫﺮ ﺭﺷﺘﻪ ﺩﺭ ﺻﻮﺭﺗﯽ ﮐﻪ ﻣﮑﻤﻞ -ﻣﺘﻘﺎﺭﻥ ﺑﻮﺩ ﻋﺒﺎﺭﺕ Trueﻭ ﺩﺭ ﻏﻴﺮ ﺍﻳﻦ ﺻﻮﺭﺕ ﻋﺒﺎﺭﺕ Falseﺭﺍ ﭼﺎﭖ ﮐﻨﺪ .ﺑﺮﻧﺎﻣﻪ ﺯﻣﺎﻧﯽ ﺗﻤﺎﻡ ﻣﯽ ﺷﻮﺩ ﮐﻪ ﺍﺯ ﻭﺭﻭﺩﯼ ﮐﺎﺭﺍﮐﺘﺮ ﺻﻔﺮ ﺭﺍ ﺑﺨﻮﺍﻧﺪ . ﻧﻤﻮﻧﻪ ﯼ ﻭﺭﻭﺩﯼ ﻭ ﺧﺮﻭﺟﯽ: stack 5 ﻭﺭﻭﺩﯼ ﺧﺮﻭﺟﯽ AGCTAGCT AACTT AACGTT A AGGA AT 0 True False True False False True End
© Copyright 2025 Paperzz