The (small) company i work for is going to hold a contest targeted mainly at IT students at the nearby university. Since our company mostly makes webapps in Java, we want the contest to be in that direction too. Now we have to come up with a nice challenge for these IT students. This is pretty hard. Would anybody have any ideas for such a contest? I could say in what direction i'm thinking but i don't want to push you in a specific direction here so i won't. It should be possible to make it in a couple of days.
I forgot to mention: the resulting code will be made availble to the world. [ June 27, 2006: Message edited by: Jaap Vermeer ]
Well... Paul Clapham's code is definitely the way to go if you want any sort of maintainability. Then to make it faster, you'll have to profile the code and see what it is doing in thos 6 seconds. Although 1000 iterations a second does not sound absurd, you might be able to make it faster.
The direction you are going, given your example, sounds bad. The order in which the nodes are processed will (likely) not have a major effect on performance, you still need to go through 7000 nodes.
Better Be B.V. is looking for people for multiple positions as Java Developer, both junior and senior.
Based in Enschede, The Netherlands, Better Be is expanding with a branch office in Eindhoven to better serve customers in the south of The Netherlands.
Personally i think those kind of systems suck, but who am i to judge you? Any language/environment will do for suck a program, but since you asked here, we will of course tell you that Java is the way to go.
Is there any language/environment that you have experience in, building webapps?
Are you allowed to assume that the source is valid xml? If so, use an XML parser and SAX or DOM through it. If you just go through the xml in a "linear" way, you can keep a stack of open tags and check that if the one currently closed equals the last opened.