<<

CS 270

Oliver Week 11 Kullmann

Introduction

Algorithms and their Revision analysis Graphs

Data 1 Introduction structures Conclusion 2 Algorithms and their analysis

3 Graphs

4 Data structures

5 Conclusion CS 270 General remarks Algorithms Oliver Kullmann

You need to be able to perform the following: Introduction Algorithms and their Reproducing all definitions. analysis Performing all computations on (arbitrary) examples. Graphs Data Explaining all algorithms in (written) words (possibly using structures

some mathematical formalism). Conclusion Stating the in term of Θ.

Check all this by writing it all down!

Actually understanding the definitions and algorithms helps a lot (but sometimes “understanding” can become a trap). CS 270 How to prepare Algorithms Oliver Kullmann

All information is on the course homepage Introduction Algorithms and their analysis

Graphs http://cs.swan.ac.uk/~csoliver/Algorithms201314/index.html Data structures

Conclusion Go through all lectures (perhaps you download the slides again — certain additions have been made). Go through the courseworks and their solutions. Go through the lab sessions (run it!).

Use the learning goals! CS 270 On the exam Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis

We use the “two-out-of-three” format. Graphs

Data Give us a chance to give you marks — write down structures something! Conclusion Actually, better write down a lot — in the second or third round, after answering all questions. Examples are typically helpful. CS 270 The general structure of the module Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis

Graphs

Data 1 Weeks 1-3: Algorithms and their analysis structures 2 Weeks 4-5: Graphs — BFS and DFS. Conclusion 3 Weeks 6-10: Data structures. CS 270 Sorting algorithms Algorithms Oliver Kullmann

Introduction

Algorithms and their We considered four sorting algorithms in detail: analysis

Graphs Insertion-Sort, , -Sort and Quick-Sort. Data structures

Conclusion These algorithms you should know in detail.

Know their run-times. Know how to derive these run-times. Explain them, and know their differences and similarities. CS 270 Order of growth Algorithms Oliver Kullmann

Get a working understanding of Introduction Algorithms O, Ω, Θ and their (that is, know how to use them, and how to work with them). analysis Graphs

Data This includes developing an intuitive grasp on the main types of structures Conclusion growth rates:

n log n, √n, n, n log n, n2, n3, 2 , n!

You need also to know the definitions. And you need to know the various techniques for working with terms/expressions/formulas (“rewrite rules”). CS 270 Solving recurrences Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis Know the (simplified) master theorem! Graphs Data structures

Conclusion Especially know the three cases. And know various examples.

It’s mostly practice. CS 270 Concepts Algorithms Oliver Kullmann

Introduction

For graphs, various definitions and their relations are of central Algorithms importance: and their analysis

Graphs 1 Know the definitions of “graphs” and “digraphs”. Data 2 Know the definition of a “dag”. structures Conclusion 3 Know the definition of “connected (di)graphs”. 4 Know the definition of a “”. 5 Know what a “rooted tree” is: 1 Many important notions are connected to it (“root, children, parent, leaf”). 2 Know what “ordered rooted trees” are. 3 Know what “binary trees” are. CS 270 Basic graph algorithms Algorithms Oliver Kullmann

You need to know BFS, DFS well. Introduction Algorithms and their analysis

This means: Graphs

Data 1 Be able to explain them (including pseudo-code). structures Conclusion 2 Be able to run them (on paper). 3 How are the trees resp. forests represented? 4 Know what d[u] for BFS is. 5 Know what d[u], f [u] for DFS is.

A basic application of BFS or DFS is the detection of cycles (understand this, for graphs and digraphs). Another application of DFS is topological sorting. CS 270 Stacks and queues Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis

Most important here is Graphs

Data the abstract data type (ADT), structures Conclusion i.e., what are the operations and what is their meaning?

Also essential (and easy) is to know the complexity of these operations in the standard implementation. CS 270 Linked lists Algorithms Oliver Kullmann

Introduction

Algorithms and their Here most important are analysis Graphs

Data how are (doubly) linked lists implemented? structures how is insertion performed? Conclusion how is deletion performed?

As usual, you need to know the complexity of the basic operations (which includes searching in lists). CS 270 Binary search trees Algorithms Oliver Kullmann

Don’t mix up these trees with the spanning trees we Introduction encountered with graphs. Algorithms and their analysis

Know the basics of the abstract data types considered. Graphs

Data Know and understand the notion of a “”. structures Understand searching in such trees. Conclusion Understand insertion and deletion (be able to perform it, and to explain the algorithms in general).

Important is to understand the dependency of the complexity of the operations on the height of the trees. CS 270 Hash tables Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis Essential are the ideas: Graphs Data It’s all about hash functions. structures Conclusion Direct addressing is an important special case. Collisions can be solved rather efficiently by the chaining method. CS 270 Binary heaps Algorithms Oliver Kullmann

Introduction

Algorithms and their Again, essential are the ideas: analysis Graphs

“Binary heaps” are “complete” binary trees with the “heap Data property”. structures Conclusion We have an efficient array-based implementation. “Heapification” is a key procedure. 1 With it we can build a binary heap efficiently. 2 Heap-Sort is another application. 3 And we get an efficient implementation of priority queues. CS 270 Quick-Sort Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis Again, understand the ideas: Graphs Data Pseudo-code for the main procedure should be easy. structures Conclusion A different form of partitioning (different from Merge-Sort). Know the key points of the analysis (“good on average”, “bad on worst-case”). CS 270 Further remarks Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis Compared to previous years: elementary hashing could Graphs Data come up. structures You should be able to develop simple divide-and-conquer Conclusion algorithms, analysing them via recurrences, and determine an expression Θ(n) for their run-time via the (always simplified) Master Theorem. CS 270 The end Algorithms Oliver Kullmann

Introduction

Algorithms and their analysis

Graphs

Data structures I wish you a productive preparation phase. Conclusion