Create a recursive backtracking solution

Assignment Help Data Structure & Algorithms
Reference no: EM13802580

The four-color theorem states that any map in a plane can be colored using four-colors in such a way that regions sharing a common boundary (other than a single point) do not share the same color. This problem is sometimes also called Guthrie's problem after F. Guthrie, who first conjectured the theorem in 1852. 

The problem at hand is to take a map separated into regions as expressed in an adjacency matrix and using four colors, color the map such that no two contiguous regions share the same color. We will use an adjacency matrix to encode which region borders on which other region. The columns and rows of the matrix are the regions while the cells contain a 0 if the two regions are not adjacent and a 1 if they border. Create a recursive backtracking solution which accepts as interactive input from the user the number of regions in the map and the filename of the adjacency matrix expressing the maps makeup. Your output should be similar to

Region    Color 

A              red 

B              Green 

C              yellow 

D              Blue 

Or whatever four colors you choose (and if you want you could have the user choose the four colors but that it not mandatory). 

Consider the following map with four regions: 

87_img1.png

Its adjacency matrix would be 

 

A

B

C

D

A

0

1

0

1

B

1

0

1

0

C

0

1

0

1

D

1

0

1

0

Consider the following map of central Europe with 9 regions:

1990_img2.png

The solution to these maps do not require backtracking 

Consider this final map with 6 regions it will require backtracking

1820_img3.png

While these three maps will not fully test your solution they will be a start. Nithin and Billy will be creating a map(s) to test your program when you turn it in. You are to write module specifications (JavaDoc) all methods in the class except main. In addition to turning in a gnulist printout, you are also to email your class to your lab instructor (and only your lab instructor). Use the subject line.

Reference no: EM13802580

Questions Cloud

Convert it to a relational schema : Convert it to a relational schema, Database Management System
Advantages of using new technologies in training : List and detail several advantages of using new technologies in training and development
Semi-annual yields to maturity of the two bonds : Suppose you have the choice of investing in (A) a zero-coupon bond, which costs $500 today, pays no coupon during its life, compounds semi-annually, and then pays $1,000 after 10 years, or (B) a bond which costs $750 today, pays $25 in interest semi ..
Preliminary project scope incorporating all discrete tasks : Identify a project concept that could be implemented at either your workplace or home. The concept needs to fulfil project criteria including being of sufficient complexity to warrant a project manager to implement the task.
Create a recursive backtracking solution : The columns and rows of the matrix are the regions while the cells contain a 0 if the two regions are not adjacent and a 1 if they border. Create a recursive backtracking solution which accepts as interactive input from the user the number of regi..
What was the semi-annual current yield of this bond : The City of Ames issued a new series of bonds on Jan 1, 2009. The bonds were sold at par ($1,000), have a 2.5% annual coupon rate and mature in 10 years, on Jan 1, 2019. Coupon interest payments are made semi-annually (on June 30 and December 31). Wh..
Using the dollar-cost-averaging approach : Suppose that you invested $10,000 dollars using the dollar-cost-averaging approach. Assume that on Feb-1-10, and on Feb-1-11, you purchased $5,000 worth of stock (each year). You then held the shares until they were sold on Feb-1-2014 (assume you rec..
Balance sheet as ordinary shares outstanding : Show and compute the following (don’t use Key Ratios precomputed from the site). Compute the ratios using the methods described in this class (which may not always give you the same number as shown in Key Ratios). Note that sales = Total Revenue, and..
Pros and cons of a budget deficit and the national debt : How will a cut in Government Spending of $300 billion with a MPC equal to .75 impact AD, inflation, and output? Why? Make sure to include the appropriate equations and graph. How does the cut in Government spending impact the budget deficit and the n..

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  What problems come up in verifying this function

How many recursive calls are made by the following initial calls?

  Create list of major steps to follow to get input

Create a list of major steps to follow to get input, process, and output desired information (software requirements). Refine the list to include individual refined steps (algorithm).

  Create algorithm to read file of employee records

Create the algorithm which will read a file of employee records and produce the weekly report of gross earnings for those employees.

  What values will be in the registers after instruction

Calculate the average CPI for each machine, M1, and M2 - calculate the average MIPS ratings for each machine, M1 and M2 - What values will be in the registers after instruction is executed.

  Finds the location of the largest even integer

Describe an algorithm that takes as input a list of n distinct integers and finds the location of the largest even integer in the list or returns 0 if there are no even integers in the list.

  Arraysq1-write a program to find average marks obtained by

arraysq1-write a program to find average marks obtained by 10 students in a test along with algorithm?q2 -write a menu

  1 describe the following named usability design principles

1. describe the following named usability design principles and how you applied them in your coursework? consistency

  Show how the following values would be stored by machines

Show how the following values would be stored by machines with 32-bit words, using little endian and big endian format. Assume each value starts at address 016. Draw a diagram of memory for each, placing the appropriate values in the correct (and ..

  1 describe the jsp life cycledraw a diagram of the various

1. describe the jsp life cycle.draw a diagram of the various events and transformations.for each part of the cycle

  Describe implementation of algorithm on simd computer

Describe an implementation of that algorithm on an SIMD computer where the processors are connected to form a linear array

  Write down an all-pairs algorithm that is given a list of

question 1.algorithms a and b perform the same task. on input of size n algorithm a executes 0.5n2 steps and algorithm

  How to work on datasturetur assignment how to work on

how to work on datasturetur assignment how to work on datasturetur assignment how to work on datasturetur

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd