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 8841797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:48:33+00:00 2026-06-14T10:48:33+00:00

I am currently implementing the Greedy Best First Search with a 2D array to

  • 0

I am currently implementing the Greedy Best First Search with a 2D array to represent a grid. My implementation right now returns the opened nodes. I am using a PriorityQueue. When I return the traversed path/opened nodes and take a look at the the nodes it appears that the algorithm jumps from one side of the grid to another some times. Is it supposed to do this? It doesn’t make sense for a player when traversing the grid to jump to a cell on the other side of the grid just because the heuristics over there are better and then jump back.
I am using this grid:
Grid

These are the (y, x) coordinates of all the nodes that have been opened (note that it is y, x to represent a 2D array):

0,0 Goes across the top of the board
0,1
0,2
0,3
0,4
0,5
1,5 Goes down one cell
1,4 goes left
1,6 goes right 2 spaces
0,6 goes up
1,7 goes down the side of the board
2,7 \/
3,7 \/
4,7 \/
5,7 \/
0,7 jumps up across the board
6,7
1,2 jumps up across the board
2,2
3,2
4,2
3,1
4,1
3,0
2,1
5,2
5,1
4,0
2,0
7,7 jumps up across the board
7,6
7,5
6,5
5,5
5,4
4,4
3,4
3,5
  • 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-14T10:48:34+00:00Added an answer on June 14, 2026 at 10:48 am

    If you track each node’s parent when you add them to the priority queue then you can think of the queue as tracking not just nodes, but entire path segments. Each node in the queue represents a viable path segment that ends at that node.

    For example, at the point you reach 5,7 you’ve determined that this path is the most promising so far:

    (0,0 0,1 0,2 0,3 0,4 0,5 1,5 1,6 1,7 2,7 3,7 4,7) [5,7]
    

    (I’ve put the node in [brackets] and the path to get to that node in (parentheses). Following the chain of parents backwards yields the path.)

    When the 5,7 node doesn’t pan out, you add all of its successors of 5,7 to the queue, then you pull the next node from the queue. At this point it turns out you don’t get one of 5,7’s successors. Instead the heuristic function decides to try a different node:

    (0,0 0,1 0,2 0,3 0,4 0,5) [0,6]
    

    It tries this, doesn’t reach the goal, and continues on. Now it goes back to considering one of 5,7’s successors:

    (0,0 0,1 0,2 0,3 0,4 0,5 1,5 1,6 1,7 2,7 3,7 4,7 5,7) [6,7]
    

    And so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our company currently implementing TSA (Time Stamp Authority) service. And now we are searching
I am currently implementing cache. I have completed basic implementation, like below. What I
Im currently implementing a selectable list based off the jquery selectable grid demo at
I am currently implementing Facebook Login on my website for the first time and
I'm currently implementing a non-renewable in-app purchase and am a little concerned over the
I'm currently implementing a JavaScript library that keeps track of the history of changes
I'm currently implementing a very complex tree structure to allow for near-instant data access,
We are currently implementing MOSS 2007 to replace an older portal system (Plumtree) and
I'm currently implementing a .NET wrapper for a Java library by using JNI to
I'm currently implementing a RESTful API (nothing serious, just for a blog engine i'm

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.