Chapter 5 Algorithms (1) Introduction to CS 1 st Semester, 2012 Sanghyun Park
Outline Informal Definition of an Algorithm FindLargest Three Basic Constructs Sorting Algorithms Searching Algorithms Recursion Algorithm Performance(next file) Time Complexity(next file) Asymptotic Notation(next file) Growth Rate(next file)
Informal Definition of Algorithm Used in Computer
Finding the Largest Number Among Five Integers
Defining Actions in FindLargest Algorithm
FindLargest Refined
Generalization of FindLargest
Three Basic Constructs
Flowcharts for Three Constructs
Pseudocode for Three Constructs
Concept of Subalgorithm
Summation
Product
Selection Sort
Example of Selection Sort (1/2)
Example of Selection Sort (2/2)
Selection Sort Algorithm
Bubble Sort
Example of Bubble Sort (1/2)
Example of Bubble Sort (2/2)
Insertion Sort
Example of Insertion Sort (1/2)
Example of Insertion Sort (2/2)
Search Concept
Example of Sequential Search (1/2)
Example of Sequential Search (2/2)
Sequential Search Algorithm When List is Sorted
Example of Binary Search
Binary Search Algorithm
Iterative Definition of Factorial
Recursive Definition of Factorial
Tracing Recursive Solution to Factorial Problem