Tree data structure is fairly common in software development, and luckily I have quite a bit experience working on those in my career. I started working on this as I was working for UGS/Siemens PLM Software, and I was involved in the development of XML based data adapter for CAD data exchange, a key piece of information we want to translate is the assembly information, or product structure, or in computer/software terms, the tree hierarchy. I did learned a few things on recursive function, etc. Interestingly enough, later on I got a interview phone call from Google, and the guy asked me about recursion, for a simple problem like this: basically they are 100 matches, every time one can take one or 2, how many combinations are there? I said let’s do it in recursive fashion, after quite a bit reminder/hint, finally I said n(100) = n(99) + n(98)
But they were not very impressed with me, as I did not come up with the solutions fast enough, which is fine. I am who I am, I can work on those kind of interesting problems, in my own pace. Or explained in my Chinese name, it’s getting faster gradually 🙂
My dumb mistake
So I got chance to work on tree, and recursion again. And I made a dumb mistake which might be common among people who are new to java, or who have left java for a while/just come back recently (like me). Basically I called a repository function a million times. And I got this error: org.apache.jk.common.channelsocket processconnection status 2
Today I was able to fix it, basically I found it’s unnecessarily to call the repository, I could use 2 hash maps (in memory) for the work.