DOC PREVIEW
UT Dallas CS 6363 - lec1

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture #1:Characterization of types of algorithms: Off-line vs on-line algorithms; de-terministic vs randomized algorithms; exact vs approximation algorithms; se-quential vs parallel algorithms; centralized vs distributed algorithms. Thiscourse primarily deals with off-line, deterministic, exact, sequential,centralized algorithms.What bothers most of about this course (and similar other courses) is thefact that there are no algorithms to show how algorithms are designed. This areais somewhat similar to solving mathematics puzzles. Results are not guaranteedbased on effort or time spent.Types of Algorithms based on methods used:1. Divide and Conquer2. Greedy Methods3. Dynamic Programming4. Incremental Algorithms (also known as inductive algorithms)5. Improvement Algorithms6. Parametric algorithms7. Duality based algorithmsExample 1 Binary Search: Worst case effort: Θ(log2n)• Given a sorted array of n numbers, A[1, 2, ..., n], and a number x.Permitted operations: Given two numbers, x and y check which of thefollowing holds: (i)x = y; (ii)x < y; or (iii)x > yQuestion: Is x = A[j] for some j between 1 and n? If the answer is yes,output j; else output no (some times we may give an interval [i, i + 1]such that A[i] < x < A[i + 1]).BINARY-SEARCH(A[i, j], x)if j < i STOP.k ←i+j2if A[k] = x, STOPelse if A[k] < x, do BINARY-SEARCH(A[i, k], x)else do BINARY-SEARCH(A[k + 1, j], x)This is an example of divide and conquer where we get one subproblem ofhalf the size.Recursion encountered: t(n) = 1 + t(n2)1Example 2 Tower of Hanoi/Brahma: Effort: 2m− 1• Given three rods numbered 1,2, and 3 with m rings on rod 1 and noneon rods 2 and 3. The rings on rod 1 are stacked in order of size with thesmallest on top. (like the toy children play with)Permitted operations: Move the top ring on any rod to any other rodprovided that at no time a larger ring is on top of a smaller ring on anyrod.Question: Want to move the rings from rod 1 to rod 2 with minimumnumber of moves.Recursion: t(n) = 1 + 2t(n − 1)Example 3 Insertion Sort: (CLR has a pseudocode)• Effort:n(n−1)2in the worst case; (n − 1) in the best case.If we use Binary search in determining the location to insert, the worstcase effort becomes n−1i=1log2i and this is Θ(n log2n)Example 4 Merge Sort:: (CLR pages 12-15):• Effort: Θ(n log2n) in the worst case. This is an example of divide andconquer where we get two subproblems of half the size.Recursion: t(n) = 2t(n2) + Θ(n)Example 5 Tiling:• Given a square board of size 2kdivided into 22kequal size squares of size1 (like in a chess/checker board). An arbitrary square is declared special.Also given tiles which are squares of size 2 with one square removed.Question: Can we cover all the squares in the bigger board (except thespecial square) with tiles of the above type? If so, provide a method to do2this. See the picture below for the case with k = 2:This is also an example of Divide and conquer. Here we get 4 subproblemsof size 2k−1. But three of the problems are the


View Full Document

UT Dallas CS 6363 - lec1

Documents in this Course
Exam #1

Exam #1

5 pages

lec4

lec4

5 pages

lec3

lec3

5 pages

lec1

lec1

3 pages

lec14

lec14

11 pages

lec13

lec13

22 pages

lec12

lec12

8 pages

lec11

lec11

3 pages

lec10new

lec10new

11 pages

lec9

lec9

13 pages

lec8

lec8

9 pages

lec7

lec7

10 pages

lec6

lec6

8 pages

lec7

lec7

10 pages

lec6

lec6

8 pages

lec4

lec4

5 pages

lec3

lec3

5 pages

lec1

lec1

3 pages

lec14

lec14

11 pages

lec13

lec13

22 pages

lec12

lec12

8 pages

lec11

lec11

3 pages

lec10new

lec10new

11 pages

lec9

lec9

13 pages

lec8

lec8

9 pages

lec4

lec4

5 pages

lec3

lec3

5 pages

lec1

lec1

3 pages

lec14

lec14

11 pages

lec13

lec13

22 pages

lec12

lec12

8 pages

lec11

lec11

3 pages

lec10new

lec10new

11 pages

lec9

lec9

13 pages

lec8

lec8

9 pages

lec7

lec7

10 pages

lec6

lec6

8 pages

lec14

lec14

11 pages

lec13

lec13

22 pages

lec12

lec12

8 pages

lec11

lec11

3 pages

lec10new

lec10new

11 pages

lec9

lec9

13 pages

lec8

lec8

9 pages

lec7

lec7

10 pages

lec6

lec6

8 pages

lec4

lec4

5 pages

lec3

lec3

5 pages

greedy

greedy

4 pages

siphon

siphon

18 pages

hwk5

hwk5

3 pages

Load more
Download lec1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view lec1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view lec1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?