Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Brute Force And Divide And Conquer Approaches-Advance Analysis Design-Lecture Slides, Slides of Design and Analysis of Algorithms

This course object is to design and analysis of modern algorithms, different variants, accuracy, efficiency, comparing efficiencies, advance designing techniques. In this course algorithm will be analyse using real world examples. This lecture includes: Designing, Algorithms, Brute, Force, Divide, Conquer, Closest, Pair, Generalization, Maximal, Points, Merge, Sort

Typology: Slides

2011/2012

Uploaded on 08/06/2012

parnavi
parnavi 🇮🇳

4.2

(13)

124 documents

1 / 19

Toggle sidebar

Related documents


Partial preview of the text

Download Brute Force And Divide And Conquer Approaches-Advance Analysis Design-Lecture Slides and more Slides Design and Analysis of Algorithms in PDF only on Docsity! Lecture No. 13 Designing Algorithms using Brute Force and Divide & Conquer Approaches Dr Nazir A. Zafar Advanced Algorithms Analysis and Design docsity.com Brute Force • Finding closest pair in 2-D • Improved version finding closest pair in 2-D • Generalization in 3-D and then n-D • Finding maximal points in n-D Divide and Conquer • A General Divide and Conquer approach • Merge Sort algorithm • Finding Maxima in 1-D, and 2-D • Finding Closest Pair in 2-D Today Covered Dr Nazir A. Zafar Advanced Algorithms Analysis and Design docsity.com Distance • In mathematics, particular in geometry, distance on a given set M is a function d: M × M → R, where R denotes the set of real numbers, that satisfies the following conditions: 1. d(x, y) ≥ 0, 2. d(x, y) = 0 if and only if x = y. 3. Symmetric i.e. d(x, y) = d(y, x). 4. Triangle inequality: d(x, z) ≤ d(x, y) + d(y, z). Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Definition: Closest Pair docsity.com Closest Pair Problem in 2-D • A point in 2-D is an ordered pair of values (x, y). • The Euclidean distance between two points Pi = (xi, yi) and Pj = (xj, yj) is d(pi, pj) = sqr((xi − xj)2 + (yi − yj)2) • The closest-pair problem is finding the two closest points in a set of n points. • The brute force algorithm checks every pair of points. • Assumption: We can avoid computing square roots by using squared distance. – This assumption will not loose correctness of the problem. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Finding Closest Pair in 2-D docsity.com )( c 2 2 1i 1i n 1j n cn cn ComplexityTime n n          ClosestPairBF(P) 1. mind  ∞ 2. for i  1 to n 3. do 4. for j  1 to n 5. if i  j 6. do 7. d  ((xi − xj)2 + (yi − yj)2) 8. if d < mind then 8. mind  d 9. mini  i 10.minj  j 11.return mind, p(mini, minj) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Brute Force Approach: Finding Closest Pair in 2-D docsity.com The Closest Pair Problem 3-D Dr Nazir A. Zafar Advanced Algorithms Analysis and Design docsity.com ClosestPairBF(P) 1. mind  ∞ 2. for i  1 to n − 1 3. do 4. for j  i + 1 to n 5. do 6. d  ((xi − xj)2 + (yi − yj)2 + (zi − zj)2) 7. if d < minn then 8. mind  d 9. mini  i 10.minj  j 11.return mind, p(mini), p(minj) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Finding Closest Pair in 3-D )( )( )( c 2 1 1 1 1i 1 1i 1 1i n 1ij n inc inc ComplexityTime n i n n n                 docsity.com The Closest Pair Problem n-D Dr Nazir A. Zafar Advanced Algorithms Analysis and Design docsity.com • Maximal Points in 2-D A point p is said to be dominated by q if p.x ≤ q.x and p.y ≤ q.y A point p is said to be maximal if p.x > q.x OR p.y > q.y • Maximal Points in n-D A point p is said to be dominated by q if p.xi ≤ q.xi  i = 1,. . ., n A point p is said to be maximal if  i = 1,. . ., n, p.xi > q.xi A point is said to be maximal if it is not dominated by any other point. Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Maximal Points docsity.com Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Example: Maximal Points in 2-Dimension docsity.com Problem Statement: Given a set of m points, P = {p1, p2, . . . , pm}, in n- dimension. Our objective is to compute a set of maximal points i.e. set of points which are not dominated by any one in the given list. Mathematical Description: Maximal Points = { p  P |  q  {p1, . . . , pm}, q  p,  i  {1,. . . , n} & p.xi ≥ q.xj} Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Problem Statement docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved