Change Greedy and A* search so that when nodes have the same f() value,
the rightmost node will be expanded first.

This is to ensure that node expansion is consistent with the original
AI-Search applet.