Course Review 15-211 Fundamental Structures of Computer Science Ananda Guna May 04, 2006.

Slides:



Advertisements
Similar presentations
Chapter 9 Greedy Technique. Constructs a solution to an optimization problem piece by piece through a sequence of choices that are: b feasible - b feasible.
Advertisements

2012: J Paul GibsonT&MSP: Mathematical FoundationsMAT7003/L2-GraphsAndTrees.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
EECS 4101/5101 Prof. Andy Mirzaian. Lists Move-to-Front Search Trees Binary Search Trees Multi-Way Search Trees B-trees Splay Trees Trees Red-Black.
Greedy Algorithms Greed is good. (Some of the time)
Prof. Sin-Min Lee Department of Computer Science
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
Review. What to know You are responsible for all material covered in lecture, the readings, or the programming assignments There will also be some questions.
More sorting algorithms: Heap sort & Radix sort. Heap Data Structure and Heap Sort (Chapter 7.6)
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Chapter 9: Greedy Algorithms The Design and Analysis of Algorithms.
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
CS 206 Introduction to Computer Science II 04 / 29 / 2009 Instructor: Michael Eckmann.
Unit 11a 1 Unit 11: Data Structures & Complexity H We discuss in this unit Graphs and trees Binary search trees Hashing functions Recursive sorting: quicksort,
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Data Structures, Spring 2004 © L. Joskowicz 1 DAST – Final Lecture Summary and overview What we have learned. Why it is important. What next.
The Complexity of Algorithms and the Lower Bounds of Problems
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
Important Problem Types and Fundamental Data Structures
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
Teaching Teaching Discrete Mathematics and Algorithms & Data Structures Online G.MirkowskaPJIIT.
CS112A1 Spring 2008 Practice Final. ASYMPTOTIC NOTATION: a)Show that log(n) and ln(n) are the same in terms of Big-Theta notation b)Show that log(n+1)
Review – Part 1 CSE 2011 Winter September 2015.
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
CS 3610 Midterm Review.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
1 Trees A tree is a data structure used to represent different kinds of data and help solve a number of algorithmic problems Game trees (i.e., chess ),
10/20/20151 CS 3343: Analysis of Algorithms Review for final.
Review for Final Andy Wang Data Structures, Algorithms, and Generic Programming.
December 4, Algorithms and Data Structures Lecture XV Simonas Šaltenis Aalborg University
CS Data Structures II Review & Final Exam. 2 Topics Review Final Exam.
MA/CSSE 473 Day 28 Dynamic Programming Binomial Coefficients Warshall's algorithm Student questions?
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Final.
+ David Kauchak cs312 Review. + Midterm Will be posted online this afternoon You will have 2 hours to take it watch your time! if you get stuck on a problem,
Runtime O(VE), for +/- edges, Detects existence of neg. loops
Review for Final Exam – cs411/511 Definitions (5 questions, 2 points each) Algorithm Analysis (3 questions, 3 points each) General Questions (3 questions,
Chapter 4: Trees Part I: General Tree Concepts Mark Allen Weiss: Data Structures and Algorithm Analysis in Java.
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 29 April 2004.
Midterm Review 1. Midterm Exam Thursday, October 15 in classroom 75 minutes Exam structure: –TRUE/FALSE questions –short questions on the topics discussed.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
CS6045: Advanced Algorithms Sorting Algorithms. Heap Data Structure A heap (nearly complete binary tree) can be stored as an array A –Root of tree is.
 Saturday, April 20, 8:30-11:00am in B9201  Similar in style to written midterm exam  May include (a little) coding on paper  About 1.5 times as long.
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 28 April 2005.
Final Exam Review CS Total Points – 20 Points Writing Programs – 65 Points Tracing Algorithms, determining results, and drawing pictures – 50.
2016/3/13Page 1 Semester Review COMP3040 Dept. Computer Science and Technology United International College.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Final Exam Review COP4530.
Data Structures and Algorithms
CSE 326: Data Structures: Advanced Topics
Topics Covered after Mid-Term
Chapter 5 : Trees.
Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
Courtsey & Copyright: DESIGN AND ANALYSIS OF ALGORITHMS Courtsey & Copyright:
Cse 373 April 26th – Exam Review.
Data Structures and Algorithms
CS 3343: Analysis of Algorithms
CS 3343: Analysis of Algorithms
CSE 326: Data Structures: Midterm Review
CS 3343: Analysis of Algorithms
CS 3343: Analysis of Algorithms
Final Exam Review COP4530.
CS 3343: Analysis of Algorithms
CS 3343: Analysis of Algorithms
Important Problem Types and Fundamental Data Structures
CSE 326: Data Structures Lecture #24 Odds ‘n Ends
Major Design Strategies
Major Design Strategies
Presentation transcript:

Course Review Fundamental Structures of Computer Science Ananda Guna May 04, 2006

This course was about How to solve computing problems using: 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.

Data Structures/Algorithms -Complexity big-O, little-O, Omega etc.. - Lists - linked, doubly, singly, multi-linked - Trees - general, B-trees, BST, splay, AVL, etc. - Stacks and Queues - operations, analysis - Heaps - binary, binomial - Hash Tables - collisions, implementation - Graphs - traversals, shortest paths - FSM - regular expressions, KMP - String Matching - KMP, Boyer-Moore, Rabin-Karp.

Data Structures/Algorithms - Dynamic Programming - table(bottom-up), recursion(top-down) - memoization - Game Trees - mini-max, alpha-beta, iterative deepening - Sorting bubble, quick, insertion, selection -Algorithms -findMax, findMedian, reverse, MST, compression -Traversals, shortest path

Java Programming Object oriented programming. Correctness (loop invariants, induction). Time and space complexity. Debugging (test harness).

Studying for the Final Exam Review all material first Lectures, programs, quizzes Do sample finals – under time restrictions. Old finals are in blackboard/course material Types and difficulty of problems may be similar (some topics not covered)

Complexity

f(n) is O(g(n)) iff f(n) is o(g(n)) iff f(n) is Ω(g(n)) iff f(n) is θ(g(n)) iff f(n)=n 2 g(n) = n h(n) = log n

Complexity True or False? If true prove it, else give counter example

Space Complexity How much memory is needed to run the program quicksort merge Sort insertion sort Prim’s Dijkstra’s Key Point: consider the sizes of the data structures used

Solving Recurrences, Asymptotics Solve T(n) = 3 T(n/3) + 1 Prove the correctness By induction Invariants  Hold initially  Preserved after each iteration of loop or method call Or other methods

Complexity A is an array of integers

Complexity of known algorithms Algorithm Complexity(runtime) Bubble sortO(n 2 ) – average, worst, O(n) – best Insertion sortO(n 2 ) – average, worst, O(n) – best Selection sortO(n 2 ) – average, worst, best Find Max, Find minO(n), cannot be done in o(n) Find MedianWith sorting O(n*logn) but O(n) using quick select Quick sortO(nlogn) – average & best, O(n 2 ) – worst Merge SortO(nlogn) – average, best, worst Heap SortO(nlogn) – best, worst, average Build heapO(n)

Complexity of known algorithms Algorithm Complexity Heap – find minO(1) Heap – delete MinO(logn) Heap -insertO(logn) Hash – insert, find, delete O(1) Graph - buildO(V 2 ) – space (adjacency matrix) O(V+E) – space (adjacency list) Graph - TraverseO(E) Graph – Topological Sort O(V + E) Graph – Dijkstra’sO((E+V) logE) MST – prim’sO(E+V 2 )

Complexity of known algorithms Algorithm Complexity MST – Kruskal’sO(E logE) – sort the edges O(V logV) – find and union operations Dynamic Programming O(Table size) Linear with memoization Disjoint sets - unionO(logn) Disjoint sets - findO(logn) KMPO(n+m)

Sorting

Sorting and lower bounds Insertion Sort Selection Sort Heapsort Mergesort Quicksort Radix Sort

Sorting and lower bounds

Questions

Trees

Balanced Binary Trees

AVL 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

Splay Trees

Full, Complete and Perfect Trees Definitions Full, complete and perfect Ex: Show that a full binary tree with n leaves has (n-1) internal nodes. (use induction on n) Therefore a full binary tree with n leaves has (2n-1) nodes Ex: Start from the root and do a preorder traversal as follows. Write 1 for a node with 2 children. Visit left child, then right child. Write 0 if the node is a leaf. Therefore a full binary tree with 3 nodes can be represented by bit sequence 100. What is the bit sequence representing a full binary tree with 8 leaves?

Code Examples

Dictionaries

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)

Heaps

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

Binary heaps

Compression

LZW compression

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

Graphs

Adjacency lists and matrices Traversal (DFS, BFS) Reachability (DFS, BFS, Warshall) Shortest Paths (Dijkstra, Bellman- Ford) MST (Prim, Kruskal)

Graphs What is breadth first traversal(BFS)? What is depth first traversal(DFS)? What data structures can be used to implement each one? Reachability Connected components Topological sort

Graphs

Greedy Algorithms Find the Shortest Path from Node 1 to every other node

Dijkstra’s Algorithm

MST Find the MST using a. Prim’s Algorithm b. Kruskal’s algorithm

Homework 1.A graph G is bipartite if the vertex set V can be partitioned into two subsets L and R, such that every edge has one vertex in L the other in R. Give an example of a bipartite graph. 2.G is a tree if it is connected and acyclic. What is the number is edges in a tree with n nodes? 3. Draw all possible connected graphs G on 4 vertices and 3 edges. 4. Draw all possible connected graphs G on 4 vertices and 4 edges. 5. Suppose G is not connected. What the maximum number of edges in G? 5. Prove or give a counterexample to the following claim: Any tree is bipartite.

Dynamic Programming

Dependent subproblems, recursive solutions, memoizing, explicit tables. Knapsack Longest Common Subsequence Matrix Multiplication

Game Trees

Game trees

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

Disjoint Sets

Union-find

Regular Expressions

Exercises

Homework Write a regular expression of the alphabet {a, b, c, d} that describes all strings consisting of either an odd number of a's or an even number of b's, followed by any number (and ordering) of c's and d's. Zero is an even number and any number of x's can be zero x's. Draw a FSM to recognize any such string

String matching

Final Exam Monday, May 8, 8:00 –11:00 am Make sure not to be late.

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

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