1. Convert the following Pseudo-code to actual coding in any of your preferred programming Language (C/C++/Java...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Convert the following Pseudo-code to actual coding in any of your preferred programming Language (C/C++/Java will be preferable from my side!) declare integer variables named as a, b, w, u, V print "Enter number of rows: " input a positive integer from the terminal and set it as the value of w print "Enter number of columns: " input a positive integer from the terminal and set it as the value of u declare a 2D array named as MAT whose number of rows will be w and the number of columns will be u input a unique integer number (>0) for each cell of MAT from terminal and store it into MAT using a for loop print the values of all the indexes of MAT using a for loop set V to MAT[0][0] set both a and b to 0 while ((a doesn't get equal to w minus 1) OR (b doesn't get equal to u minus 1)) print "Cell [a, b] > "// a means the value of a and b means the value of b if ((a is less than w minus 1) AND (b is less than u minus 1)) if ((MAT[ a+1 ] [b]) IS LESS THAN (MAT[ a ][ b+1 ])) increment b by 1 only else increment a by 1 only else if (b equals to u minus 1) increment a by 1 only else increment b by 1 only print "la, b]" // a means the value of a and b means the value of b increment V by MAT[ a ][ b] print a newline print the last updated value of V The above Pseudo-code gives solution to of one of the well-known problems we have discussed in this course. Can you guess which problem it is? Also, can you say to which approach the above Pseudo-code does indicate? Is it Dynamic Programming or Greedy? Justify your answer with proper short explanation. 1. Convert the following Pseudo-code to actual coding in any of your preferred programming Language (C/C++/Java will be preferable from my side!) declare integer variables named as a, b, w, u, V print "Enter number of rows: " input a positive integer from the terminal and set it as the value of w print "Enter number of columns: " input a positive integer from the terminal and set it as the value of u declare a 2D array named as MAT whose number of rows will be w and the number of columns will be u input a unique integer number (>0) for each cell of MAT from terminal and store it into MAT using a for loop print the values of all the indexes of MAT using a for loop set V to MAT[0][0] set both a and b to 0 while ((a doesn't get equal to w minus 1) OR (b doesn't get equal to u minus 1)) print "Cell [a, b] > "// a means the value of a and b means the value of b if ((a is less than w minus 1) AND (b is less than u minus 1)) if ((MAT[ a+1 ] [b]) IS LESS THAN (MAT[ a ][ b+1 ])) increment b by 1 only else increment a by 1 only else if (b equals to u minus 1) increment a by 1 only else increment b by 1 only print "la, b]" // a means the value of a and b means the value of b increment V by MAT[ a ][ b] print a newline print the last updated value of V The above Pseudo-code gives solution to of one of the well-known problems we have discussed in this course. Can you guess which problem it is? Also, can you say to which approach the above Pseudo-code does indicate? Is it Dynamic Programming or Greedy? Justify your answer with proper short explanation.
Expert Answer:
Posted Date:
Students also viewed these programming questions
-
A 2D Array consists of four rows and six columns. Each row represents a student while each column represents a lab grade. Write the following functions and test them: ¢ Print the average grade...
-
The Java programming language is referred to by some as the language of the Web, due to its platform independent nature. Java uses a hybrid form of RPC and CORBA called RMI (Remote Method...
-
My first programming job in 1977 was to convert a set of application systems from one version of COBOL to another version of COBOL for the government of Prince Edward Island. The testing approach was...
-
Use the data in the table to complete the following. (a) Make a scatterplot of the data. Estimate a value for b so that f(x) = 0.0002x b models the data. (b) Check the accuracy of f(x). (c) The moon...
-
A student took two national aptitude tests. The national average and standard deviation were 475 and 100, respectively, for the first test and 30 and 8, respectively, for the second test. The student...
-
Langdon Company produced 9,000 units during the past year, but only 8,200 of the units were sold. The following additional information is also available. Direct materials used .......... $79,000...
-
Recall that Life Fitness had estimated \($1,000,000\) of MOH for the year and 62,500 DL hours, resulting in a predetermined MOH rate of \($16/DL\) hour. By the end of the year, the company had...
-
You have been asked by the board of trustees of a local church to review its accounting procedures. As part of this review you have prepared the following comments about the collections made at...
-
The price of a car you want is $39,000 today. Its price is expected to increase by $1000 each year. You now have $23,500 in an investment account, which is earning 11% per year. How many years will...
-
Joe has $16 to spend on Twinkies and Ho-Hos. Twinkies have a price of $1 per pack, and Ho-Hos have a price of $2 per pack. Use the information in these graphs to determine the number of Twinkies and...
-
15. Factory overhead is an example of a * (3 Points) Mixed cost. Variable cost. Fixed cost. O Irrelevant cost.
-
Give two examples of feedback control systems in which a human acts as a controller.
-
A group of people elected by a firms shareholders to oversee the operation of a corporation are a. the firms CEO, CFO and COO. b. the firms board of directors. c. the firms line managers. d. All of...
-
Mary Rossi, a student at State College, has a balance of $380 on her retail charge card; if the store levies a finance charge of 21% per year, how much monthly interest will be added to her account?
-
Carla Esposito has an overdraft protection line. Assume that her October 2010 statement showed a latest (new) balance of $862. If the line had a minimum monthly payment requirement of 5% of the...
-
Is there a difference between effective management and effective leadership? Explain.
-
Kindly assist in addressing all the questions. This is for a home health care agency . 1 A B [Company Name] D E F [Name] K L M N Pro-forma Business Budget 2 3 4 REVENUE Jan Feb Mar Apr May Jun Jul...
-
Draw and label the E and Z isomers for each of the following compounds: 1. CH3CH2CH==CHCH3 2. 3. 4. CH,CH2C CHCH2CH Cl CH3CH2CH2CH2 CH CH2CCCH2CI CHCH3 CH3 HOCH CH CCC CH O-CH C(CH
-
Which of these statements regarding the origin of life is false? (a) Life originated on an Earth whose atmosphere contained high levels of oxygen. (b)Miller and Urey obtained amino acids and other...
-
The primary problem with the hypothesis that life on Earth originated on Mars is that (a) Mars has never had water. (b) the proposed Martian fossils are much smaller than the tiniest bacteria on...
-
Which statement about human evolution is true? (a) The earliest fossils of modern humans are almost 200,000 years old. (b)Humans are descended from chimpanzees. (c) Modern humans are the only...
Study smarter with the SolutionInn App