Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the 8 numbers in a cross.and I am not understanding how I got a wrong. This is the 8 numbers in a cross

This is the 8 numbers in a cross.and I am not understanding how I got a wrong. This is the 8 numbers in a cross and question a is asking to place the numbers that represent the Helper arrray within the cross.

This is my explanation:

So,

-0 would be first since nothing would be adjacent to it yet since nothing has been placed yet; We set this with a -1.

- 1 got placed right next to it because the only number that would be first next to 0 after it being placed is 1.

- 2 was placed right after because that a number that can be placed but is only adjacent to 0.

- 3 was placed next since placing it in the spot it was in would make it adjacent to 0, 1, and 2.

- 4 was placed next since 0, 1, and 3 would be adjacent.

- 5 was placed since only 1 and 4 are adjacent

- 6 was placed since its adjacent with 2, 3, and 4

-7 was placed because its adjacent with 3,4,5,6

So how was my answer wrong if it follows the helper array given perfectly? Am i missing something? I would appreciate a in depth response. thank you

image text in transcribed

13. One of the projects we worked on this semester is "Eight Numbers in a Cross." The idea was to write a program which allocates the integers 1-8 to the squares in the figure above, subject to the restrictions that no two adjacent squares contain consecutive integers. By adjacent we meant vertically, horizontally, or diagonally. We used an array int Q[8] to correspond to the sub-squares in the cross and the helper array a: int a[8][5]=\{ {1}, {0,1}, {0,1}, {0,1,2,1}, {0,1,3,1}, {1,4,1}, {2,3,4,1}, {3,4,5,6,1} \} Question: a. Using the array a [8][5], show which sub-square of the cross correspond to which value of array Q[]. Write your answer in the diagram above. (5 points) b. Explain in detail (and by example) how you determined this correspondence. (10 points)

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

Students also viewed these Databases questions