


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Pleliminaries introduction
Typology: Slides
1 / 4
This page cannot be seen from the preview
Don't miss anything!



Some of the points that we discussed in lecture one:
The course has 3 parts, roughtly 4 weeks each.
All of the above are important; from a broad perspective doing the above eases and improves your understanding of algorithms desing related issues. From a narrower, but nonetheless impor- tant perspective they make coursework/exam problems easier to solve, you get higher marks, and everyone’s life better.
Why study algorithms: intrinsic part of everyday life; no iPhone, PlayStation, Google Search, MapQuest, Internet possible without algorithms (N.B. some may think that the absence of these things is not necessarely a bad thing :) ) When solving a problem (e.g. given the street map of a city find the shortest distance between point A and point B), the first step is to build an abstraction. Specifially, we construct a mathe- matical model of what the problem is and what a solution for the problem looks like. For example, the above problem on the shortest path translates to: Input: given a directed graph (V, E), a weight function ω : E → N, and two vertexes A, B ∈ V. Output: find a sequence of vertexes V 0 , V 1 ,... , Vk such that V 0 = A, Vk = B and (Vi, Vi+1) is an edge in E (so far we have expressed that we want a path from A to B), and the total sum of the weights
∑k i=0 ω((V^0 , V^1 )) should be minimal across all paths from^ A^ to^ B. Notice that building the model for the problem is usually the easy step, although sometimes it is unclear how to choose the right abstraction among several posibilities. The next step, and this is what we study in this class is to produce an algorithm which for any input (of the right form) produces the desired output. We will study several algorithm-related issues. The Algorithm design part surveys algorithms for solving problems as the one above. Here we study several techniques (e.g. greedy, divide&conquer, dynamic programming) for solving a variety of problems. Think about these techniques as a tool-box. Later, when you are faced with a problem, ideally you will know how to use one, or more tools from the tool-box to solve it. Remember: the goal is to understand the design paradigms that are used in these algorithms so that you can then apply them to create algorithms for different problems. The Algorithm analysis part covers issues that have to do with understanding how well an algorithm performs. In particular we will look at:
2 Math preliminaries
In the first couple of lectures we will study some of the mathematical tools that you need for this course.
In the first lecture we already looked at proofs by induction. This is a crucial tool for the problems that you’ll have to solve in this class. The technique is quite simple: To show that a statement P (n) is true for all natural numbers n or, more formally, to prove
(∀n ∈ N)P (n)
we proceed as follows:
∑^ k
i=
i^2 = k(k + 1)(2k + 1) 6
We show that P (k + 1) is true. We have that:
k∑+
i=
i^2 =
∑^ k
i=
i^2 + (k + 1)^2 (1)
k(k + 1)(2k + 1) 6
= (k + 1)(2k^2 + 7k + 6) 6
(k + 1)(k + 2)(2k + 3) 6
Equation (1) is just rewritting of the left-hand side, equation (2) follows from the induction hypothesis, equations (3) and (4) are just basic symbol manipulation. We have thus shown that: ∑k+
i=
i^2 = (k + 1)(k + 2)(2k + 3) 6
(which is precisely P (k + 1)). We therefore have that (∀k)P (k) ⇒ P (k + 1).
Further reading