You are on page 1of 18

Ὦɼὁ せӬ

ҙૌ
せӬ⩐ᄲ⃌ᐉ
ɺℋせӬ⚠᫧
ʷℋせӬ⚠᫧
せӬℬඖ၃ଁ
ᘗᗩ࿢಍ᘍ
せӬ⫏ᅆ⃌ᐉ
૾㆛⢌̳ŘせӬ⳥ᮢ

m
O  せӬ ˛

せӬ
Ҡ‫׻≙א׺‬ờ
᳈‫⫏׺‬ᅆࠣ๗

int a[8] = {10, 15, 20, 25, 30, 35, 40, 45};

10 15 20 25 30 35 40 45 a.length = 8

a[0] a[1] a[2] a[3] a[4] a[5] a[6] a[7]

O  ɺℋせӬ⚠᫧ Î

ɺℋせӬઽ‫ب‬

せӬઽ‫ب‬᱿⦝ᘍŘ ῅͛Ř

†        
   †        
 
†      †         
 
       


 
m m       

m m      

  m        

è
O  ɺℋせӬ⚠᫧ Î

῅͛ᶇ⤽Ř֬ӛ⊵Ṡᔕ‫׫‬ъņO
Ň
‫؟‬ːӴᮢせӬ OOOOOѲએኽɺ
ᄄ⊵ṠሱⲖ Τ˅ᆞᅺ᱿ᄇᲷъŊ⦼Ӭ֬ӛҢҙૌřቅቃႽ̳˛ㄇॖʁŘ

ÿ
O  ʷℋせӬ⚠᫧ Î

ʷℋせӬ᱿⃌ᐉ
[0][0] [0][1] [0][2]

1 2 3 score[0].length = 3
int score[][] ={{1, 2, 3},
[1][0] [1][1] [1][2]
{4, 5, 6},
{7, 8, 9}, 4 5 6 score[1].length = 3
{10, 11, 12}};
[2][0] [2][1] [2][2]

7 8 9 score[2].length = 3
score.length = 4
[3][0] [3][1] [3][2]

10 11 12 score[3].length = 3

Ñ
O  ʷℋせӬ⚠᫧ Î

ઽ‫⦝ب‬ᘍŘ

ʷℋせӬઽ‫⦝ب‬ᘍŘ ῅͛Ř

†        
   †    m 
  
 m 
†     †    m 
     
 m 

†          m!


!è !
ÿ!Ñ!D !
"!#!$ !
m!mm!m


D
O  ʷℋせӬ⚠᫧ Î

῅͛ᶇ⤽Ř֬ӛʷℋせӬҙૌ ÎO

⦼ℶ૯ɺỄೣŊ֬ӛせӬ  O
ҙૌʏͩᤫ᳈ଃ̤⇦࿢Ӭņ౹ㄇഐᨊŇȯ ቅቃႽ̳˛ㄇॖʁŘ

"
O  ʷℋせӬ⚠᫧ Î

⅀Լ໼ŘӬ֬᳅ೣ‫ ⥸ڥ‬Î O



⦼⢌̳ɺह‫⥸ڥ‬Ӭ֬₇⃥ŊԼ⋱ᆯ⋱૽໽૽ⱚҘ᱿‫⥸ڥ‬ņʽ⤵߈‫ן‬ŇŊӠӲ
˫ᑲೣ⎞᳅ೣ֬ӛȯ

 (b)᳅ೣӬ֬
    
( )ᑲೣӬ֬
   
 ୀ ʑ Ⲷ ⇬ 

ᆨ ⑽ ᆙ ౺ ℂ

᪗ ચ ᔖ ʃ ᔖ
ୀ ʑ

  ౡ 

ౡ ࿵ ኿ ༄
࿵ ኿ ༄

 ᆨ ⑽ ᆙ ౺ ℂ

 Ⲷ ⇬
 ᪗ ચ ᔖ ʃ ᔖ

#
O  せӬℬඖ၃ଁ Î

ℬඖ၃ଁរᾰᘍ
ᕗⰱ
key 65 45

12

89

76

34

༪ӷʴ 65

77

93

$
O  せӬℬඖ၃ଁ Î

῅͛ᶇ⤽Řञᐪⲿヅ〉ⴆ⚦ ÎO

⦼⢌̳ञᐪⲿ᱿ヅ〉ⴆ⚦₇⃥Ŋ₇⃥⋱⎊Ւⴆӛ Τ᮫  ⚦ᷪŊ̟ⳆҞ

Τ⚦ᷪⵣ ‫⸅˫ר‬⢒ȯ

m
O  せӬℬඖ၃ଁ Î

⅀Լ໼Řሱ㋧⎞ሱ̥ໞⅷ≛ Î O

ણ≘ోӴᮢɺΤʷℋせӬѲએኽɺ᫗₤ણᮝ᱿ໞⅷŊ 
OO
OOȯ⦼ℶ૯ɺỄೣӬ֬ӛ⥿᫗ໞⅷሱ㋧⎞ሱ̥Ӡ
ᄲ⎞঎‫׻‬ȯ
m
  mmm m   
mmm  m
  
mmm    
mmm  
 !m" m#
   mmm 
 !m$ m# mmm  
  
mmm  
mmm   

mm
O  ᘗᗩ࿢಍ᘍ Î

ᘗᗩ࿢಍រᾰᘍ

            

         
         
         
 

       
        
         
           
j
 j  j  j  j  j  j  j 

j +  !!!! 

O  ᘗᗩ࿢಍ᘍ Î
῅͛ᶇ⤽Řໞⅷ㋧̥࿢಍ ÎO

೺≘ోӴᮢɺℋせӬએᄍʴ᫗ʀᄲણໞⅷŊせӬҙૌᣅ O
OOOŊ⦼Ӵᮢᘗᗩ࿢಍ᘍℶ૯ɺỄೣ᮫㋧ӷ̥࿢ӬŊʏ֬
ӛᕓߊ‫׶‬࿢Ӭ᱿⃌ኞȯ


O  ᘗᗩ࿢಍ᘍ Î

қ⩐ᄲҙૌ˅ဘỄ಍
$%
&'
a tem p = X
"# ۗ

$%
Y X tem p

&(' X =Y
"# ۗ

ۗ

$% ) *
Y X tem p
X Y ҙૌર ˅ဘ

&'
c Y = tem p "# "# ۗ

ۗ

"# ۗ

Y X tem p Y X tem p

mÿ
O  せӬ⫏ᅆ⃌ᐉ Î

⫏ᅆࠣ๗
໽ሷᓌ̤᱿⫏ᅆࠣᲀ᳈‫׺‬ȯ

ણ ⚦ Ễೣ⥑⤺ ⫏⤻ℐ⭰ ⫏ᅆ⚠᫧ ⃥⤺Ӡኔ ⅶ౹ࠀ


ÿ$
mm # $ "# "


ÿ$
m
$ D" Ñÿ ÿD 

ÿ$
mè "m Dÿ #è Ñè 

ÿ$
mÿ D# #$ "è "è 

ÿ$
mÑ ÑD "
Ñè ÿ$ 

ÿ$
mD $D DÑ "# #è 

ÿ$
m" ÿ$ D
$m D# 


O  せӬ⫏ᅆ⃌ᐉ Î
῅͛ᶇ⤽Ř֬ӛ᫗₤ໞⅷ‫ ܈‬ÎO

೺≘ోӴᮢʷℋせӬ  OOO
OOOO
OOએᄍ⥿᫗᱿ણᮝໞ
ⅷ⫏ᅆŊᕓώ⫏ᅆᣅ ણ⚦ȮỄೣ⥑⤺Ȯ⫏⤻ℐ⭰Ȯ⫏ᅆ⚠᫧Ȯ⃥⤺ӠኔȮⅶ
౹ࠀȯ⦼⤺ᾰᕓɺ̤‫׺‬ણ᱿ⅶ౹ࠀӠᄲŊҪӬ֬ӛ໽ሷໞⅷ⫏ᅆȯ

mD
O O ૾㆛⢌̳ŘせӬ⳥ᮢ Î

ʷӠ၃ଁរᾰᘍ
‫⫏׆‬ᅆ఩࿢಍ ໞ
ᕓᓝᕗଃ⫏ᅆ᱿ ⿵̤⇦
0 .d 1 2+,w +-./- 3 567 ᕗ8
567 d 4 567 ÿ d 4

+,w  d 4 -./-


567ᕗ8 567ᕗ 8

+,w  d 4 -


w  d 4 

m"
O O ૾㆛⢌̳ŘせӬ⳥ᮢ Î
῅͛ᶇ⤽Řው⥴ણᮝໞⅷ ÎO

ᄲણ≘ోӴᮢɺΤʷℋせӬ  Ѳએኽɺ᫗₤ણᮝ᱿ໞⅷŊせӬὮɺΤ
ÿ% !એᄍણᮝણ⚦Ŋ᮫  řὮʷΤÿ%  !
એᄍᄲણໞⅷŊ᮫  Ӡȯ⦼ℶ૯ɺỄೣŊ ⱚҘણᮝણ⚦Ŋÿⱚӛ
⥿ણᮝ᱿ໞⅷȯỄೣ 9 ૯ɺÿỄೣ ҘせӬҙᕓɺ̤‫׺‬ણ᱿ણ⚦⎞ໞⅷŊ
ໞⅷÿ  ⿵᱿ ᄲŊ֬ӛÿ᫗ໞⅷŊ࿲┮Ҫℶ૯ɺΤʷӠ၃ଁ
Ễೣȯ

m#