JOIN
 Select a Forum     Round Tables New Member Discussions News Discussions Algorithm Matches Marathon Matches NASA Tournament Lab TopCoder Cookbook High School Matches Sponsor Discussions Development Forums Design Forums Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings View: Flat (newest first)  | Threaded  | Tree Previous Thread  |  Next Thread Forums Tutorial Discussions Introduction to graphs and their data structures I think the BFS pseudo-code should be corrected in the BFS article
 I think the BFS pseudo-code should be corrected in the BFS article | Reply Hi,Just wanted to check if somebody can correct the following pseudo code:I was going through the the Algorithms Tutorial, Introduction to graphs and their data structures: Section 2, and I realized that the BFS pseudo-code might have a mistake:Where it reads:for (int player1XDelta = -1; player1XDelta <= -1; player1XDelta++) { for (int player1YDelta = -1; player1YDelta <= -1; player1YDelta++) { for (int player2XDelta = -1; player2XDelta <= -1; player2XDelta++) { for (int player2YDelta = -1; player2YDelta <= -1; player2YDelta++) {It should read:for (int player1XDelta = -1; player1XDelta <= 1; player1XDelta++) { for (int player1YDelta = -1; player1YDelta <= 1; player1YDelta++) { for (int player2XDelta = -1; player2XDelta <= 1; player2XDelta++) { for (int player2YDelta = -1; player2YDelta <= 1; player2YDelta++) {I noticed that the explanation is correct (we should use a for loop from -1 to 1) but the pseudo-code right after that seems to have a mistake.Thanks.- JA -
 Forums Tutorial Discussions Introduction to graphs and their data structures I think the BFS pseudo-code should be corrected in the BFS article Previous Thread  |  Next Thread