Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions