Algorithms and Data Structures Lecture XV - PowerPoint PPT Presentation

About This Presentation
Title:

Algorithms and Data Structures Lecture XV

Description:

Produced using Dieter Pfoser's s as basis ... Lecture XV Simonas altenis Aalborg University simas_at_cs.auc.dk – PowerPoint PPT presentation

Number of Views:112
Avg rating:3.0/5.0
Slides: 15
Provided by: Simona170
Category:

less

Transcript and Presenter's Notes

Title: Algorithms and Data Structures Lecture XV


1
Algorithms and Data StructuresLecture XV
  • Simonas Å altenis
  • Aalborg University
  • simas_at_cs.auc.dk

2
Results of the questionnaire
  • Problematic lectures

3
This Lecture
  • What have we learned?
  • Summary-Pensum
  • Solving exercises
  • Recurrences
  • Graph exercises
  • ADT exercises
  • Dvide and conquer algorithms

4
The Course Pensum
  • Toolbox of algorithmic techniques
  • Divide and Conquer
  • Merge sort, Quicksort, Binary search
  • Dynamic programming
  • Matrix chain multiplication, Longest Common
    Subsequence not in exam pensum, except basic
    understanding of LCS
  • Greedy algorithms
  • Prims, Kruskals, Dijkstras
  • Analysis of algorithms
  • Correctness of algorithms
  • Loop invariants not in exam pensum
  • Asymptotic notations
  • Recurrences

5
The Course Pensum (2)
  • Building algorithms - concept of ADT
  • Toolbox of data structures
  • Simple data structures and ADTs
  • array, all sorts of linked lists, stacks, queues,
    trees, heaps
  • Dictionaries
  • hash tables
  • binary search trees (unbalanced)
  • red-black trees

6
The Course Pensum (3)
  • Toolbox of algorithms
  • Sorting
  • insertion sort, selection sort
  • merge sort
  • quick sort
  • heap sort (priority queues)
  • Graphs
  • memory representation
  • graph traversal
  • breadth-first search
  • depth-first search (topological sort)
  • minimum spanning trees (Prim, Kruskal)
  • shortest path (Dijkstra, Bellman-Ford)

7
The Exam
  • The exam will be written, you will have three
    hours.
  • Two parts
  • Multiple-choice, quiz-style part tests basic
    knowledge, understanding of the core concepts
  • Creative exercises come up with algorithms,
    analyze them, argue for your solutions.

8
Preparation for the Exam
  • To prepare for the exam
  • Concentrate on solving the exercises, not
    studying the textbook (although you have to know
    the concepts!)
  • Solve exercises from last year exams
  • When solving write your solutions down!
  • On Jan 16, 1300 come to B2-104 (here) and have
    your questions answered.
  • Or pass by my office E1-215b!
  • Good news solutions to hand-in exercises will be
    posted on the web before Christmas!

9
Solving Recurrences
  • Repeated substitution procedure
  • Substitute, expand, substitute, expand
  • Observe a pattern and write how your expression
    looks after the i-th substitution
  • Find out what the value of i (e.g., lgn or n-1)
    should be to get the base case of the recurrence
    (e.g., T(1))
  • Insert the value of T(1) and the expression of i
    into your expression
  • Compute your recurrence for small values and
    check if your general solution gives the same
    results!

10
Types of Recurrences
  • Number of substitutions i
  • If T(n) T(n - 1) and base case T(k)
  • then i n k
  • If T(n) T(n/b) and base case T(k)
  • then i logb(n/k)

11
Types of recurrences II
  • T(n) aT(n b) c
  • T(n) aT(n/b) cn d
  • Geometric series
  • T(n)T(n b) cn d
  • Arithmetic series
  • Prove it yourself!

12
Graph Exercises
  • Types of graph exercises
  • Decide what are the vertices and what are the
    edges
  • Un-weighted graphs
  • Traverse and check(do) something gt use DFS or
    BFS
  • Find shortest paths gt use BFS
  • Schedule or order dependent activities or
    processes gt use Topological sorting

13
Graph Exercises
  • Types of graph exercises
  • Weighted graphs
  • Decide what are the weights
  • Shortest paths, shortest times gt use Dijkstras
  • Minimum (maximum) spanning tree gt use Prims or
    Kruskals
  • Finding a critical path in a schedule (longest
    path in a DAG) gt use Topological sorting on a
    DAG of activities

14
Do not forget
  • Write preconditions (INPUT) and postconditions
    (OUTPUT) of your algorithms
  • You can only use the ADT operations provided in
    the exercise !!!
Write a Comment
User Comments (0)
About PowerShow.com