SlideShare a Scribd company logo
1 of 28
Download to read offline
2010 CS
2010 CS                                      	


                                 	


    




    




Copyright© 2010 tniky1 All rights reserved.        Page 2
2010 CS                                      	


                                     	


    
      - 
      - 
    
      - 
    
      - Θ            	


Copyright© 2010 tniky1 All rights reserved.        Page 3
2010 CS                                      	


                             	
                                                   	




Copyright© 2010 tniky1 All rights reserved.        Page 4
2010 CS                                              	


                             	
                            j	
                                          1   	
   1 2 3         4   5 6	
                                                   2 5 4 6 1 3
                                                           i	


                                                      length[A]	

     procedure Insertion-Sort(A)
      for j ← 2 to length[A]
        do key ← A[j]
          i←j−1
          while i > 0 and A[i] > key
             do A[i+1] ← A[i]
             i←i−1
          A[i+1] ← key	
Copyright© 2010 tniky1 All rights reserved.                                  Page 5
2010 CS                                      	


                                                   	



                                                             	

                                      (1)




                                   (2)                  	


Copyright© 2010 tniky1 All rights reserved.                       Page 6
2010 CS                                                      	


                                                  	


   
   
        -  A[1...j-1]                                                   →

                                                         j
                                                         	

                                                2 5 4 6 1 3

                                              A[1...j-1]	
                                                                   	




Copyright© 2010 tniky1 All rights reserved.                                 Page 7
2010 CS                                      	


                                                                      	


    
      - 
           -                                                	
      - 
           - 


      - 
           - 
                (                                  )   	

                                                                 	

Copyright© 2010 tniky1 All rights reserved.                 Page 8
2010 CS                                                      	


                                                                                                     	
                                                         j
                                                         	

                                                2 5 4 6 1 3

                                              A[1...j-1]	
                                                                          	

      for j ← 2 to length[A]                                       J=2
        do key ← A[j]                                                     A[1]
                                                                          A[1..j-1]
          i←j−1
          while i > 0 and A[i] > key                               A[j]
                                                                               A[j-1],A[j-2]...
             do A[i+1] ← A[i]                                                                 A[j]
             i←i−1                                                   (A[1..j-1]                           )
          A[i+1] ← key	
Copyright© 2010 tniky1 All rights reserved.                                                                   Page 9
2010 CS                                                	


                                                                                         	
                                                                     j=n+1	

                                              1 2 3 4 5 6

                                              A[1...j-1]=A[1..n]	




      for j ← 2 to length[A]                                         j=n+1
        do key ← A[j]
                                                                     A[1..j-1]=A[1..n]           !
          i←j−1
          while i > 0 and A[i] > key
             do A[i+1] ← A[i]
             i←i−1
          A[i+1] ← key	
Copyright© 2010 tniky1 All rights reserved.                                                   Page 10
2010 CS                                      	


                                                   	




                                      (1)

                                                             	



                                   (2)                  	


Copyright© 2010 tniky1 All rights reserved.                       Page 11
2010 CS                                      	


                                                            	


    
      - 
      - 
      -                               (                          )
    
      -                                            (       DB
                                   DB                  )
      - 


Copyright© 2010 tniky1 All rights reserved.                          Page 12
2010 CS                                                      	


                                                                            	
                                                  j	
                                              1 2 3     4    5 6	
                                              2 5 4 6 1 3
                                                  i	
                                      	
                                                   n    	
                                                                             	

    for j ← 2 to length[A]                                            n
      do key ← A[j]                                                  n-1
        i←j−1                                                        n-1
        while i > 0 and A[i] > key
           do A[i+1] ← A[i]
           i←i−1                                                                  tj
        A[i+1] ← key	
                                               n-1
                                                                       	
                                                                                  (       )	
Copyright© 2010 tniky1 All rights reserved.                                            Page 13
2010 CS                                      	


                                                         	
                                                    	
               	

       for j ← 2 to length[A]                      C1          n
         do key ← A[j]                             C2         n-1
           i←j−1                                   C3         n-1
           while i > 0 and A[i] > key              C4
              do A[i+1] ← A[i]                     C5
              i←i−1                                C6
           A[i+1] ← key	
                          C7         n-1
                                                                	
                  T(n)	




Copyright© 2010 tniky1 All rights reserved.                               Page 14
2010 CS                                               	


                                                                	
                 T(n)	



                                                   (        )
                                                                         j	
                                                                     1 2 3     4   5 6	
    [                 ]                                              5 6 4 3 2 1
           i=0                                                           i	
    tj=i
                                                                                           	



                                              	
                                                	




Copyright© 2010 tniky1 All rights reserved.                                          Page 15
2010 CS                                                	


                                                   	


    
      - 
           - 
                                              	

    
      - 
           -                                                 	
           - 




Copyright© 2010 tniky1 All rights reserved.                       Page 16
2010 CS                                      	


                                     	
                                                   	




Copyright© 2010 tniky1 All rights reserved.             Page 17
2010 CS                                           	


                                              	


                                                          A 2 4 5 7 1 2 3 6
                                                           p	
              q	
               r	


                                                            i	
                         j	
                                                        1 2 3     4   5	
           1 2 3           4    5   	
                                                    L	
 2 4 5 7 ∞                 R	
 1 2 3 6 ∞


                                                            n1	
                          n2	
                                                                            k
                                                                            	

                                                           A 1 2 2 3 4 2 3 6
                                                            p	
     q	
      r	


Copyright© 2010 tniky1 All rights reserved.                                                             Page 18
2010 CS                                                           	


                                              	
     
       -  A             L        R                                                     k−p

       -  L[i]       R[j]            L         R                   A
                                                                    	
                                                   i	
                                  j	
                                         1 2 3           4   5	
               1 2 3    4     5   	
                                   L	
 2 4 5 7 ∞                         R	
 1 2 3 6 ∞
                                                             	
                                   	
                                                                          k
                                                                          	

                                               A 1 2 2 3 4 2 3 6
                                                 p	
           r	
                                                                                  	
Copyright© 2010 tniky1 All rights reserved.                                                            Page 19
2010 CS                                            	

                                                              i	
                                  j	
                                              	
         1 2 3      4   5	
               1 2 3   4      5     	
                                                   L	
 2 4 5 7 ∞                    R	
 1 2 3 6 ∞
                                                                        	
                                     	
                                                                                     k
                                                                                     	

                                                           A 1 2 2 3 4 2 3 6
                                                             p	
            r	
                                                                                             	

                                                     k=p
                                                             A[p..k-1]
                                                     i=j=1                    L,R


                                                     L[i]<=R[j]
                                                     L[i] A
                                                     L[i] A[k]
                                                     i k                                          L[i],R[j]

Copyright© 2010 tniky1 All rights reserved.                                                                  Page 20
2010 CS                                            	

                                                              i	
                             j	
                                              	
         1 2 3      4   5	
           1 2 3   4     5       	
                                                   L	
 2 4 5 7 ∞              R	
 1 2 3 6 ∞
                                                                        	
                                  	
                                                                                 k
                                                                                 	

                                                           A 1 2 2 3 4 2 3 6
                                                             p	
            r	
                                                                                         	

                                                     k=r+1
                                                             A[p..k-1]=A[p..r]                          !




                                                         2                                                  n
                                                          (n1+n2 )            : Θ(n)


Copyright© 2010 tniky1 All rights reserved.                                                             Page 21
2010 CS                                      	


                                  	
                         MERGE         	

                                                   	




                                                        	



Copyright© 2010 tniky1 All rights reserved.                          Page 22
2010 CS                                                    	


                                                       	
         A             p          r                    	
                                                                       p    r
                                                                           	
                                                                 A	
                           /* (               ) */	




Copyright© 2010 tniky1 All rights reserved.                                     Page 23
2010 CS                                                	


                                                                  	

      -                a                                          1/b




                                        	
         	
        	

           -  If n <= c
           -  D(n):
           -  C(n):                           	




Copyright© 2010 tniky1 All rights reserved.                             Page 24
2010 CS                                                      	


                                                                            	
                                              	
              	
   	

                 T(n) = aT(n/b) + D(n) + C(n)

               2                                                    Merge          Θ(n)
               1/2                                                               	
        a = b = 2	
                                              D(n) = Θ(1)	




                   T(n) = 2T(n/2) + Θ(1) + Θ(n)                             if n > 1
                       =Θ(1)                                                if n = 1



Copyright© 2010 tniky1 All rights reserved.                                               Page 25
2010 CS                                            	


                                                               	




                                              cn(        )	



Copyright© 2010 tniky1 All rights reserved.                         Page 26
2010 CS                                      	


                                                   	


         log2n              	




Copyright© 2010 tniky1 All rights reserved.             Page 27
2010 CS                                           	


                   	


                                                       OK

      - 
      -                                       	




Copyright© 2010 tniky1 All rights reserved.              Page 28

More Related Content

Viewers also liked

機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト
Teppei Baba
 
ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33
horihorio
 
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Takahiro Inoue
 
パターン認識 第10章 決定木
パターン認識 第10章 決定木 パターン認識 第10章 決定木
パターン認識 第10章 決定木
Miyoshi Yuya
 
はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-
はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-
はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-
Naoki Yanai
 

Viewers also liked (20)

デザインパターン(state,strategy,template)
デザインパターン(state,strategy,template)デザインパターン(state,strategy,template)
デザインパターン(state,strategy,template)
 
アルゴリズムイントロダクション 8章
アルゴリズムイントロダクション 8章アルゴリズムイントロダクション 8章
アルゴリズムイントロダクション 8章
 
アルゴリズムイントロダクション 14章
アルゴリズムイントロダクション 14章アルゴリズムイントロダクション 14章
アルゴリズムイントロダクション 14章
 
動画像圧縮(コーデック)
動画像圧縮(コーデック)動画像圧縮(コーデック)
動画像圧縮(コーデック)
 
スマホUXラボ「ユーザテストLive! 見学会」
スマホUXラボ「ユーザテストLive! 見学会」スマホUXラボ「ユーザテストLive! 見学会」
スマホUXラボ「ユーザテストLive! 見学会」
 
Npc april fool2014
Npc april fool2014Npc april fool2014
Npc april fool2014
 
The FizzBuzz Programing Contest
The FizzBuzz Programing ContestThe FizzBuzz Programing Contest
The FizzBuzz Programing Contest
 
中の下のエンジニアを脱出するための仕事術
中の下のエンジニアを脱出するための仕事術中の下のエンジニアを脱出するための仕事術
中の下のエンジニアを脱出するための仕事術
 
バンディットアルゴリズム入門と実践
バンディットアルゴリズム入門と実践バンディットアルゴリズム入門と実践
バンディットアルゴリズム入門と実践
 
決定木学習
決定木学習決定木学習
決定木学習
 
今日から使える! みんなのクラスタリング超入門
今日から使える! みんなのクラスタリング超入門今日から使える! みんなのクラスタリング超入門
今日から使える! みんなのクラスタリング超入門
 
機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト機会学習ハッカソン:ランダムフォレスト
機会学習ハッカソン:ランダムフォレスト
 
ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33ロジスティック回帰の考え方・使い方 - TokyoR #33
ロジスティック回帰の考え方・使い方 - TokyoR #33
 
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
Map Reduce 〜入門編:仕組みの理解とアルゴリズムデザイン〜
 
一般向けのDeep Learning
一般向けのDeep Learning一般向けのDeep Learning
一般向けのDeep Learning
 
Ctfのためのpython入門
Ctfのためのpython入門Ctfのためのpython入門
Ctfのためのpython入門
 
トピックモデルを用いた 潜在ファッション嗜好の推定
トピックモデルを用いた 潜在ファッション嗜好の推定トピックモデルを用いた 潜在ファッション嗜好の推定
トピックモデルを用いた 潜在ファッション嗜好の推定
 
パターン認識 第10章 決定木
パターン認識 第10章 決定木 パターン認識 第10章 決定木
パターン認識 第10章 決定木
 
SVMについて
SVMについてSVMについて
SVMについて
 
はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-
はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-
はじめてでもわかるベイズ分類器 -基礎からMahout実装まで-
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

アルゴリズムイントロダクション 第2章

  • 2. 2010 CS     Copyright© 2010 tniky1 All rights reserved. Page 2
  • 3. 2010 CS   -  -    -    - Θ Copyright© 2010 tniky1 All rights reserved. Page 3
  • 4. 2010 CS Copyright© 2010 tniky1 All rights reserved. Page 4
  • 5. 2010 CS j 1 1 2 3 4 5 6 2 5 4 6 1 3 i length[A] procedure Insertion-Sort(A) for j ← 2 to length[A] do key ← A[j] i←j−1 while i > 0 and A[i] > key do A[i+1] ← A[i] i←i−1 A[i+1] ← key Copyright© 2010 tniky1 All rights reserved. Page 5
  • 6. 2010 CS (1) (2) Copyright© 2010 tniky1 All rights reserved. Page 6
  • 7. 2010 CS     -  A[1...j-1] → j 2 5 4 6 1 3 A[1...j-1] Copyright© 2010 tniky1 All rights reserved. Page 7
  • 8. 2010 CS   -  -  -  -  -  -  ( ) Copyright© 2010 tniky1 All rights reserved. Page 8
  • 9. 2010 CS j 2 5 4 6 1 3 A[1...j-1] for j ← 2 to length[A] J=2 do key ← A[j] A[1] A[1..j-1] i←j−1 while i > 0 and A[i] > key A[j] A[j-1],A[j-2]... do A[i+1] ← A[i] A[j] i←i−1 (A[1..j-1] ) A[i+1] ← key Copyright© 2010 tniky1 All rights reserved. Page 9
  • 10. 2010 CS j=n+1 1 2 3 4 5 6 A[1...j-1]=A[1..n] for j ← 2 to length[A] j=n+1 do key ← A[j] A[1..j-1]=A[1..n] ! i←j−1 while i > 0 and A[i] > key do A[i+1] ← A[i] i←i−1 A[i+1] ← key Copyright© 2010 tniky1 All rights reserved. Page 10
  • 11. 2010 CS (1) (2) Copyright© 2010 tniky1 All rights reserved. Page 11
  • 12. 2010 CS   -  -  -  ( )   -  ( DB DB ) -  Copyright© 2010 tniky1 All rights reserved. Page 12
  • 13. 2010 CS j 1 2 3 4 5 6 2 5 4 6 1 3 i n for j ← 2 to length[A] n do key ← A[j] n-1 i←j−1 n-1 while i > 0 and A[i] > key do A[i+1] ← A[i] i←i−1 tj A[i+1] ← key n-1 ( ) Copyright© 2010 tniky1 All rights reserved. Page 13
  • 14. 2010 CS for j ← 2 to length[A] C1 n do key ← A[j] C2 n-1 i←j−1 C3 n-1 while i > 0 and A[i] > key C4 do A[i+1] ← A[i] C5 i←i−1 C6 A[i+1] ← key C7 n-1 T(n) Copyright© 2010 tniky1 All rights reserved. Page 14
  • 15. 2010 CS T(n) ( ) j 1 2 3 4 5 6 [ ] 5 6 4 3 2 1 i=0 i tj=i Copyright© 2010 tniky1 All rights reserved. Page 15
  • 16. 2010 CS   -  -    -  -  -  Copyright© 2010 tniky1 All rights reserved. Page 16
  • 17. 2010 CS Copyright© 2010 tniky1 All rights reserved. Page 17
  • 18. 2010 CS A 2 4 5 7 1 2 3 6 p q r i j 1 2 3 4 5 1 2 3 4 5 L 2 4 5 7 ∞ R 1 2 3 6 ∞ n1 n2 k A 1 2 2 3 4 2 3 6 p q r Copyright© 2010 tniky1 All rights reserved. Page 18
  • 19. 2010 CS   -  A L R k−p -  L[i] R[j] L R A i j 1 2 3 4 5 1 2 3 4 5 L 2 4 5 7 ∞ R 1 2 3 6 ∞ k A 1 2 2 3 4 2 3 6 p r Copyright© 2010 tniky1 All rights reserved. Page 19
  • 20. 2010 CS i j 1 2 3 4 5 1 2 3 4 5 L 2 4 5 7 ∞ R 1 2 3 6 ∞ k A 1 2 2 3 4 2 3 6 p r k=p A[p..k-1] i=j=1 L,R L[i]<=R[j] L[i] A L[i] A[k] i k L[i],R[j] Copyright© 2010 tniky1 All rights reserved. Page 20
  • 21. 2010 CS i j 1 2 3 4 5 1 2 3 4 5 L 2 4 5 7 ∞ R 1 2 3 6 ∞ k A 1 2 2 3 4 2 3 6 p r k=r+1 A[p..k-1]=A[p..r] ! 2 n (n1+n2 ) : Θ(n) Copyright© 2010 tniky1 All rights reserved. Page 21
  • 22. 2010 CS MERGE Copyright© 2010 tniky1 All rights reserved. Page 22
  • 23. 2010 CS A p r p r A /* ( ) */ Copyright© 2010 tniky1 All rights reserved. Page 23
  • 24. 2010 CS -  a 1/b -  If n <= c -  D(n): -  C(n): Copyright© 2010 tniky1 All rights reserved. Page 24
  • 25. 2010 CS T(n) = aT(n/b) + D(n) + C(n) 2 Merge Θ(n) 1/2 a = b = 2 D(n) = Θ(1) T(n) = 2T(n/2) + Θ(1) + Θ(n) if n > 1 =Θ(1) if n = 1 Copyright© 2010 tniky1 All rights reserved. Page 25
  • 26. 2010 CS cn( ) Copyright© 2010 tniky1 All rights reserved. Page 26
  • 27. 2010 CS log2n Copyright© 2010 tniky1 All rights reserved. Page 27
  • 28. 2010 CS   OK -  -  Copyright© 2010 tniky1 All rights reserved. Page 28

Editor's Notes

  1. 12s それでは [ マインドマップをベースとした 複数人での情報共有システム ] について発表をはじめます。 発表者は、~です. よろしくお願いします。