Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am beggning functions in the C language and am vary confused. I need to provid

ID: 672308 • Letter: I

Question

I am beggning functions in the C language and am vary confused. I need to provide 6 functions as follows

1] function to compute an exponent x^n and cannot call library functions

2] function that determines the larget value in an arrar a[n] and returns it. parameter n specifies the lenght a[] and a[] cannot be modified (no sorting)

3] function to determine is array a[] is sorted from smallest to largest (duplicates allowed), returning 1 if sorted and 0 if not. parameter n specifies the length of a[] and the array cannot be modified

4] function to determine how many times parameter val appears in the array a[] and returns the count. parameter n determines the length of a[] and the array cannot be modified

5] function to determine if array a[] and b[] contain the same values, but not necessarily in the same order, returns 1 if yes and 0 if no. If more than one occurence of a number happens in one array, then the other array must also have the same number. parameter n defines the length of a[] and b[]

6] function to determine if an array row[] represents a legal sudoku row, returns 1 if so and 0 if not

thank you, please comment

Explanation / Answer

1

2

3

4

5

6

ool SolveSudoku(int grid[N][N])

{

    int row, col;

    // If there is no unassigned location, we are done

    if (!FindUnassignedLocation(grid, row, col))

       return true; // success!

    // consider digits 1 to 9

    for (int num = 1; num <= 9; num++)

    {

        // if looks promising

        if (isSafe(grid, row, col, num))

        {

            // make tentative assignment

            grid[row][col] = num;

            // return, if success, yay!

            if (SolveSudoku(grid))

                return true;

            grid[row][col] = UNASSIGNED;

        }

    }

    return false; // this triggers backtracking

}