Question: Task 7: Consider the following puzzle vector: Element 1 2 4 Element 2 3 2 Element 3 2 Element 4 3 2 Design and explain


Task 7: Consider the following puzzle vector: Element 1 2 4 Element 2 3 2 Element 3 2 Element 4 3 2 Design and explain a concrete data structure that implements this puzzle vector. The data structure must only consist of elements that can store an integer or a pointer to another element or null - elements can be indexed if they are contiguous in memory as with an array. You can draw the data structure and explain how the allowed operations of vectors are implemented on this concrete data structure - additional pointers can be created to traverse lists. One approach could be to use arrays, or linked lists, or another approach completely. [6 marks] This seventh task is intentionally vague to allow for all sorts of creative solutions, as long as they are well explained. Putting everything together We now have all the ingredients to generate a solved puzzle given a row vector called row. The next task will in- volve generating the initial four-element vector called puzzle from row using MAKEVECTOR(row), trying all cyclic permutations (using PERMUTEROW(puzzle, x, y, z) for all combinations of x, y and z) to see if the returned vector returns TRUE for both CHECKGRIDS and COLCHECKS. The puzzle format As mentioned earlier, we will start with a completed puzzle stored in a four-element vector called puzzle where every element is itself a four-element vector, such as 2 41 3 1 3 2 4 3 2 4 1 4 1 3 2 Each row of the puzzle will correspond to an element of a vector, e.g. the first row of the Pseudoku puzzle will be stored as a four-element vector, which itself is an element of a four-element vector. Therefore, this completed Pseudoku puzzle is represented by the following vector: Element1 Element 2 Elements Element 4 We could make this vector by initiating a four-element vector, with each element being empty, and then assign a vector to each element. The goal of the algorithm in this coursework is to generate an unsolved Pseudoku puzzle from a row of four numbers. The first step in the process is to make all four elements of a four-element vector to be the same, and this element will be a four-element vector. For example, given a four-element vector with the numbers 2, 4, 1, 3, we produce the following vector: Element1 Element 2 Element 3 Element 3 Your first task is to write a function in pseudocode that will carry out this process
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
