> Did you guess an XML document?
If that is your most common experience with asking that question, maybe it is time you consider whether you are communicating what you want properly to your candidates.
> Did you guess an XML document?
If that is your most common experience with asking that question, maybe it is time you consider whether you are communicating what you want properly to your candidates.
But I don't know how much better I could have described what I wanted:
"I want a class for holding a queue of items in memory. The queue will only need to hold a few thousand items, and you don't need to worry about persisting it in case of a power failure or anything. The only wrinkle is that when an item is added to a queue it has a priority. Higher priority items need to come out of the queue before lower priority items, but items with the same priority should come out in the order they were inserted."
My naive contribution: A linked list with pointers to the tails of various priorities. The grabber just points to the head and pops things off the top as it goes.
I tried. It got tiring. Sometimes people would loop through all possible priorities plugging them into an XPath query and pop the first element of the highest priority that matched. Some would do two XPath queries, one across all nodes to get the max priority and a second to query the first element (ignoring the lack of a need to run the query a second time at all). Some would insist that XPath has some function that would let you select a node with an attribute that has the maximum numeric value.
I'd have been fine with your solution.