Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:58:59+00:00 2026-06-04T03:58:59+00:00

i am trying to print a solution path in a maze.Every cell has a

  • 0

i am trying to print a solution path in a maze.Every cell has a parent from where we go to that cell.I am printing the path with the following code.

                do{
                System.out.print("The parent of "+index1+","+index2+"=");
                System.out.println(theParents[index1][index2][0]+","+theParents[index1][index2][1]);
                index1=theParents[index1][index2][0];
                index2=theParents[index1][index2][1];
                }while(!(index1==2 && index2==1));

the problem is that is skips some cells.I couldn’t figure out why?

The parent of 7,7=6,7

The parent of 6,7=5,7

The parent of 5,7=4,7

The parent of 4,7=3,7

The parent of 3,7=2,7

The parent of 2,7=1,7 // as you see we should now print 1,7 but it skips 1,7 and goto 1,6

The parent of 1,6=1,5

The parent of 1,5=2,5 // it skips 2,5 and go to 2,3 directly

The parent of 2,4=2,3

The parent of 2,3=1,3

The parent of 1,2=1,1

The parent of 1,1=0,1

The parent of 0,0=1,0

The parent of 1,0=2,0

What is wrong with the code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:59:00+00:00Added an answer on June 4, 2026 at 3:59 am
    index1=theParents[index1][index2][0];
    index2=theParents[index1][index2][1]; // the index1 here is already reassigned!
    

    You’ve already reassigned index1 when you go to use it in the assignment of index2.

    You need something like

    int newindex1 = theParents[index1][index2][0];
    int newindex2 = theParents[index1][index2][1];
    
    index1 = newindex1;
    index2 = newindex2;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to print a report that contains a bar graph using the
I have a problem that I have been trying to find a solution for
i am trying to extract outline path from given bitmap, i create a fast
I'm trying to change the default path or add a path that the webserver
Im trying print Excel file data on a page. To do it i used
Im trying to print the realtime output based on user input for a search.
I'm trying to print the output of function only when it is true but
I am trying to print invoice. But top whatever i do to setting margins,
I am trying to print a portion of the page in FF3. This works
I am trying to print 1 if there are at least two of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.