Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5 dup-grid(grid) This function should duplicate a 2d array of integers. You may assume that it is 9x9 in size. It's important to make sure

image text in transcribedimage text in transcribed

5 dup-grid(grid) This function should duplicate a 2d array of integers. You may assume that it is 9x9 in size. It's important to make sure that the internal arrays you return are not aliases of the original data - they need to be new arrays! To check that, try out the following code snippet: orig - ... some grid ... copy = dup-grid(grid) copy[0][0] = 9 print (orig) print(copy) # should be different! 6 get_col(grid, x) This function takes a 9x9 grid. Don't make any assumptions about what sort of data it contains, but you can assume that it's arranged in the "array of columns" format. The x parameter is the column number; it will be in the range 0 through 8 (inclusive) Return all of the values in that column. Note that I don't care what order you return them, since I will be sorting your return values before I check them. 7 get_row(grid, y) This function is just like get_col(), except that this returns all of the values in a row. 8 get_square(grid, sx,xy) This function is just like get_col(), except that it returns the 9 values inside one of the squares of the grid. Remember, (0,0) is the upper-left square, and (2,0) is the upper-right

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Concepts, Theories, And Applications

Authors: Shui Yu, Song Guo

1st Edition

3319277634, 9783319277639

More Books

Students also viewed these Databases questions