Catalan Numbers.

Slides:



Advertisements
Similar presentations
Section 13-4: Matrix Multiplication
Advertisements

Multiplying Matrices Two matrices, A with (p x q) matrix and B with (q x r) matrix, can be multiplied to get C with dimensions p x r, using scalar multiplications.
Algorithm Design Methodologies Divide & Conquer Dynamic Programming Backtracking.
Dynamic Programming An algorithm design paradigm like divide-and-conquer “Programming”: A tabular method (not writing computer code) Divide-and-Conquer.
Chapter 15 Dynamic Programming Lee, Hsiu-Hui Ack: This presentation is based on the lecture slides from Hsu, Lih-Hsing, as well as various materials from.
Maths for Computer Graphics
Dynamic Programming Carrie Williams. What is Dynamic Programming? Method of breaking the problem into smaller, simpler sub-problems Method of breaking.
Dynamic Programming Reading Material: Chapter 7..
Dynamic Programming Reading Material: Chapter 7 Sections and 6.
11-1 Matrix-chain Multiplication Suppose we have a sequence or chain A 1, A 2, …, A n of n matrices to be multiplied –That is, we want to compute the product.
EXAMPLE 3 Solve a multi-step problem Manufacturing A company manufactures small and large steel DVD racks with wooden bases. Each size of rack is available.
Warm-up 1.Review notes from Friday. 2.What is the dimension of the matrix below?
4.2 Adding and Subtracting Matrices 4.3 Matrix Multiplication
Matrix Equations Step 1: Write the system as a matrix equation. A three-equation system is shown below.
Row 1 Row 2 Row 3 Row m Column 1Column 2Column 3 Column 4.
Advanced Trig Exam Review Day Three: Matrices. Solving Systems of Equations.
AIM: How do we perform basic matrix operations? DO NOW:  Describe the steps for solving a system of Inequalities  How do you know which region is shaded?
Unit 5 – Series, Sequences, and Limits Section 5.2 – Recursive Definitions Calculator Required.
4.1: Matrix Operations Objectives: Students will be able to: Add, subtract, and multiply a matrix by a scalar Solve Matrix Equations Use matrices to organize.
1 Section 5.3 Linear Systems of Equations. 2 THREE EQUATIONS WITH THREE VARIABLES Consider the linear system of three equations below with three unknowns.
Matrices Operations The info in this powerpoint came from coolmath.com
 In this lesson we will go over how to solve a basic matrix equation such as the following: These are matrices, not variables.
Algebra Matrix Operations. Definition Matrix-A rectangular arrangement of numbers in rows and columns Dimensions- number of rows then columns Entries-
EXAMPLE 1 Add and subtract matrices
Example 1 Writing Powers Write the product as a power and describe it in words. a. 44= to the second power, or 4 squared 9 to the third power,
Multiply Matrices Chapter 3.6. Matrix Multiplication Matrix multiplication is defined differently than matrix addition The matrices need not be of the.
3.6 Multiplying Matrices Homework 3-17odd and odd.
3.5 Perform Basic Matrix Operations Add Matrices Subtract Matrices Solve Matric equations for x and y.
Notes Over 4.2 Finding the Product of Two Matrices Find the product. If it is not defined, state the reason. To multiply matrices, the number of columns.
4-3 Matrix Multiplication Objective: To multiply a matrix by a scalar multiple.
Advanced Algorithms Analysis and Design
12-2 MATRIX MULTIPLICATION MULTIPLY MATRICES BY USING SCALAR AND MATRIX MULTIPLICATION.
Add and subtract matrices. Multiply by a matrix scalar.
Warm-UP A = 7-310B = C =7-4Find:A 22 and C 31 97Find: the dimensions of each -88 Matrix Find: A + B and B – A and C + B.
13.3 Product of a Scalar and a Matrix.  In matrix algebra, a real number is often called a.  To multiply a matrix by a scalar, you multiply each entry.
Dr Nazir A. Zafar Advanced Algorithms Analysis and Design Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar.
Advanced Algorithms Analysis and Design
Sections 2.4 and 2.5 Matrix Operations
12-1 Organizing Data Using Matrices
Multiplying Matrices.
Advanced Algorithms Analysis and Design
Matrix Multiplication
Seminar on Dynamic Programming.
Matrix Operations SpringSemester 2017.
Multiplying Matrices.
WarmUp 2-3 on your calculator or on paper..
7.3 Matrices.
الوحدة السابعة : المصفوفات . تنظيم البيانات فى مصفوفات . الوحدة السابعة : المصفوفات . تنظيم البيانات فى مصفوفات . 1 جمع المصفوفات وطرحها.
[ ] [ ] [ ] [ ] EXAMPLE 3 Scalar multiplication Simplify the product:
4.1 Matrices – Basic Operations
MATRICES MATRIX OPERATIONS.
Objectives Multiply two matrices.
Algorithms Lecture #21 Dr.Sohail Aslam.
Designing Algorithms for Multiplication of Fractions
Multiplying Matrices.
Algorithms Lecture #19 Dr.Sohail Aslam.
Matrix Chain Multiplication
1.8 Matrices.
What is the dimension of the matrix below?
Matrix Operations SpringSemester 2017.
Matrix Multiplication
1.8 Matrices.
Multiplying Matrices.
Algorithms CSCI 235, Spring 2019 Lecture 27 Dynamic Programming II
Multiplying Matrices.
Algebra Jeopardy The Basics Matrices
Introduction to Matrices
MATRICES MATTER!.
Multiplying Matrices.
Seminar on Dynamic Programming.
Presentation transcript:

Catalan Numbers

Multiplying n Numbers n multiplication order 2 (x1 · x2) 3 (x1 · (x2 · x3)) ((x1 · x2) · x3) 4 (x1 · (x2 · (x3 · x4))) (x1 · ((x2 · x3) · x4)) ((x1 · x2) · (x3 · x4)) ((x1 · (x2 · x3)) · x4) (((x1 · x2) · x3) · x4) Objective: Find C(n), the number of ways to compute product x1 . x2 …. xn.

Multiplying n Numbers – small n C(n) 1 2 3 4 5 14 6 42 7 132

Chain-Matrix Multiplication Dr Nazir A. Zafar Advanced Algorithms Analysis and Design

Problem Statement: Chain Matrix Multiplication Statement: The chain-matrix multiplication problem can be stated as below: Given a chain of [A1, A2, . . . , An] of n matrices where for i = 1, 2, . . . , n, matrix Ai has dimension pi-1 x pi, find the order of multiplication which minimizes the number of scalar multiplications. Note: Order of A1 is p0 x p1, Order of A2 is p1 x p2, Order of A3 is p2 x p3, etc. Order of A1 x A2 x A3 is p0 x p3, Order of A1 x A2 x . . . x An is p0 x pn

Chain Matrix Multiplication (Brute Force Approach)

Brute Force Chain Matrix Multiplication Example Given a sequence [A1, A2, A3, A4] Order of A1 = 10 x 100 Order of A2 = 100 x 5 Order of A3 = 5x 50 Order of A4 = 50x 20 Compute the order of the product A1 . A2 . A3 . A4 in such a way that minimizes the total number of scalar multiplications.

Brute Force Chain Matrix Multiplication There are five ways to parenthesize this product Cost of computing the matrix product may vary, depending on order of parenthesis. All possible ways of parenthesizing (A1 · (A2 . (A3 . A4))) (A1 · ((A2 . A3). A4)) ((A1 · A2). (A3 . A4)) ((A1 · (A2 . A3)). A4) (((A1 · A2). A3). A4)

Kinds of problems solved by algorithms

Second Chain : (A1 · ((A2 . A3). A4))

Third Chain : ((A1 · A2). (A3 . A4))

Fourth Chain : ((A1 · (A2 . A3)). A4) Dr Nazir A. Zafar Advanced Algorithms Analysis and Design

Fifth Chain : (((A1 · A2). A3). A4)

Chain Matrix Cost ((A1 · A2). (A3 . A4)) First Chain 35,000 Second Chain 145,000 Third Chain 11,000 Fourth Chain 85,000 Fifth Chain 17,500 ((A1 · A2). (A3 . A4))