Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
Looks interesting - a few months ago I was checking out JavaCC/ANTLR etc to try and produce a Sybase TSQL parser and really didn't take to any of them. In the end I just hand crafted a parser (I know - yuk) but I really should redo it using parser generator tools (such as yours).
Anyway...
I actually worked on this thing at the early stages (as a end-user system interacting with the spine) - was obvious then the thing wouldn't fly, WAY way over complicated as it was all basd on HL7 v3 (think masses of xml and xsd).
Then take all the HL7 xml and wrap it inside...wait for it...more...
I obviously didn't make it clear, you are rearranging the array, not sorting it. To put it another way, you are not allowed to look at the contents of the array items to help you. So any kind of sort function is right out. Anyway who cares its old news now..! (somebody pasted a good solution...
Got this many years ago in an interview:
http://digg.com/programming/Array_Reordering_Programming_Puzzle
Not too hard, but hard to do in < 30 minutes under pressure.