This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CS161 - Introduction David Kauchak • “For me, great algorithms are the poetry of computation. Just like verse, they can be terse, allusive, dense and even mysterious. But once unlocked, they cast a brilliant new light on some aspect of computing.” – Francis Sullivan • What is an algorithm? • Examples – sort a list of numbers – find a route from one place to another (cars, packet routing, phone routing, ...) – find the longest common substring between two strings – add two numbers – microchip wiring/design (VLSI) – solving sudoku – cryptography – compression (file, audio, video) – spell checking – pagerank – classify a web page – ... • What properties of algorithms are we interested in? – does it terminate? – is it correct, i.e. does it do what we think it’s supposed to do? – what are the computational costs? – what are the memory/space costs? 1 – what happens to the above with different inputs? – how difficult is it to implement and implement correctly? • Why are we interested? Most of the algorithms/data structure we will discuss have been around for a while and are implemented. Why should we study them? – For example, look at the java.util package * Hashtable * LinkedList * Stack * TreeSet * Arrays.binarySearch * Arrays.sort – Know what’s out there/possible/impossible – Know the right algorithm to use – Tools for analyzing new algorithms – Tools for developing new algorithms – interview questions? :) * Describe the algorithm for a depth-first graph traversal. * Write a function f(a, b) which takes two character string arguments and returns a string containing only the characters found in both strings in the order of a. Write a version which is O( n 2 ) and one which is O( n )....
View Full Document
- Summer '09
- Algorithms, new algorithms, Length length, algorithm correct, algorithm Sparse vector