Presentation is loading. Please wait.

Presentation is loading. Please wait.

Course Review 15-211 Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004.

Similar presentations


Presentation on theme: "Course Review 15-211 Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004."— Presentation transcript:

1 Course Review 15-211 Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004

2 What was this course about? How to solve computing problems. Problem analysis, to abstract away details and divide into smaller subproblems. Mathematical foundations for precise formulations of problems and solutions. Data structures and algorithms to solve problems correctly and efficiently. Java programming and modular software construction for good implementations.

3 The science in CS Not “hacking”, but: Thinking about problems abstractly. Selecting good data structures and obtaining correct and fast algorithms. Implementing programs that are understandable and correct.

4 Topics Covered Simple list algorithms Solving simple recurrences Dictionaries: Binary trees, tries, hash tables Priority queues and binary heaps Data compression Sorting String matching

5 Topics Covered ctd.. Graphs Greedy algorithms Dynamic programming Game trees Client-server computing Equivalence relations and union find Computational geometry

6 Studying for the Final Exam Review all material first Lectures, programs, quizzes Do sample finals – under time restrictions Old Finals are in blackboard/assignments Types and difficulty of problems may be similar

7 List Algorithms List Interface Reversing a list rev(L) = L if |L|=1 rev(L) = append(first(L),rev(tail(L))) What is the complexity?

8 Solving Recurrences, Asymptotics Solve T(n) = 3 T(n/3) + 1 Prove the correctness By induction Or other methods Big-Oh, little-oh, Big-Omega, Theta

9 Binary Trees 1.Traverse the tree inorder 2.Do exactly two rotations so that the tree is balanced 3. Consider a binary tree of height h a.What are the max and min number of nodes? b.What are the max and min number of leaves? 4. Perfect, full, complete trees

10 AVL trees

11 Dictionaries

12 Hashing Describe why hashing a string to sum of its characters is not a good idea. Assume S = a 1 a 2 ….a n is a string Define H(S) =  a i 2 i-1 (i=1..n) Describe a way to efficiently calculate H(S)

13 Priority Queues and Heaps Suppose you implement a priority queue using following Unsorted array Linked list (smallest at front) Heap What is the complexity in each case for deleteMin insert

14 Binary heaps

15 Compression and Huffman’s

16 LZW compression

17 Data Compression Encode “I AM SAM SAM I AM SAM SAM” using Huffman compression LZW In each case calculate the compression ratio Is it possible to apply Huffman after applying LZW? If so apply Huffman to output generated by LZW above

18 Sorting and lower bounds

19 Sorting Insert the random set of numbers {10, 12, 5, 15, 8, 14,11,7} into a BST with AVL properties. Fred has suggested that he can sort a list using hash table. The idea is the following. Assume that there are n numbers in the set. He would find the max and min and create a hash table of size (max-min). Then Fred would simply run an iterator I from min to max and use the hash map H(I) = I mod (max-min) if I is in the set. He claims that this is a sorting algorithm of O(n). What can you tell Fred? Politely please.

20 String matching

21 Graphs What is breadth first traversal? What is depth first traversal? What data structures can be used to implement each one? Fred claims that if the degree of each node in an undirected graph of n nodes is (n-1), then graph has n(n- 1) edges. Can this statement be true?

22 Graphs

23 Greedy Algorithms 100 5060 30 50 60 20 50 20 60 40 50 150 40 20 40 20 40 10 Find the Shortest Path from Node 1 to every other node

24 Dynamic Programming Dependent subproblems, recursive solutions, memoizing, explicit tables. Knapsack Longest Common Subsequence Matrix Multiplication Floyd-Warshall-Kleene

25 Dynamic Programming Consider a sequence of n numbers, A = {a 1, a 2, a 3,..., a n }. A subsequence of a given sequence is just the given sequence with 0 or more of the elements removed. Let's find an algorithm that finds the subsequence, A' = {a i1, a i2, a i3,...a ik } of A that maximizes a i1 - a i2 + a i3 -... +- a ik (i.e. the sign alternates).

26 Game trees

27 Games 2-person, deterministic, complete information,... Backtracking MiniMax Alpha-beta pruning Heuristics, iterative deepening, move order, tricks,...

28 Client-Server Computing

29 Union-find

30 Computational Geometry

31 Points, lines, rays, line segments Intersection, turns Membership in region Jarvis' March Graham Scan Divide-and-Conquer (QuickHull,...) Lower Bound

32 Grades 1 “warmup”. 3 small homeworks. 3 large homeworks. 3 quizzes. Midterm exam. Final exam. TA discretion. 39 points. 50 points each. 100 points each. 20 points each. 125 points. 275 points. 50 points. SUBJECT TO CHANGE

33 Final Exam Tuesday, May 4, 5:30 – 8:30 pm McConomy (*not* in DH) Sugary stuff will be provided... Make sure not to be late.

34 Final Exam Closed book, no calculators, cell phones, pagers, IM, … You can bring 1 (one) page of notes.

35 Conclusion Review all material Do all sample quizzes and finals Good luck!!


Download ppt "Course Review 15-211 Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004."

Similar presentations


Ads by Google