Attendance (2) Performance (3) Oral (5) Total (10) Dated Sign of Subject Teacher
|
|
- Theodore Justin Washington
- 5 years ago
- Views:
Transcription
1 Attendance (2) Performance (3) Oral (5) Total (10) Dated Sign of Subject Teacher Date of Performance:... Actual Date of Completion:... Expected Date of Completion: Assignment No: Title of the Assignment: STRASSEN'S MATRİX MULTİPLİCATİON Objective of the Assignment: Write a java program to implement matrix multiplication using Strassen's method. (Divide and Conquer) Prerequisite: 1. Basic Algorithm for Matrix Multiplication 2. Algorithm Analysis techniques Theory: Divide-and-Conquer Strategy: Given a function that has to compute on n input the divide and conquer strategy suggest splitting k distinct subsets, 1 < K n, that yields K sub problems. Each of these sub problems must be solved and the solutions are obtained. A method must be found to combine the sub solutions into a solution of a whole. If the sub problems are still relatively large, the divide and conquer strategy can be reapplied. The sub problems are of the same type as the original problem. We can write a control abstraction that gives a flow of the control but hose primary operations are specified by other procedures. The meaning of these procedures is left undefined.
2 D and C (P) where P is the problem to be solved. A Boolean valued function that determines if the input size is small enough that the answer can be computed without splitting. If it is so the function S is invoked else the problem P is divided into smaller sub problems. The sub problems P1, P2,...Pk can be solved by recursive applications of D and C. Combine is a function that determines the solution to P, using the solution the K sub problems. Algorithm D and C (P) if small (p) then return S (P); else divide P into smaller instances P1, P2,...Pk K 1 Apply D and C to each to these sub problems. return combine (D and C (P1), D and C (P2)...D and C (PK)); if the size of P is n and the size of K sub problems are n1, n2...nk respectively the computing time of D and C is described by the recurrence relation. T(n) = g(n) where n is the small T(n1) + T(n2)...+t(nk) + f(n) T(n) is the time for D and C is any input n. g(n) is the time to compute the sum directly for small inputs. f(n) is the time for dividing D and for combining the solutions for the sub problems. When the sub problems are of the same type as the original problems we describe the algorithm using recursion. Strassen's Matrix Multiplication Let A and B be two n x n matrices. The product matrix C = AB is also an n x n matrix. Whose i th and j th elements is formed by taking [i, j] the elements in the i th column of B and multiplying them to give c [i j] = A [i k] B [k,j], 1 k < n for all i and j between 1 and n. To compute c[i, j] using this formula we require n 3 multiplications.
3 The divide and conquer strategy suggest another way to compute the product of two n x n matrices. We will assume that n is a power of 2. in case n is not a power of 2 then enough rows and columns of zeros may be added to both A and B so that the resulting dimensions are a power of 2. Imagine that A and B are each partitioned into 4 2 sub matrices each having dimension n/2 x n/2 then the product AB can be computed by using the above formula for the product of 2 x 2 matrices. To calculate the matrix product C = AB, Strassen's algorithm partitions the data to reduce the number of multiplications performed. This algorithm requires M, N and P to be powers of 2. The straightforward method needs 8 multiplications of numbers and 4 additions of numbers. In contrast, the Strassen's idea needs only 7 multiplications of numbers while it needs 18 additions of numbers. The idea consists of the following steps. 1. Partition A, B and and C into 4 equal parts: 2. Evaluate the intermediate matrices 3. Construct C using the intermediate metrices:
4 Algorithm: Algorithm Matrix Strassen(Matrix A, Matrix B, int n) // Input: Two n x n matrices A = [a_ij] and B = [b_ij] // Output: n x n matrix C = [c_ij] = AB Matrix C; Matrix A11; Matrix A12; Matrix A21; Matrix A22; // partition of A Matrix B11; Matrix B12; Matrix B21; Matrix B22; // partition of B Matrix C11; Matrix C12; Matrix C21; Matrix C22; // partition of C Matrix M1; Matrix M2; Matrix M3; Matrix M4; Matrix M5; Matrix M6; Matrix M7; if (n is not a power of 2) expand A and B by padding rows and columns of all 0's until their size becomes the next power of 2; update n accordingly; ; if (n=1) // the simplest case return a 1 x 1 matrix C = [ a_11 * b_11 ]; else M1 = Strassen(subtract(A12,A22,n/2),add(B21,B22,n/2),n/2); M2 = Strassen(add(A11,A22,n/2),add(B11,B22,n/2),n/2); M3 = Strassen(subtract(A11,A21,n/2),add(B11,B12,n/2),n/2); M4 = Strassen(add(A11,A12,n/2),B22,n/2); M5 = Strassen(A11,subtract(B12,B22,n/2),n/2); M6 = Strassen(A22,subtract(B21,B11,n/2),n/2); M7 = Strassen(add(A21,A22,n/2),B11,n/2); C11 = add(subtract(add(m1,m2,n/2),m4,n/2),m6,n/2);
5 C12 = add(m4,m5,n/2); C21 = add(m6,m7,n/2); C22 = subtract(add(subtract(m2,m3,n/2),m5,n/2),m7,n/2); return C = [Cij] (1<=i<=2 and 1<=j<=2); Algorithm Matrix add(matrix A, Matrix B, int n) // Input: Two n x n matrices A = [a_ij] and B = [b_ij] // Output: n x n matrix C = [c_ij] = A + B Matrix C; for (i=1; i<=n; i++) for (j=1; j<=n; j++) c_ij = a_ij + b_ij; return C = [c_ij]; Algorithm Matrix subtract(matrix A, Matrix B, int n) // Input: Two n x n matrices A = [a_ij] and B = [b_ij] // Output: n x n matrix C = [c_ij] = A - B Matrix C; for (i=1; i<=n; i++) for (j=1; j<=n; j++) c_ij = a_ij - b_ij; return C = [c_ij];
6 Analysis of the Time Complexity: The numbers of n/2 n/2 matrix multiplication may set back to 7 through the Strassen algorithm, when compared with the general algorithm for matrix multiplication. This meantime, there are 18 matrix addition or matrix subtraction. As n is a power of 2, if let k be nonnegative integer, then n is k-th power of 2. If k=0, then the time complexity of matrix multiplication is 1. If k>0, generally we can explain time complexity of matrix multiplication through the following recursive expression. by solving this O(n lg 7 ) = O(n ). Conclusion: Strassen's algorithm definitely performs better than the traditional matrix multiplication algorithm due to the reduced number of multiplications and better memory separation. FAQs: 1. Write down control abstraction for Divide and Conquer Method. 2. What are the limitations of Strassen s algorithm? Find out and explain. 3. Compare the Time Complexity of Streasen s Multiplication with the Traditional Matrix Multiplication Algorithm.
7.3 Divide-and-Conquer Algorithm and Recurrence Relations
73 Divide-and-Conquer Algorithm and Recurrence Relations Many recursive algorithms take a problem with a given input and divide it into one or more smaller problems This reduction is repeatedly applied
More information14 Dynamic. Matrix-chain multiplication. P.D. Dr. Alexander Souza. Winter term 11/12
Algorithms Theory 14 Dynamic Programming (2) Matrix-chain multiplication P.D. Dr. Alexander Souza Optimal substructure Dynamic programming is typically applied to optimization problems. An optimal solution
More informationCSC Design and Analysis of Algorithms
CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two
More informationCSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer
CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two
More informationParallelizing The Matrix Multiplication. 6/10/2013 LONI Parallel Programming Workshop
Parallelizing The Matrix Multiplication 6/10/2013 LONI Parallel Programming Workshop 2013 1 Serial version 6/10/2013 LONI Parallel Programming Workshop 2013 2 X = A md x B dn = C mn d c i,j = a i,k b k,j
More informationChapter 4. Divide-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 4 Divide-and-Conquer Copyright 2007 Pearson Addison-Wesley. All rights reserved. Divide-and-Conquer The most-well known algorithm design strategy: 2. Divide instance of problem into two or more
More informationCS 140 : Numerical Examples on Shared Memory with Cilk++
CS 140 : Numerical Examples on Shared Memory with Cilk++ Matrix-matrix multiplication Matrix-vector multiplication Hyperobjects Thanks to Charles E. Leiserson for some of these slides 1 Work and Span (Recap)
More informationIV/IV B.Tech (Regular) DEGREE EXAMINATION. Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation
IV/IV B.Tech (Regular) DEGREE EXAMINATION Design and Analysis of Algorithms (CS/IT 414) Scheme of Evaluation Maximum: 60 Marks 1. Write briefly about the following 1*12= 12 Marks a) Give the characteristics
More informationDynamic Programming Group Exercises
Name: Name: Name: Dynamic Programming Group Exercises Adapted from material by Cole Frederick Please work the following problems in groups of 2 or 3. Use additional paper as needed, and staple the sheets
More informationUnit-2 Divide and conquer 2016
2 Divide and conquer Overview, Structure of divide-and-conquer algorithms, binary search, quick sort, Strassen multiplication. 13% 05 Divide-and- conquer The Divide and Conquer Paradigm, is a method of
More informationUNIT-2 DIVIDE & CONQUER
Overview: Divide and Conquer Master theorem Master theorem based analysis for Binary Search Merge Sort Quick Sort Divide and Conquer UNIT-2 DIVIDE & CONQUER Basic Idea: 1. Decompose problems into sub instances.
More informationDivide-and-Conquer. The most-well known algorithm design strategy: smaller instances. combining these solutions
Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances recursively 3. Obtain solution to original
More informationLecture 8. Dynamic Programming
Lecture 8. Dynamic Programming T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2018
More informationData Structures and Algorithms CSE 465
Data Structures and Algorithms CSE 465 LECTURE 4 More Divide and Conquer Binary Search Exponentiation Multiplication Sofya Raskhodnikova and Adam Smith Review questions How long does Merge Sort take on
More informationn = 1 What problems are interesting when n is just 1?
What if n=1??? n = 1 What problems are interesting when n is just 1? Sorting? No Median finding? No Addition? How long does it take to add one pair of numbers? Multiplication? How long does it take to
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm View in slide-show mode 1 Reminder: Merge Sort Input array A sort this half sort this half Divide Conquer merge two sorted halves Combine
More informationDivide and Conquer. Algorithm Fall Semester
Divide and Conquer Algorithm 2014 Fall Semester Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances
More informationDivide-and-Conquer: Matrix Multiplication Strassen s Algorithm. Matrix Multiplication Problem. Step 1: Straightforward Solution.
Cal Poly CSC 349: Design and Analyis of Algorithms Alexander Dekhtyar Divide-and-Conquer: Matrix Multiplication Strassen s Algorithm Matrix Multiplication Problem Matrix Multiplication Given two matrices:
More informationIntroduction to Algorithms
Introduction to Algorithms Dynamic Programming Well known algorithm design techniques: Brute-Force (iterative) ti algorithms Divide-and-conquer algorithms Another strategy for designing algorithms is dynamic
More informationDivide-and-Conquer. Dr. Yingwu Zhu
Divide-and-Conquer Dr. Yingwu Zhu Divide-and-Conquer The most-well known algorithm design technique: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances independently
More informationDivide & Conquer Algorithms
Divide & Conquer Algorithms Calculating Powers of a Number Problem: Compute a n, where n N. Naive algorithm: Θ(n). Calculating Powers of a Number Problem: Compute a n, where n N. Naive algorithm: Θ(n).
More informationCase Study: Matrix Multiplication. 6.S898: Advanced Performance Engineering for Multicore Applications February 22, 2017
Case Study: Matrix Multiplication 6.S898: Advanced Performance Engineering for Multicore Applications February 22, 2017 1 4k-by-4k Matrix Multiplication Version Implementation Running time (s) GFLOPS Absolute
More informationParallel Computing: Parallel Algorithm Design Examples Jin, Hai
Parallel Computing: Parallel Algorithm Design Examples Jin, Hai School of Computer Science and Technology Huazhong University of Science and Technology ! Given associative operator!! a 0! a 1! a 2!! a
More informationD-BAUG Informatik I. Exercise session: week 5 HS 2018
1 D-BAUG Informatik I Exercise session: week 5 HS 2018 Homework 2 Questions? Matrix and Vector in Java 3 Vector v of length n: Matrix and Vector in Java 3 Vector v of length n: double[] v = new double[n];
More informationLecture 7: Divide & Conquer 2. Integer Multiplication. & Matrix Multiplication. CS 341: Algorithms. Tuesday, Jan 29 th 2019
Lecture 7: Divide & Conquer 2 Integer Multiplication & Matrix Multiplication CS 341: Algorithms Tuesday, Jan 29 th 2019 1 Outline For Today 1. Integer Multiplication 2. Matrix Multiplication 2 Outline
More information12 Dynamic Programming (2) Matrix-chain Multiplication Segmented Least Squares
12 Dynamic Programming (2) Matrix-chain Multiplication Segmented Least Squares Optimal substructure Dynamic programming is typically applied to optimization problems. An optimal solution to the original
More informationLecture 5: Matrices. Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur
Lecture 5: Matrices Dheeraj Kumar Singh 07CS1004 Teacher: Prof. Niloy Ganguly Department of Computer Science and Engineering IIT Kharagpur 29 th July, 2008 Types of Matrices Matrix Addition and Multiplication
More information17/05/2018. Outline. Outline. Divide and Conquer. Control Abstraction for Divide &Conquer. Outline. Module 2: Divide and Conquer
Module 2: Divide and Conquer Divide and Conquer Control Abstraction for Divide &Conquer 1 Recurrence equation for Divide and Conquer: If the size of problem p is n and the sizes of the k sub problems are
More informationChapter 5. Divide and Conquer. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 5 Divide and Conquer Slides by Kevin Wayne. Copyright 25 Pearson-Addison Wesley. All rights reserved. Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve each part
More informationDIVIDE & CONQUER. Problem of size n. Solution to sub problem 1
DIVIDE & CONQUER Definition: Divide & conquer is a general algorithm design strategy with a general plan as follows: 1. DIVIDE: A problem s instance is divided into several smaller instances of the same
More informationENGI 4892: Data Structures Assignment 2 SOLUTIONS
ENGI 4892: Data Structures Assignment 2 SOLUTIONS Due May 30 in class at 1:00 Total marks: 50 Notes: You will lose marks for giving only the final answer for any question on this assignment. Some steps
More informationCS 360 Exam 1 Fall 2014 Name. 1. Answer the following questions about each code fragment below. [8 points]
CS 360 Exam 1 Fall 2014 Name 1. Answer the following questions about each code fragment below. [8 points] for (v=1; v
More informationSo far... Finished looking at lower bounds and linear sorts.
So far... Finished looking at lower bounds and linear sorts. Next: Memoization -- Optimization problems - Dynamic programming A scheduling problem Matrix multiplication optimization Longest Common Subsequence
More informationDivide-and-Conquer. Divide-and conquer is a general algorithm design paradigm:
Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9
More informationLecture 4 CS781 February 3, 2011
Lecture 4 CS78 February 3, 2 Topics: Data Compression-Huffman Trees Divide-and-Conquer Solving Recurrence Relations Counting Inversions Closest Pair Integer Multiplication Matrix Multiplication Data Compression
More informationModule 27: Chained Matrix Multiplication and Bellman-Ford Shortest Path Algorithm
Module 27: Chained Matrix Multiplication and Bellman-Ford Shortest Path Algorithm This module 27 focuses on introducing dynamic programming design strategy and applying it to problems like chained matrix
More informationData Structures and Algorithms Week 8
Data Structures and Algorithms Week 8 Dynamic programming Fibonacci numbers Optimization problems Matrix multiplication optimization Principles of dynamic programming Longest Common Subsequence Algorithm
More informationLab #10 Multi-dimensional Arrays
Multi-dimensional Arrays Sheet s Owner Student ID Name Signature Group partner 1. Two-Dimensional Arrays Arrays that we have seen and used so far are one dimensional arrays, where each element is indexed
More informationCS Divide and Conquer
CS483-07 Divide and Conquer Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 1:30pm - 2:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/ lifei/teaching/cs483_fall07/
More information1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall
CSE 20 https://goo.gl/forms/1o 1KOd17RMoURxjn2 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Explain the steps in a proof by mathematical and/or structural
More informationChapter 3:- Divide and Conquer. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.
Chapter 3:- Divide and Conquer Compiled By:- Assistant Professor, SVBIT. Outline Introduction Multiplying large Integers Problem Problem Solving using divide and conquer algorithm - Binary Search Sorting
More informationSEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY. Lecture 11 CS2110 Spring 2016
1 SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY Lecture 11 CS2110 Spring 2016 Time spent on A2 2 Histogram: [inclusive:exclusive) [0:1): 0 [1:2): 24 ***** [2:3): 84 ***************** [3:4): 123 *************************
More informationLecture 17: Array Algorithms
Lecture 17: Array Algorithms CS178: Programming Parallel and Distributed Systems April 4, 2001 Steven P. Reiss I. Overview A. We talking about constructing parallel programs 1. Last time we discussed sorting
More informationIntroduction to Algorithms
Lecture 1 Introduction to Algorithms 1.1 Overview The purpose of this lecture is to give a brief overview of the topic of Algorithms and the kind of thinking it involves: why we focus on the subjects that
More informationEND-TERM EXAMINATION
(Please Write your Exam Roll No. immediately) Exam. Roll No... END-TERM EXAMINATION Paper Code : MCA-205 DECEMBER 2006 Subject: Design and analysis of algorithm Time: 3 Hours Maximum Marks: 60 Note: Attempt
More informationColumns A[0] A[0][0] = 20 A[0][1] = 30
UNIT Arrays and Strings Part A (mark questions). What is an array? (or) Define array. An array is a collection of same data type elements All elements are stored in continuous locations Array index always
More informationChain Matrix Multiplication
Chain Matrix Multiplication Version of November 5, 2014 Version of November 5, 2014 Chain Matrix Multiplication 1 / 27 Outline Outline Review of matrix multiplication. The chain matrix multiplication problem.
More informationPROGRAM EFFICIENCY & COMPLEXITY ANALYSIS
Lecture 03-04 PROGRAM EFFICIENCY & COMPLEXITY ANALYSIS By: Dr. Zahoor Jan 1 ALGORITHM DEFINITION A finite set of statements that guarantees an optimal solution in finite interval of time 2 GOOD ALGORITHMS?
More informationExercise 4: Loops, Arrays and Files
Exercise 4: Loops, Arrays and Files worth 24% of the final mark November 4, 2004 Instructions Submit your programs in a floppy disk. Deliver the disk to Michele Zito at the 12noon lecture on Tuesday November
More information1. Answer the following questions about each code fragment below. [8 points]
CS 360 Exam 1 Fall 2014 Solution 1. Answer the following questions about each code fragment below. [8 points] for (v=1; v
More informationCS 360 Exam 1 Fall 2014 Solution. 1. Answer the following questions about each code fragment below. [8 points]
CS 360 Exam 1 Fall 2014 Solution 1. Answer the following questions about each code fragment below. [8 points] for (v=1; v
More informationDivide-and-Conquer. Combine solutions to sub-problems into overall solution. Break up problem of size n into two equal parts of size!n.
Chapter 5 Divide and Conquer Slides by Kevin Wayne. Copyright 25 Pearson-Addon Wesley. All rights reserved. Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve each part recursively.
More informationCS473-Algorithms I. Lecture 10. Dynamic Programming. Cevdet Aykanat - Bilkent University Computer Engineering Department
CS473-Algorithms I Lecture 1 Dynamic Programming 1 Introduction An algorithm design paradigm like divide-and-conquer Programming : A tabular method (not writing computer code) Divide-and-Conquer (DAC):
More informationCS303 (Spring 2008) Solutions to Assignment 7
CS303 (Spring 008) Solutions to Assignment 7 Problem 1 Here is our implementation of a class for long numbers. It includes addition, subtraction, and both ways of multiplying. The rest of the code, not
More informationWe will give examples for each of the following commonly used algorithm design techniques:
Review This set of notes provides a quick review about what should have been learned in the prerequisite courses. The review is helpful to those who have come from a different background; or to those who
More informationHomework3: Dynamic Programming - Answers
Most Exercises are from your textbook: Homework3: Dynamic Programming - Answers 1. For the Rod Cutting problem (covered in lecture) modify the given top-down memoized algorithm (includes two procedures)
More informationg(n) time to computer answer directly from small inputs. f(n) time for dividing P and combining solution to sub problems
.2. Divide and Conquer Divide and conquer (D&C) is an important algorithm design paradigm. It works by recursively breaking down a problem into two or more sub-problems of the same (or related) type, until
More information1. Answer the following questions about each code fragment below. [8 points]
CS 360 Exam 1 Fall 2014 Solution 1. Answer the following questions about each code fragment below. [8 points] for (r=1; r
More informationESC101 : Fundamental of Computing
ESC101 : Fundamental of Computing End Semester Exam 19 November 2008 Name : Roll No. : Section : Note : Read the instructions carefully 1. You will lose 3 marks if you forget to write your name, roll number,
More informationRecursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences
Section 5.3 1 Recursion Recursion defining an object (or function, algorithm, etc.) in terms of itself. Recursion can be used to define sequences Previously sequences were defined using a specific formula,
More informationPESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA
INTERNAL ASSESSMENT TEST 2 Date : 30/3/15 Max Marks : 50 Name of faculty : Sabeeha Sultana Subject & Code : ADA(13MCA41) Answer any five full question: 1.Illustrate Mergesort for the dataset 8,3,2,9,7,1,5,4.
More informationDynamic Programming II
June 9, 214 DP: Longest common subsequence biologists often need to find out how similar are 2 DNA sequences DNA sequences are strings of bases: A, C, T and G how to define similarity? DP: Longest common
More informationCSC-140 Assignment 5
CSC-140 Assignment 5 Please do not Google a solution to these problems, cause that won t teach you anything about programming - the only way to get good at it, and understand it, is to do it! 1 Introduction
More informationParallel Algorithms CSE /22/2015. Outline of this lecture: 1 Implementation of cilk for. 2. Parallel Matrix Multiplication
CSE 539 01/22/2015 Parallel Algorithms Lecture 3 Scribe: Angelina Lee Outline of this lecture: 1. Implementation of cilk for 2. Parallel Matrix Multiplication 1 Implementation of cilk for We mentioned
More informationDepartment of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I
MCA 312: Design and Analysis of Algorithms [Part I : Medium Answer Type Questions] UNIT I 1) What is an Algorithm? What is the need to study Algorithms? 2) Define: a) Time Efficiency b) Space Efficiency
More informationCS 261 Data Structures. Big-Oh Analysis: A Review
CS 261 Data Structures Big-Oh Analysis: A Review Big-Oh: Purpose How can we characterize the runtime or space usage of an algorithm? We want a method that: doesn t depend upon hardware used (e.g., PC,
More informationDynamic Programming part 2
Dynamic Programming part 2 Week 7 Objectives More dynamic programming examples - Matrix Multiplication Parenthesis - Longest Common Subsequence Subproblem Optimal structure Defining the dynamic recurrence
More informationChapter 2 Divid d e-an -Conquer 1
Chapter 2 Divide-and-Conquerid d 1 A top-down approach Patterned after the strategy employed by Napoleon Divide an instance of a problem recursively into two or more smaller instances until the solutions
More informationCSE 202: Design and Analysis of Algorithms Lecture 5
CSE 202: Design and Analysis of Algorithms Lecture 5 Instructor: Kamalika Chaudhuri Announcements Kamalika s Office hours today moved to tomorrow, 12:15-1:15pm Homework 1 due now Midterm on Feb 14 Algorithm
More informationRecursion. COMS W1007 Introduction to Computer Science. Christopher Conway 26 June 2003
Recursion COMS W1007 Introduction to Computer Science Christopher Conway 26 June 2003 The Fibonacci Sequence The Fibonacci numbers are: 1, 1, 2, 3, 5, 8, 13, 21, 34,... We can calculate the nth Fibonacci
More informationTest 1 Review Questions with Solutions
CS3510 Design & Analysis of Algorithms Section A Test 1 Review Questions with Solutions Instructor: Richard Peng Test 1 in class, Wednesday, Sep 13, 2017 Main Topics Asymptotic complexity: O, Ω, and Θ.
More informationMaster Theorem, Introduction to Graphs
Master Theorem, Introduction to Graphs CSE21 Winter 2017, Day 10 (B00), Day 6-7 (A00) February 1, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Divide & Conquer: General Strategy Divide the problem of
More informationWe can use a max-heap to sort data.
Sorting 7B N log N Sorts 1 Heap Sort We can use a max-heap to sort data. Convert an array to a max-heap. Remove the root from the heap and store it in its proper position in the same array. Repeat until
More informationWe augment RBTs to support operations on dynamic sets of intervals A closed interval is an ordered pair of real
14.3 Interval trees We augment RBTs to support operations on dynamic sets of intervals A closed interval is an ordered pair of real numbers ], with Interval ]represents the set Open and half-open intervals
More informationCSE 202 Divide-and-conquer algorithms. Fan Chung Graham UC San Diego
CSE 22 Divide-and-conquer algorithms Fan Chung Graham UC San Diego A useful fact about trees Any tree on n vertices contains a vertex v whose removal separates the remaining graph into two parts, one of
More informationMatrix Multiplication
Matrix Multiplication Material based on Chapter 10, Numerical Algorithms, of B. Wilkinson et al., PARALLEL PROGRAMMING. Techniques and Applications Using Networked Workstations and Parallel Computers c
More informationCS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and
CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 10: Asymptotic Complexity and What Makes a Good Algorithm? Suppose you have two possible algorithms or
More information6. Algorithm Design Techniques
6. Algorithm Design Techniques 6. Algorithm Design Techniques 6.1 Greedy algorithms 6.2 Divide and conquer 6.3 Dynamic Programming 6.4 Randomized Algorithms 6.5 Backtracking Algorithms Malek Mouhoub, CS340
More informationAdvanced Algorithms. Problem solving Techniques. Divide and Conquer הפרד ומשול
Advanced Algorithms Problem solving Techniques. Divide and Conquer הפרד ומשול 1 Divide and Conquer A method of designing algorithms that (informally) proceeds as follows: Given an instance of the problem
More informationAlgorithm Design Techniques part I
Algorithm Design Techniques part I Divide-and-Conquer. Dynamic Programming DSA - lecture 8 - T.U.Cluj-Napoca - M. Joldos 1 Some Algorithm Design Techniques Top-Down Algorithms: Divide-and-Conquer Bottom-Up
More informationData Structures and Algorithms CMPSC 465
Data Structures and Algorithms CMPSC 465 LECTURES 7-8 More Divide and Conquer Multiplication Adam Smith S. Raskhodnikova and A. Smith; based on slides by E. Demaine and C. Leiserson John McCarthy (1927
More informationChoice of C++ as Language
EECS 281: Data Structures and Algorithms Principles of Algorithm Analysis Choice of C++ as Language All algorithms implemented in this book are in C++, but principles are language independent That is,
More informationCSE 202 Divide-and-conquer algorithms. Fan Chung Graham UC San Diego
CSE 22 Divide-and-conquer algorithms Fan Chung Graham UC San Diego Announcements Homework due today before the class. About homework, write your own homework, allowing oral discussion with one fixed partner.
More informationEfficient Sequential Algorithms, Comp309. Problems. Part 1: Algorithmic Paradigms
Efficient Sequential Algorithms, Comp309 Part 1: Algorithmic Paradigms University of Liverpool References: T. H. Cormen, C. E. Leiserson, R. L. Rivest Introduction to Algorithms, Second Edition. MIT Press
More informationDivide and Conquer 1
Divide and Conquer A Useful Recurrence Relation Def. T(n) = number of comparisons to mergesort an input of size n. Mergesort recurrence. T(n) if n T n/2 T n/2 solve left half solve right half merging n
More informationComputer Science 385 Design and Analysis of Algorithms Siena College Spring Topic Notes: Dynamic Programming
Computer Science 385 Design and Analysis of Algorithms Siena College Spring 29 Topic Notes: Dynamic Programming We next consider dynamic programming, a technique for designing algorithms to solve problems
More information2/26/2016. Divide and Conquer. Chapter 6. The Divide and Conquer Paradigm
Divide and Conquer Chapter 6 Divide and Conquer A divide and conquer algorithm divides the problem instance into a number of subinstances (in most cases 2), recursively solves each subinsance separately,
More informationData Structures and Algorithms. Dynamic Programming
Data Structures and Algorithms Dynamic Programming Introduction Dynamic programming is simply the process of turning recursive calls in to table lookups. If a recursive function does redundant computations,
More informationAnalysis of Algorithms 1 / 18
Analysis of Algorithms 1 / 18 Outline 1 Complexity of Algorithms 2 Time Complexity 3 Space Complexity 2 / 18 Complexity of Algorithms Questions that arise when we write programs that process large amounts
More informationMA/CSSE 473 Day 17. Divide-and-conquer Convex Hull. Strassen's Algorithm: Matrix Multiplication. (if time, Shell's Sort)
MA/CSSE 473 Day 17 Divide-and-conquer Convex Hull Strassen's Algorithm: Matrix Multiplication (if time, Shell's Sort) MA/CSSE 473 Day 17 Student Questions Exam 2 specification Levitin 3 rd Edition Closest
More informationPh.D. Comprehensive Examination Design and Analysis of Algorithms
Ph.D. Comprehensive Examination Design and Analysis of Algorithms Main Books 1. Cormen, Leiserton, Rivest, Introduction to Algorithms, MIT Press, 2001. Additional Books 1. Kenneth H. Rosen, Discrete mathematics
More informationCSE 202: Design and Analysis of Algorithms Lecture 4
CSE 202: Design and Analysis of Algorithms Lecture 4 Instructor: Kamalika Chaudhuri Greedy Algorithms Direct argument - MST Exchange argument - Caching Greedy approximation algorithms Greedy Approximation
More informationAnalysis of Algorithms. Unit 4 - Analysis of well known Algorithms
Analysis of Algorithms Unit 4 - Analysis of well known Algorithms 1 Analysis of well known Algorithms Brute Force Algorithms Greedy Algorithms Divide and Conquer Algorithms Decrease and Conquer Algorithms
More informationCS302 Topic: Algorithm Analysis #2. Thursday, Sept. 21, 2006
CS302 Topic: Algorithm Analysis #2 Thursday, Sept. 21, 2006 Analysis of Algorithms The theoretical study of computer program performance and resource usage What s also important (besides performance/resource
More informationLecture 6: Combinatorics Steven Skiena. skiena
Lecture 6: Combinatorics Steven Skiena Department of Computer Science State University of New York Stony Brook, NY 11794 4400 http://www.cs.sunysb.edu/ skiena Learning to Count Combinatorics problems are
More informationLecture 13: Chain Matrix Multiplication
Lecture 3: Chain Matrix Multiplication CLRS Section 5.2 Revised April 7, 2003 Outline of this Lecture Recalling matrix multiplication. The chain matrix multiplication problem. A dynamic programming algorithm
More informationAlgorithms with numbers (1) CISC4080, Computer Algorithms CIS, Fordham Univ.! Instructor: X. Zhang Spring 2017
Algorithms with numbers (1) CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang Spring 2017 Acknowledgement The set of slides have used materials from the following resources Slides for
More informationDivide and Conquer Algorithms
Divide and Conquer Algorithms T. M. Murali February 19, 2009 Divide and Conquer Break up a problem into several parts. Solve each part recursively. Solve base cases by brute force. Efficiently combine
More informationUnit-5 Dynamic Programming 2016
5 Dynamic programming Overview, Applications - shortest path in graph, matrix multiplication, travelling salesman problem, Fibonacci Series. 20% 12 Origin: Richard Bellman, 1957 Programming referred to
More informationUML CS Algorithms Qualifying Exam Fall, 2003 ALGORITHMS QUALIFYING EXAM
NAME: This exam is open: - books - notes and closed: - neighbors - calculators ALGORITHMS QUALIFYING EXAM The upper bound on exam time is 3 hours. Please put all your work on the exam paper. (Partial credit
More information