Anonymous user
Talk:AVL tree/C sharp: Difference between revisions
m
no edit summary
(→Possible bug: new section) |
mNo edit summary |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 5:
The sample code in Main seems to work fine: (but only because the items are always added to the "right"?)
Set<string> s = new Set<string>() {"S0","S1","S2","S3","S4","S5","S6","S7","S8","S9"};
but when I test with this code:
Line 15 ⟶ 14:
The problem is that when "S0" is added left of "S1", the "for (;;)" loop is not exited so when the compare is made, the key that was just added, "S0", is now found. The "right" add has a "break" after a new Node is added. The "left" add is missing the "break" after the add.
You are quite right - so I added a break in the code. Much appreciated, clearly you have an understanding of the code - cudos.[[User:NNcNannara|NNcNannara]]
|