1: The files in sudoku.zip contain integer values for Sudoku puzzles (two dimensional integer arrays with 9 rows and 9 columns). Write a program that reads a sudoku file as input and prints out if the file is a proper solution to the Sudoku puzzle.

For the rules of Sudoku, check Wikipedia: http://en.wikipedia.org/wiki/Sudoku. Example of a correct puzzle:
1 2 3 4 5 6 7 8 9
4 5 6 7 8 9 1 2 3
7 8 9 1 2 3 4 5 6
2 3 4 5 6 7 8 9 1
5 6 7 8 9 1 2 3 4
8 9 1 2 3 4 5 6 7
3 4 5 6 7 8 9 1 2
6 7 8 9 1 2 3 4 5
9 1 2 3 4 5 6 7 8

Pblem 2: Insertion Sort is a sorting algorithm that moves the elements of an array to their correct position
one element at a time. The following example shows the steps for sorting array data= [3, 7, 4, 9, 5, 2, 6, 1]. In
each step, the item under consideration is underlined. The array before the underlined element is already sorted
while the array after the underline element is unsorted. The item that is moved (or left in place because it was the
biggest yet considered) to the correct position within the sorted part of the array. The new position of the element
that was moved in the previous step, appears in bold in the next step.

3 7 4 9 5 2 6 1
3 7 4 9 5 2 6 1
3 7 4 9 5 2 6 1
3 4 7 9 5 2 6 1
3 4 7 9 5 2 6 1
3 4 5 7 9 2 6 1
2 3 4 5 7 9 6 1
2 3 4 5 6 7 9 1
1 2 3 4 5 6 7 9

Develop C code that would implement the Insertion Sort algorithm. Your code should use the following functions 

void insertion(int x[ ], int size)
void print ar(int x[ ], int size)
void swap(int *a, int *b)
The last two functions are already provided in the class notes.

 

 

    • 5 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      sudoku.zip
    • attachment
      insertionsort.zip