SlideShare ist ein Scribd-Unternehmen logo
1 von 24
insert 2 merge


                 Yun-Yan Chi
                 Dec 21, 2011
• insertion sort 2 merge sort
• two level nested condition
 • poslen
 • transposition!
• for each direction (forward and backward)
 • 4 branches
 • totally, 8 branches
2
        1
    0
?
3
        2
    1
0
2
?       1
    0
1’
    (   ?   0’        )
0
3
    1   2
0
forward
if     c1

     then if       c2

                 then   b1   else   b2

     else   if     c2

                 then   b3   else   b4
if     c1

     then if       c2

                 then   b1   else   b2

     else   if     c2

                 then   b3   else   b4
if     c2

     then if       c1

                 then   b1   else   b3

     else   if     c1

                 then   b2   else   b4
if     c1

     then if       c2

                 then    b1   else   b2

     else   if     c2’

                 then    b3   else   b4
backward
generalization!

Weitere ähnliche Inhalte

Mehr von Yun-Yan Chi

Machine X Language
Machine X LanguageMachine X Language
Machine X LanguageYun-Yan Chi
 
Examples for loopless
Examples for looplessExamples for loopless
Examples for looplessYun-Yan Chi
 
Data type a la carte
Data type a la carteData type a la carte
Data type a la carteYun-Yan Chi
 
Genetic programming
Genetic programmingGenetic programming
Genetic programmingYun-Yan Chi
 
Paper presentation: The relative distance of key point based iris recognition
Paper presentation: The relative distance of key point based iris recognitionPaper presentation: The relative distance of key point based iris recognition
Paper presentation: The relative distance of key point based iris recognitionYun-Yan Chi
 
Deriving a compiler and interpreter for a Multi-level
Deriving a compiler and interpreter for a Multi-level Deriving a compiler and interpreter for a Multi-level
Deriving a compiler and interpreter for a Multi-level Yun-Yan Chi
 
Number System in Haskell
Number System in Haskell Number System in Haskell
Number System in Haskell Yun-Yan Chi
 
Constructing List Homomorphisms from Proofs
Constructing List Homomorphisms from ProofsConstructing List Homomorphisms from Proofs
Constructing List Homomorphisms from ProofsYun-Yan Chi
 

Mehr von Yun-Yan Chi (9)

Machine X Language
Machine X LanguageMachine X Language
Machine X Language
 
Examples for loopless
Examples for looplessExamples for loopless
Examples for loopless
 
Any tutor
Any tutorAny tutor
Any tutor
 
Data type a la carte
Data type a la carteData type a la carte
Data type a la carte
 
Genetic programming
Genetic programmingGenetic programming
Genetic programming
 
Paper presentation: The relative distance of key point based iris recognition
Paper presentation: The relative distance of key point based iris recognitionPaper presentation: The relative distance of key point based iris recognition
Paper presentation: The relative distance of key point based iris recognition
 
Deriving a compiler and interpreter for a Multi-level
Deriving a compiler and interpreter for a Multi-level Deriving a compiler and interpreter for a Multi-level
Deriving a compiler and interpreter for a Multi-level
 
Number System in Haskell
Number System in Haskell Number System in Haskell
Number System in Haskell
 
Constructing List Homomorphisms from Proofs
Constructing List Homomorphisms from ProofsConstructing List Homomorphisms from Proofs
Constructing List Homomorphisms from Proofs
 

Insert 2 Merge

  • 1. insert 2 merge Yun-Yan Chi Dec 21, 2011
  • 2. • insertion sort 2 merge sort • two level nested condition • poslen • transposition! • for each direction (forward and backward) • 4 branches • totally, 8 branches
  • 3. 2 1 0 ?
  • 4. 3 2 1 0
  • 5. 2 ? 1 0
  • 6. 1’ ( ? 0’ ) 0
  • 7. 3 1 2 0
  • 9.
  • 10. if c1 then if c2 then b1 else b2 else if c2 then b3 else b4
  • 11. if c1 then if c2 then b1 else b2 else if c2 then b3 else b4
  • 12. if c2 then if c1 then b1 else b3 else if c1 then b2 else b4
  • 13.
  • 14. if c1 then if c2 then b1 else b2 else if c2’ then b3 else b4
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 22.
  • 23.