Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

xie tuo

Greenhorn
+ Follow
since Jan 07, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by xie tuo

Scott Ambler, thank you very much!
Would anybody recommend the best book you have read about OO, because during an interview I was told that �abstraction ability and oo are what we care about the most�, so I assume during the next interview I will be tested a lot about my �abstraction ability� and �oo ability�, could anybody give me some suggestion.
During the interview I was asked a question:

Suppose a human resource department has to manage, say, 30,000 employees. The relationship we care about is only supervising and supervised. From this relationship, we can define a tree structure.


According to this image, we could say 1 supervise 2 and 3, 2 supervise 4, 5 and 6.

Since this is a big tree, we have to put it into a database.

The question: how to design your table, so that:
1) given an employee X, we could quickly find X's supervisor;
2) given an employee X, we could quickly find all X's sibling (the same level manager)
3) given an employee X, we could quickly find all X's supervisors, that is the path from the root to X.

Here is my answer:
-------------------------------------------------------------------
My table structure is like the following:

ID Hierarchy
1.1.
2.1.2.
3.1.3.
4.1.2.4.
5.1.2.5.
6.1.2.6.
7.1.3.7.
8.1.2.6.8.

Hierarchy = (Hierarchy of Parent) + this.ID + �.�
The point is to save each node�s hierarchy information in the table.

Thus, to get P�s children: find all nodes that has hierarchy starts with (Hierarchy of P).

To get all sibling of N: get N�s parent�s hierarchy H first, then find all nodes whose hierarchy starts with H.

To get the path of a node N: N�s hierarchy is N�s path.
--------------------------------------------------------------------------

The comment from the interviewer towards my answer:

Not efficient, cannot handle addition and removal of nodes efficiently. Say, I want to reorganize my company, and get rid of the middle management that is redundant. Therefore, direct reports of those that are laid off have to report to a new manager.

The interviewer said there definitly should be another well-known optimized solution to this question, and give me several hours to figure it out, no matter I ask somebody or google it. So I come here. Wish somebody can help me!

By the way, during the interview process, he gave me a hint: map the tree node to element of an array. I do not know if this hint is useful or misleading.

Thanks!
17 years ago
to: Vineela Devi Jakka
Yes, your are right! thank you
just installed Tomcat 5.5.8 on my home Windows XP machine. I am getting the HTTP Status 404 - "The requested resource (/Beer-v1/form.html) is not available." error when I tried to follow the example on HF page 76.

i got the same problem on school lab's Linux machine.

if i move the "Tomcat 5.5\webapps\Beer-v1\form.html" to "Tomcat 5.5\webapps\jsp-examples\", i can get the html page by typing "http://localhost:8080/jsp-examples/form.html".

any suggestion? thanks!
Cleared the SCMAD today. There is a job opening in my area, so I cannot wait for Sun's logo, could anybody send me a SCMAD logo so I can put it on my resume right away! Thanks! I prefer the old version logo like this:
I am another one. I have scheduled the exam on Monday, and purchased the SCMAD simulator on Saturday. However, I cannot activate it! I have send an email to support@whizlabs, but guess they don't work on Saturday. I don't know if anybody here could help me! It is so urgent!!
that is my fault! the correct email address is xuebo.liang@gmail.com
To Ransika

Which country are you in? Do you still need the new version "wrieless Java by Jonathan"? Please send me an email "xuebo.liang@gamil.com", maybe I can help you.