Question: Please answer in Pseudocode. Once we have a method for checking one column, we can use the following function to check all columns: function ColChecks(puzzle)

Please answer in Pseudocode.

Once we have a method for checking one column, we can use the following function to check all columns:

function ColChecks(puzzle)

for 1 j 4 do

if CheckColumn(puzzle, j) = FALSE then

return FALSE

end if

end for

return TRUE

end function

The next set of conditions to check is to see if all integers from 1 to 4 appear in the 2-by-2 sub-grids. In the next task, the goal is to replicate the approach of the function CheckColumn but for these sub-grids. In the function you should repeatedly call SearchStack for each element in a sub-grid, and then do this for all four sub-grids.

Task 6: Complete the following function:

function CheckGrids(puzzle)

...

end function

This function will take the vector puzzle (as produced by MakeVector) as an input parameter and check that all sub-grids contain all numbers from 1 to 4: if every sub-grid does contain all numbers from 1 to 4, it should return TRUE, otherwise it should return FALSE. For each sub-grid you should create a stack with numbers from 1 to 4, and then repeatedly search the stack to see if the values in the sub-grid are stored there. To get full marks you need to call SearchStack(stack, item).

[6 marks]

Please answer in Pseudocode

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!