Why is my sorting algorithm not sorting correctly?
问题 I was given this sorting function in the best answer to a question I posted. It worked on the example data, but does not appear to work on my actual data and I am not sure why. My data can be see here: JSON It's an object of objects like this: "Montana": { "superiors": [ "Massachusetts", "Oklahoma", "New Mexico" ], "inferiors": [ "North Carolina" ] } It exists to instruct the sorting function. Here, Montana must be higher up in the list than North Carolina . But below Massachusetts , Oklahoma