ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,

Slides:



Advertisements
Similar presentations
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Advertisements

ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Tort Law: Concurrent Tortfeasors Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Contract Law, Tort and Intellectual Property Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
CSCE 210 Data Structures and Algorithms
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
TDDB57 DALG-C, DALG Exam Requirements Jan Maluszynski - HT 2006DALG-C.1 TDDB57 – DALG-C Examination Requirements.
Data Structures, Spring 2004 © L. Joskowicz 1 DAST – Final Lecture Summary and overview What we have learned. Why it is important. What next.
DAST, Spring © L. Joskowicz 1 Data Structures – LECTURE 1 Introduction Motivation: algorithms and abstract data types Easy problems, hard problems.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Contract Law: Legality Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario,
Algorithm design techniques
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Tort Law: Negligence Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
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.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Contract Law: Parol Evidence Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
December 4, Algorithms and Data Structures Lecture XV Simonas Šaltenis Aalborg University
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
HASHING PROJECT 1. SEARCHING DATA STRUCTURES Consider a set of data with N data items stored in some data structure We must be able to insert, delete.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 Asymptotic Analysis Outline In this topic, we will look at: –Justification for analysis –Quadratic and polynomial growth –Counting machine instructions.
1 Linked Lists Assignment What about assignment? –Suppose you have linked lists: List lst1, lst2; lst1.push_front( 35 ); lst1.push_front( 18 ); lst2.push_front(
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
1 Graph theory Outline A graph is an abstract data type for storing adjacency relations –We start with definitions: Vertices, edges, degree and sub-graphs.
ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo,
Outline This topic covers merge sort
Poisson distribution.
Open addressing.
All-pairs shortest path
Outline This topic covers Prim’s algorithm:
Sorting algorithms.
Sorting algorithms.
Algorithms and templates
Presentation transcript:

ECE 250 Algorithms and Data Structures Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca © by Douglas Wilhelm Harder. Some rights reserved. Douglas Wilhelm Harder, M.Math. LEL Department of Electrical and Computer Engineering University of Waterloo Waterloo, Ontario, Canada ece.uwaterloo.ca © by Douglas Wilhelm Harder. Some rights reserved. Course summary

2 Outline In this course, we have seen: –Data and data relationships –Asymptotic analysis of algorithms –Various data structures for storing Ordered/sorted data, Hierarchically ordered data, Unordered data, and Adjacency and partially ordered data, –An introduction to various problem solving techniques

3 Course summary Asymptotic analysis In asymptotic analysis, we covered: –Little-o, big-theta, and little-omega –Given any two functions of the form we’re interested in, it will always be that exactly one of these three must hold:

4 Course summary Asymptotic analysis In some cases, however, an algorithm may exhibit behaviour that may be described as “linear or faster” or “no better than n ln(n) ” –For these, we use big-O and big-Omega: We examined basic recurrence relations: f(n) = 2 f(n/2) + 1 and f(1) = 1 ⇒ f(n) = n + n lg(n) f(n) = f(n – 1) + n and f(1) = 1 ⇒ f(n) = ½ n(n + 1)

5 Course summary Asymptotic analysis We looked at algorithms, namely: –Operations  (1) –Function calls –Conditional statements –Loops O(n k ) –Recursive functions T(n) = T(n/2) + O(n)

6 Course summary Relations We discussed a number of possible relations between objects: –Linear orderings –Hierarchical orderings –Partial orderings –Equivalence relations –Weak orderings –Adjacency relations

7 Course summary Data structures For storing linearly ordered data, we examined: –Linear structures: –Tree structures:

8 Course summary Data structures The linear structures we examined were: –Arrays –Linked lists –Stackslast-in first-outLIFO –Queuesfirst-in first-outFIFO –Deques

9 Course summary Data structures The tree structures we examined were: –General trees –Binary trees –Binary search trees –AVL trees –B trees –Binary heaps General and binary trees are useful for hierarchically ordered data

10 Course summary Data structures For sorting algorithms, we examined: AlgorithmRun-TimeMemory Insertion Sort O(n + d )  (1) Bubble Sort O(n + d )  (1) Heap Sort  (n ln(n))  (1) Merge Sort  (n ln(n)) (n)(n) Quick Sort  (n ln(n))  (ln(n)) Bucket Sort  (n + m) (m)(m) Radix Sort  (n log b (N)) (n)(n)

11 Course summary Data structures For storing unordered data, we examined hash tables We looked at two styles of hash tables: –Chained hash tables –Hash tables with open addressing Techniques for collision management with open addressing include: –Linear probing –Double hashing

12 Course summary Data structures With graphs, we examined three common problems: –Finding topological sorts –Finding minimum spanning trees (Prim) –Single-source shortest paths (Dijkstra)

13 Course summary Algorithms For algorithms, we considered both algorithm design techniques and a quick introduction to the theory of computation: –Greedy algorithms –Divide-and-conquer algorithms –Dynamic programming –Backtracking algorithms –Branch-and-bound algorithms –Stochastic algorithms

14 Course summary Algorithms We concluded by looking at aspects of the theory of computation: –What can we compute? The Turing machine –What can we definitely not solve no-matter-what? The halting problem –What can we solve efficiently? Deterministic polynomial-time algorithms, NP and NP Completeness

15 Course summary Applications Finally, we looked at the old-Yale sparse-matrix representation –AMD G3 circuit: × matrix non-zero entries zero entries

16 Course summary Back to the Start On the first day, I paraphrased Einstein: Everything should be made as simple as possible, but no simpler. Hopefully I have shown that, while many data structures and algorithms appear complex, once you understand them, they are much simpler, and often intuitive...

17 Course summary Summary of the Summary We have covered –A variety of data structures –Considered efficient and inefficient algorithms –Considered various algorithm design techniques –Introduced you to the theory of computation The efficient storage and manipulation of data will significantly reduce costs in all fields of engineering –More than any other one course, you will see this over-and-over again Good luck on your exams!

18 Course summary A Few Words from an Old Master… Are there any questions? An algorithm must be seen to be believed. Donald Knuth Always remember, however, that there’s usually a simpler and better way to do something than the first way that pops into your head. Donald Knuth photo by Jacob Appelbaum

19 Course summary References Wikipedia, These slides are provided for the ECE 250 Algorithms and Data Structures course. The material in it reflects Douglas W. Harder’s best judgment in light of the information available to him at the time of preparation. Any reliance on these course slides by any party for any other purpose are the responsibility of such parties. Douglas W. Harder accepts no responsibility for damages, if any, suffered by any party as a result of decisions made or actions based on these course slides for any other purpose than that for which it was intended.