Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE IN JAVA: You are given a five-by-five array of cells, some of which contain letters and the others are empty. You need to fill

CODE IN JAVA:

You are given a five-by-five array of cells, some of which contain letters and the others are empty. You need to fill the empty squares with letters so that there is a path moving only horizontally or vertically (not diagonally) at each step that visits all cells with consecutive letters. The letters are lower case a through y, and a is present in one of the starting cells. For example, a solution to:

image text in transcribed

Write a program to solve this problem. The input consists of five lines, each containing a string of five lower case letters from a to z with no spaces. An a appears exactly once in the five lines. A z indicates an empty cell. The output is five lines, each containing five characters (without spaces), and the five lines together contain each of the letters a through y according to the rules given above. For example, if the input is:

zzzzm

zzzzz

zfzzz

zzzaz

zzzzu

then a correct output is

ijklm

hgpon

efqrs

dcbat

yxwvu

Another way to describe the correct output is that if you place the cursor over the a, then using only the up, down, left, and right arrows you can move the cursor over the letters a through y in order. You may assume that at least one solution exists for any of the test cases. If more than one solution exists, print out just one. Names your program AtoY.

Run time for any input should be approximately 1min cbqpo 3

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

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions

Question

Explain the different types of marketing strategies.

Answered: 1 week ago

Question

Explain product positioning.

Answered: 1 week ago

Question

Explain Industrial market segment.

Answered: 1 week ago

Question

4. What will the team agreement contain?

Answered: 1 week ago