Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Baseline ImplementationProvided to you is a simple implementation of the pruned backtracking search. The implementation is broken - down into three parts: ( 1 )

Baseline ImplementationProvided to you is a simple implementation of the pruned backtracking search. The implementation is broken-down into three parts: (1) the entry point of the application (i.e., the main function), which instrument the execution of the whole application; (2) auxiliary functions, which execute secondary functionality to print solutions; and (3) core functions to execute the pruned backtracking algorithm. The detailed description of each part of the implementation is as follows:1. Entry Point of the Application: This constitute the main function of the application, shown in Figure 2. The main function will initialize global variables used to store solutions. It will also ask the user for the value of n. The main function will also allocate an n \times n board byte-array on its stack and pass the address to that board to the backtracking search implementation. The main function will instrument the execution by calling solveNQueen, which executes the backtracking search implementations. Once finished with search, the main function will call printSolutions from the auxiliary functions to print all stored solutions.2. Auxiliary Functions: There are two auxiliary functions, shown in Figure 3: printSolutions, and printSolution. The first auxiliary function (printSolutions) iterates through the global memory area for stored solutions, which is boards, and calls printSolution to print each board by passing it as an argument. The second auxiliary function (printSolution) prints the solution passed through arguments to stdout.343. Core Functions: There are three functions that are used together to execute the core backtrack- ing search algorithm, shown in Figure 4: solveNQueen, isSafePlacement, and saveSolution. The main function is solveNQueen, which recursively iterates through the rows looking for safe placement for a queen and traversing the tree, shown in Figure 1. Safe placements for a potential queen is checked through the second function, isSafePlacement. Finally, once a safe placement is found for a queen on the last row, solveNQueen calls the third function (saveSolution) to save the solution in the global memory buffer (boards) and keep track of how many solutions were found.Deliverables and ReportThe work required for this bonus work assignment is divided into two parts: deliverables, and a report.4.1 DeliverablesThere are three deliverables for this assignment. These deliverables and their explainations are as follows:1. Baseline Implementation in MIPS: An implementation in MIPS assembly for the baseline implementation described in Section 3. One can focus on the implementation of the core functions only. The C-code provided can be used as a golden reference to cross-check results and verify correctness.2. Alternative Implementation in C and MIPS: An implementation in C and MIPS assembly for the improved and enhanced alternative implementation of an algorithm that can solve the N- Queens puzzle described in Section 2. This alternative implementation is expected to compete and achieve better performance in solv

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

Students also viewed these Databases questions