A queue? I thought it was a stack! Change the direction of your Pop method's loop. Better yet, use a variable as I suggested to track the cursor (circular queue).
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu function Push(String array, PathNode* to_add)
{
for (int n = TOTAL_NODES - 2; n >= 0; n--)
{
if (array == "frontier")
{
if (frontier[n].valid == true)
{
frontier[n+1].valid = true;
frontier[n+1] = frontier[n];
}
}
}
if (array == "frontier")
frontier[0] = to_add;
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.405 seconds with 17 queries.