Escolar Documentos
Profissional Documentos
Cultura Documentos
1001
sum = value1 + value2
0001
Compiler 0000
1001
0001
0001
Third-Generation and Fourth-
Generation (High-Level)
Languages (Continued)
Operating System
.NET: Language-Independent,
Mostly Platform Specific
Person.vb (Visual Basic) Windows
CLR
Person
CLR
MSIL
Deploy Windows
CLR
Company
Address MSIL
MSIL
Others?
Address.cs (C#)
CLR
Company.cbl
(Cobol)
Problem Solution and Software
Development
• Three overlapping phases of software development
– Design and development
– Documentation
– Maintenance
Apple, Bob
Atto, Tom
Attrick, Jerry
DeBanque, Robin Must check up to 8 names
Fresco, Al
Guini, Lynn What if millions of names?
Oki, Kerry
Wright, Eaton
Algorithm 2 – Binary Search
• Takes advantage of the fact that the list of names is sorted
• Start at the name in the middle of the list and compare to the
target
– If equal, there is a match!
– If the target is alphabetically less, repeat the process on the first half of
the list
– If the target is alphabetically greater, repeat the process on the second
half of the list
– Stop and no match if the list is ever empty
Algorithm 2 – Binary Search
• Searching for Guini, Lynn
Apple, Bob
Atto, Tom
Attrick, Jerry
DeBanque, Robin Guini, Lynn Guini, Lynn
Fresco, Al Oki, Kerry
Guini, Lynn Wright, Eaton
Oki, Kerry
Only checked 3 names!
Wright, Eaton
What if millions of names?
Algorithm Analysis
• Algorithm 1 runs in time linear to the number of names;
– 1 million names requires searching on average 500,000 names, all 1
million in the worst case
• Algorithm 2 runs in time log2 to the number of names
– This is because we cut the size in half each time
– For 1 million names, log2 1000000 is about 20.
– Much better performance than algorithm 1!