Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Once we have a method for checking one column, we can use the following function to check all columns: function ColChecks(puzzle) for 1j4 do if

image text in transcribed

Once we have a method for checking one column, we can use the following function to check all columns: function ColChecks(puzzle) for 1j4 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]

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions