Important alert:(current site time 6/3/2015 5:03:59 AM EDT)
My apologies, but the planet source code database and zip file downloads are not working reliably.The problem is with some hardware in the storage unit that hosts the planet source code servers in a virtual machine environment. A technician is working on the problem, but parts are slow to arrive. Thanks for your patience while we get this resolved. - Ian Ippolito: Creator of Planet Source Code
Balanced Binary AVL Trees Using Dynamic RAM Allocation
Provides any amount of requested memory (as long
as there is available RAM) and associates that
memory with a user-defined alphanumeric key.
Features very fast retrieval in sorted order, even
faster sequential access (in the chronological
order the requests were made).
The alphanumeric keys are associated with a
certain quantity of bytes located at a designated
position in RAM. That RAM is and remains
exclusively reserved for that Key. Via the key the
address can be returned, and also the reserved
bytes at that address. Keys are internally managed
with a balanced binary AVL tree. It is possible to
iterate through the whole collection of keys in
the order in which these keys were created (and
the memory allocated), returning the Key, the
Memory Address and the Size. It is also possible
to access all the Keys in sorted order (ascending
as well as descending). All operations are
considerabily faster than VB's Collection object
(as far as such functions are provided by the
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come
out every day, so no prevention program can catch 100% of them. For your own safety, please:
Re-scan downloaded files using your personal virus checker before using it.
NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Scan the source code with Minnow's Project Scanner
If you don't have a virus scanner, you can get one at many places on the net
Terms of Agreement:
By using this code, you agree to the following terms...
You may use
this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
You may link to this code from another website, but ONLY if it is not wrapped in a frame.
You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
With 2 million elements, my VB 6 SP 5 under Win 2000 Pro says "Out of memory" (having 1.3 GB :p) - well, the DLL can handle 5 million entries easily (that's as far as I went when testing, although the key generation process becomes a nuysance then, due to repetitions in the Rnd() sequences: use a prime number as key length if you're going to try the same). However, it's just so that VB won't let me create a larger string array to store the generated keys in the test form's array.
(If this comment was disrespectful, please report it.)
True, enmity: As is the case with all VB projects, it is much faster when compiled. When running the project in the IDE, the built-in (already "compiled") Collection object wins by lengths.
The reference to SatBNF refers to another DLL (Backus Naur Form lexer and parser, which I might upload as well in a few days after some more testing, possibly also within a tutorial describing parser building in VB). It merely escaped my attention to remove that reference from the file "SatStructures.vbp". For now, you can safely delete the line "Class=SatBNF;" in there. (If this comment was disrespectful, please report it.)
First I would like to thank you for your superb AVL class. It is very much appreciated.
VB's Collection object has a reputation for being surprisingly fast for insertion and key lookups so blowing it away with this AVL tree is impresssive.
I'm lead to believe the VB Collection object uses a hash table or a binary tree internally for its fast performance.
I selected your AVL class as my basis for a fast VB Collection substitute.
However, after creating a node removal algo I needed to test it. I set up to test the trees validity before and after a node delete operation - and it failed before!
A couple of slight changes to your double rotation routines fixed the subtle bugs that maintained a valid binary search tree but not a valid AVL balance on certain situations. The second (or third) last line in each routine was the culprit if I remember correctly. ... cont'd next comment ... (If this comment was disrespectful, please report it.)
super, :) (If this comment was disrespectful, please report it.)
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular code, please
click here instead.)