Hello there guys, I have finally come up with a rough draft of my Binary Tree program. Could you please try it and comment it?
Your suggestions are welcome. OH... And don't worry, I added the Source Code if you want to compile and run it rather than running the exe file.
Things provided in this Program:
1.- Node Structure
2.- Binary Tree Structure
3.- Adding Nodes to the Tree
4.- Searching Nodes to the Tree
5.- Erasing Nodes of the Tree
6.- Balancing the Tree
-> a) Most-Left Rotation
-> b) Most-Right Rotation
-> c) RR
-> d) LL
-> e) RL
-> f) LR
7.- Graphing the Tree
8.- Calculate Level, Left Height, Right Height, etc. Of a Node
9.- Showing Node Statistics by clicking on it (Also moving the mouser over will trigger a tooltip showing them)
10.- InOrder, PreOrder, PostOrder code supporting a call to other procedure
New Characteristics (In the new version): 1.- Search Engine Added
2.- You can enter the number inside the node to erase it
3.- Some Resizing Bugs fixed (Well, the code for resizing was not my priority before, but it seems to be popular... )
4.- It won't let you resize the form to be less than a certain amount in Width and Height (Yet it blinks, I wonder why, Still Blinking)
5.- First Erase Bug fix
6.- Tab Indexes corrected
7.- Scrolling Bar Issue corrected (It used to overlap)
8.- Letting clear the Tree (I forgot to add "CG = 0")
9.- Auto-Selects the Text of the Search and Erase
10.- Clears All Text boxes when clearing the Tree
Remember "Gosh, are you really a programmer?" is the worst grade you can give it.
Binary Tree's Program: (Updated Version)
Last edited by Tec-Nico; Nov 4th, 2002 at 07:08 PM.
We miss you, friend... Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
It also crashes when entering non-numeric values in the "Erase" textbox.
Also, when entering values like 11,22,33,44,55, unless you click on each node to see its status in the box on the left, you don't know the node number.
Maybe show the node number on the main screen as well ?!
Quotes:
"I am getting better then you guys.." NoteMe, on his leet english skills.
"And I am going to meat her again later on tonight." NoteMe "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
"my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
Originally posted by Tec-Nico I have finally came up with a rough draft of my Binary Tree program.
As I said before, this is a rough draft. This is not the final version.
Some of the details posted before were not thought by me, yet I thank them for when I program the Final Thing.
First... What does this program do?
This is an implementation of a Balanced Binary Tree in Visual Basic.
A Binary Tree is a data structure that provides great advantages when programming searches and other things. In this program I am showing the Binary Tree that would result from inputing certain Integer values (That is why some errors occur when you input strings or other values. Now it only supports Integer ordering, but I am thinking about programming it for any kind of data)
When you click on the node or you hover it with your mouse, you can see in the parenthesis the number of node it is. I know this is not proper and I will search for the number you give to erase. But in this version you cannot give the number inside of the node. I am sorry..
I know guys you are commenting about it and I really like this. I like to have feedback and know what I should add to the final version (I am going to post better versions here, I should tell) And just to let you all know the last option means the program sucks...
I would like you guys to tell me if you find a Tree that is not balanced properly or if something weird happens. For example, I found out that if I erased the 7 element when introducing 1-20 the tree gets crazy.. (I ignore why and I must check it)
Thank you once again for your feedback...
Things Provided by the program:
1.- Node Structure
2.- Binary Tree Structure
3.- Adding Nodes to the Tree
4.- Searching Nodes to the Tree (I forgot to fire it with some command box.. Sorry)
5.- Erasing Nodes of the Tree
6.- Balancing the Tree
a) Most-Left Rotation
b) Most-Right Rotation
c) RR
d) LL
e) RL
f) LR
7.- Graphing the Tree
8.- Calculate Level, Left Height, Right Height, etc. Of a Node
Last edited by Tec-Nico; Nov 4th, 2002 at 01:45 PM.
We miss you, friend... Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
Here you have the updated version. It still cannot support Strings, but I solved the other errors you told me about.
New Characteristics: 1.- Search Engine Added
2.- You can enter the number inside the node to erase it
3.- Some Resizing Bugs fixed (Well, the code for resizing was not my priority before, but it seems to be popular... )
4.- It won't let you resize the form to be less than a certain amount in Width and Height (Yet it blinks, I wonder why)
5.- First Erase Bug fix
6.- It still does not support Strings, just Integers
Thank you and please keep testing it... Hey, who voted "Gosh Are you really a programmer?" That is nasty!
Last edited by Tec-Nico; Nov 4th, 2002 at 07:09 PM.
We miss you, friend... Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
1. If you are not going to let the user Minimize the window completely, don't show the minimize button at all, rather than showing it as disabled all the time.
2. Once a node has been deleted, clear the textbox so you can immediately type in another without first having to delete the number of the node you have just removed.
3. Once return is pressed or the relevant button is clicked, use Selstart and Sellength to highlight entries. That way if anything is incorrect the user isn't forced to delete it before retrying another input.
I know these points seem like nit-picking, but attention to detail helpa a program run smoothly, and if you start to use it consistently its the little things that get to be annoying.
interface errors:
- build tree : 1,2,3,4,5,6,7,8,9,10,11,12,13,1
//horzinal scroll bar apears half hidden by the frame "status node" and hiding some text
-erase 1
//scroll bar disappears although the tree still does not fit
This is really nitpicky, but in your mouseover text ("ToolTipText") the empty blocks are showing up! I know that this has happened to me when I tried at vbcrlf in the tooltiptext when it is set at run time, or perhaps you are trying to add somesort of a seperator?
Something really funny about it is that you write them when I am not on-line.
Anyway, here I will answer all posts once again.
1.- How can I hide the Min Button? I tried to do that
2.- Well, you are right about clearing the box, I will do so.
3.- I thought it would be easier for the user to be able to keep adding nodes if I did not select the whole text. I will consider this and apply it in the other two textboxes
4.- Hobo, I would like that code from you... Thanks!
5.- Does it really give you an error when trying to create another tree?
6.- King Arthur... Did you download the current version? I noticed those errors and I uploaded a version correcting them. Thanks for noticing them, though
7.- Kevin, thanks for your comments. I was told there was a control that would allow me to have multi-lined tooltips, but I have not added it yet... So I left it like this by now, but I am going to add it as soon as possible
I am going to check now these errors... Thank you all!
We miss you, friend... Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
I am going to check the Form Blinking later. Now I just solved what TheBionicOrange asked me to.
All but hiding the Min Button. I just want to let the user Maximize the form so they can get a better view of the Tree. But if minimized it causes an error... Hmmm...
I haven't used the control for the tooltip yet.
Guys, I am in exams.. So this will be my last post until wednesday. I will check then all your suggestions and comments... I saw two people voted "Gosh, Are you really a Programmer?" How nasty, indeed!
Please keep suggesting me things... I will really appreciate it.
We miss you, friend... Rest in Peace, we will take care of the rest of it.
[vbcode]
On Error Me.Fault = False
[/vbcode]
- Silence is the human way to share ignorance
Tec-Nico
If you enter "1,1,1,1,1,1,1,1,1,1,1,1,1,1" or something similarly absurd, it stops responding and needs a BREAK to close it.
Dunno if this is normal, I'm still not sure what this is, even after you've explained it.
Edit:
I also get a "Buffer overflow" if I try to resize it too much, as related to the comments above. The debug reports the problem is in this area:
With HScrollDrawP
.Max = MaxWidth - PicDrawPad.Width
"It's difficult to imagine a world in which people voluntarily choose to listen to liberals. There is no evidence that it has ever happened. " - Ann Coulter