(1) Implement the function by allocating a new n X n 2D array. Then write the rotation to it by writing the rows of the original matrix to the columns in the solution matrix such that they fit the solution requirement. Then copy the new matrix exactly the same to the original matrix so that you know for sure you have updated the original matrix to look modified. (2) Implement the function by not allocating a new n Xn 2D array.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

java 

 

 

 

 

(1) Implement the function by allocating a new n X n 2D array.

Then write the rotation to it by writing the rows of the original matrix to

the columns in the solution matrix such that they fit the solution require[1]ment. Then copy the new matrix exactly the same to the original matrix

so that you know for sure you have updated the original matrix to look

modified.

(2) Implement the function by not allocating a new n X n 2D

array.

Hint : Perform the rotation in a layer by layer fashion - meaning - different layers can be processed independently. Also within a layer, you

can exchange groups of four elements at a time to perform the rotation.

Example : Send 1 to 4’s location, 4 to 16’s location, 16 to 13’s location

and 13 to 1’s location.

Ungraded but Important : As a comment in your code for Problem 2,

write your observation on the different solutioning methods utilized.

should speak in terms of Time and Space Complexity. Which solution

does what in terms of time and space. Which is better, which is worse.

Which solution would you prefer and why?  observation should be

no more than 5 lines :)

Note that your program's output must exactly match the specs(design , style) given here for each
problem to pass the instructor's test cases.
1
2
3
4
6
7
8.
9.
10
11
12
13
14
15
16
Our objective is to write (a) function(s) to rotate the above matrix by 90-
degrees clockwise which produces the matrix as below:
13
9
14
10
6 2
15
11
7 3
16
12
8.
4
We will solve the problem in two ways:-
Transcribed Image Text:Note that your program's output must exactly match the specs(design , style) given here for each problem to pass the instructor's test cases. 1 2 3 4 6 7 8. 9. 10 11 12 13 14 15 16 Our objective is to write (a) function(s) to rotate the above matrix by 90- degrees clockwise which produces the matrix as below: 13 9 14 10 6 2 15 11 7 3 16 12 8. 4 We will solve the problem in two ways:-
(1) Implement the function by allocating a new n X n 2D array.
Then write the rotation to it by writing the rows of the original matrix to
the columns in the solution matrix such that they fit the solution requirement. Then copy the new
matrix exactly the same to the original matrix
so that you know for sure you have updated the original matrix to look
modified.
(2) Implement the function by not allocating a new n Xn 2D
array.
Hint : Perform the rotation in a layer by layer fashion - meaning - different layers can be processed
independently. Also within a layer, you
can exchange groups of four elements at a time to perform the rotation.
Example : Send 1 to 4's location, 4 to 16's location, 16 to 13's location
and 13 to 1's location.
Ungraded but Important : As a comment in your code for Problem 2,
write your observation on the different solutioning methods utilized.
should speak in terms of Time and Space Complexity. Which solution
does what in terms of time and space. Which is better, which is worse.
Which solution would you prefer and why? observation should be
no more than 5 lines :)
Transcribed Image Text:(1) Implement the function by allocating a new n X n 2D array. Then write the rotation to it by writing the rows of the original matrix to the columns in the solution matrix such that they fit the solution requirement. Then copy the new matrix exactly the same to the original matrix so that you know for sure you have updated the original matrix to look modified. (2) Implement the function by not allocating a new n Xn 2D array. Hint : Perform the rotation in a layer by layer fashion - meaning - different layers can be processed independently. Also within a layer, you can exchange groups of four elements at a time to perform the rotation. Example : Send 1 to 4's location, 4 to 16's location, 16 to 13's location and 13 to 1's location. Ungraded but Important : As a comment in your code for Problem 2, write your observation on the different solutioning methods utilized. should speak in terms of Time and Space Complexity. Which solution does what in terms of time and space. Which is better, which is worse. Which solution would you prefer and why? observation should be no more than 5 lines :)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Topological Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education