Starting from:

$25

DATA - Homework I - Recursive Functions  - Solved

Fill the table for the each given algorithm, is recursive is a good or bad solution?  (Just add a X) 

Copy/paste this table to your report and fill the blanks 

 
Good 
Bad 
Computing Fibonacci Sequence 
 
 
Towers of Hanoi (Search for it if you don’t know the problem) 
 
 
Computing factorial of a given number 
 
 
An autonomous robot 

looking for a way out of an 

unmapped maze 
 
 
In this homework, you are required to design a Sudoku-like game environment and program using a recursive approach.  Instead of integers, your app should run given keys:  

CNGBIM213 

 

Your program will work on the command line where the commands are given in one line as: (C for create and, S for solve) 

 

 

C :  Generates a 3x3 puzzle randomly, and prints out it on screen.  

 

Here is a some examples of a crated puzzle:  

 

 

 
 

 
 
 
 
 
 
 
 
 


 
 
 
 
 


 
 



 
 
 
 

 
 
 
 
 
 
 
 
 
 


 
 

 
 
 
 

 


 

 
 
 

 
 


 
 
 

 
 
 
 
 

 

 
 
 
 

S : Solves the generated puzzle with a recursive brute force approach. 

 


















































































 

             

Hints 

In case you do not know the rules of Sudoku  

•        https://en.wikipedia.org/wiki/Sudoku 

This program should create and solve puzzles in a similar manner.  

•        In case you do not know what is the brute force approach https://en.wikipedia.org/wiki/Brute-force_search 

•        The purpose of this homework is to build a recursive search algorithm. Thus, you are free to utilize any proper data structure to store your puzzle e.g. a char array.  

•        Here is some solutions, you may adopt solutions on web, but explain how your code work in your report.

http://web.eecs.utk.edu/~bvanderz/cs140/Notes/Sudoku/ https://www.heimetli.ch/ffh/simplifiedsudoku.html 

However, you also need another function to build a Sudoku problem. Therefore, build two classes named:   

•        SudokuCreater

•        SudokuSolver

Also, build an interface to run such classes.

 There are several ways to build a puzzle. Such as  

•        First, you should assign a random variable in a cell, then keep it going until to reach enough number of hints to solve the rest  

•        Another method is to build a completed puzzle, then erase variables from cells until a minimum number of hint to solve the rest

•        or find your own way (and explain it in your report)

  

In this step, you might get clues from Sudoku builder sample codes from web searches.  

  

•        A generated puzzle can only have one (1) possible solution.
Dilara 
Hercan 
Halit Kaan 
 35 %  
35 % 
30 % 
  

More products