CS146 Overview
Problem Solving by Computing
Human Level
Virtual Machine
Actual Computer
Virtual Machine Level L0
Languages, Levels, Virtual Machines
A multilevel machine
Languages, Levels, Virtual Machines
Problem Solving by Computing
Human Level
(Algorithms)
Machine Level Ln
(JAVA )
What is an Algorithm?
An algorithm is a well-defined computational procedure that takes some value or set of values, as input and produce some value or set of values as output.
A “tool” for solving a well-specified computational problem
Sorting Problem
Input: A sequence of numbers (a1, a2, . . .)
Output: A reording (a’1, a’2, . . .) of the input such that a’1 a’2 . . .
Simple Sorting Algorithms
1. Insertion Sort
2. Merge Sort
3. Quick Sort
Simple Sorting Algorithms
1. Insertion Sort
2. Merge Sort
3. Quick Sort
Insertion Sort
j 2 to length[A]
Do A[j] key
insert A[j] into A[1, 2, … j-1]
i j-1
While i > 0 and A[I]> key
Do A[i+1] A[i]
i i-1
A[i+1] key
5 2 4 6 1 3
j=2
2
i=j-1=1 Key=2
A[1]>key 1>0
5 2
Latent Semantic Index
Project:
Compute the LSI (Latent Semantic Index) of a set of web pages/text files, such as Google’s return.
Sort a web page or a text file (XML or Text) in alphabetical order
Latent Semantic Index
1. Sort a web page or a text file (XML or Text)
2. Create an Inverted file
Attached to each words a list of locations that this word has appeared
Latent Semantic Index
1. Applications
2. Use LSI, we can cluster (classify) the return of Google’s search into meaningful group