Click here to Skip to main content
15,908,776 members
Home / Discussions / C#
   

C#

 
AnswerRe: Using Binary Trees Pin
User 665810-Sep-06 7:37
User 665810-Sep-06 7:37 
Your implementation has several flaws.
1) You don't need two classes Tree and Node, you can merge them into one.
2) methods like AddNode(), RemoveNode() and Search() have to be public
3) the contructor of a Node/Tree should ideally have a value parameter, like Tree(int value)
4) you don't need a root node in your tree, left and right childs are enough
5) when adding/searching/removing check for < and >= and not just > and <

Once you fix that, you may use it like that:

Tree binTree = new Tree(5);
binTree.Add(10);
binTree.Add(3);


There are lots of bintree examples on the internet, you can almost copy them 1 to 1, even the Java ones Wink | ;)

regards

modified 12-Sep-18 21:01pm.

QuestionRe: create a PKI certificate with RSA public/private key. Pin
edchan10-Sep-06 4:25
edchan10-Sep-06 4:25 
AnswerRe: create a PKI certificate with RSA public/private key. Pin
Nader Elshehabi10-Sep-06 5:03
Nader Elshehabi10-Sep-06 5:03 
GeneralRe: create a PKI certificate with RSA public/private key. Pin
edchan10-Sep-06 5:49
edchan10-Sep-06 5:49 
GeneralRe: create a PKI certificate with RSA public/private key. Pin
Nader Elshehabi10-Sep-06 6:00
Nader Elshehabi10-Sep-06 6:00 
QuestionHow can I implement IPC between two applications(VB and C# ) Pin
Orchid8510-Sep-06 4:23
Orchid8510-Sep-06 4:23 
AnswerRe: How can I implement IPC between two applications(VB and C# ) Pin
Nader Elshehabi10-Sep-06 4:54
Nader Elshehabi10-Sep-06 4:54 
QuestionConnectionTimeout Pin
TAREQ F ABUZUHRI10-Sep-06 4:01
TAREQ F ABUZUHRI10-Sep-06 4:01 
AnswerRe: ConnectionTimeout Pin
TAREQ F ABUZUHRI10-Sep-06 4:41
TAREQ F ABUZUHRI10-Sep-06 4:41 
AnswerRe: ConnectionTimeout Pin
Nader Elshehabi10-Sep-06 4:50
Nader Elshehabi10-Sep-06 4:50 
GeneralRe: ConnectionTimeout Pin
TAREQ F ABUZUHRI10-Sep-06 6:00
TAREQ F ABUZUHRI10-Sep-06 6:00 
GeneralRe: ConnectionTimeout Pin
Nader Elshehabi10-Sep-06 6:06
Nader Elshehabi10-Sep-06 6:06 
QuestionShow sort header arrow and image in listview 2.0 Pin
ika210-Sep-06 1:23
ika210-Sep-06 1:23 
AnswerRe: Show sort header arrow and image in listview 2.0 Pin
Nader Elshehabi10-Sep-06 3:17
Nader Elshehabi10-Sep-06 3:17 
GeneralRe: Show sort header arrow and image in listview 2.0 Pin
ika210-Sep-06 3:34
ika210-Sep-06 3:34 
GeneralRe: Show sort header arrow and image in listview 2.0 Pin
Nader Elshehabi10-Sep-06 4:38
Nader Elshehabi10-Sep-06 4:38 
GeneralRe: Show sort header arrow and image in listview 2.0 Pin
Arjun "Mjolnir" Bahree10-Sep-06 3:38
Arjun "Mjolnir" Bahree10-Sep-06 3:38 
QuestionA 2D graphics via Direct3D - gaming engin Pin
HRiazi10-Sep-06 0:37
HRiazi10-Sep-06 0:37 
AnswerRe: A 2D graphics via Direct3D - gaming engin Pin
Nader Elshehabi10-Sep-06 1:00
Nader Elshehabi10-Sep-06 1:00 
AnswerRe: A 2D graphics via Direct3D - gaming engin Pin
Arjun "Mjolnir" Bahree10-Sep-06 3:46
Arjun "Mjolnir" Bahree10-Sep-06 3:46 
AnswerRe: A 2D graphics via Direct3D - gaming engin Pin
Judah Gabriel Himango10-Sep-06 7:37
sponsorJudah Gabriel Himango10-Sep-06 7:37 
QuestionShow a still image in wondows media player Pin
Yasamin Mokri9-Sep-06 21:26
Yasamin Mokri9-Sep-06 21:26 
AnswerRe: Show a still image in wondows media player Pin
Nader Elshehabi10-Sep-06 2:40
Nader Elshehabi10-Sep-06 2:40 
AnswerRe: Show a still image in wondows media player Pin
Arjun "Mjolnir" Bahree10-Sep-06 3:50
Arjun "Mjolnir" Bahree10-Sep-06 3:50 
Questionreflection + AddEventHandler() Pin
g00fyman9-Sep-06 18:48
g00fyman9-Sep-06 18:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.