ChatCrawlersearch across public Telegram Open the app
C

Coding Tree

сообщение · 2023-05-01 08:50 UTC
I
Title: Dynamic programming 1 Problem statement: Implement the standard matrix chain multiplication problem The dimensions of a chain of n matrices M1, M2, …, Mn that are to be multiplied, are given as a sequence A =<a0, a1, a2, …, an+1>. The dimension of the matrix Mi is ai-1 X ai. The goal is to find the most efficient way to multiply these matrices together such that the total number of element multiplications is minimum. Tasks: a. Solve the problem using dynamic programming techniques. b. Print the sequence of multiplications by clearly placing parenthesis around the matrices. Example: Input: A = {10, 20, 30} Output: 6000 Explanation: There are only two matrices of dimensions 10×20 and 20×30. So, there is only one way to multiply the matrices, the cost of which is 10*20*30 = 6000. Input: A= {40, 20, 30, 10, 30} Output: 26000 Explanation: 20*30*10 + 40*20*10 + 40*10*30 = 26000.

Вся лента · оригинал в Telegram

Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog