|
-
Aug 26th, 2016, 02:13 PM
#11
Re: How much do you trust the Collection class?
 Originally Posted by DEXWERX
No... we have an index into an Array
Okay, that's the last point I don't understand. Not to get defensive, but I have written binary-search routines, doubly-linked loop routines, and hash table routines before. Admittedly, it's been a while because databases just obviate the need to keep those things familiar anymore.
But let me return to your quote. So, you're not talking about the array-of-structures that makes up the doubly-linked list. You can't be. Jumping into that array at an arbitrary point wouldn't make any sense whatsoever. To traverse the double-linked-list as an array would just give you an un-sorted and un-indexed list, not much good for of anything, other than just dumping the data.
So, just to summarize. We presently know about two structures having to do with Collections (one a header and the other an array (the doubly-linked loop)). You (DEX) provided them to us in post #15. And using a bit of ObjPtr magic, we can get to both of those.
So, if I understand correctly, you're proposing that there are two additional structures (one a hash table (small-ish array) and the other a complete sorted array of collection entries). You provided a proposed structure for the hash table:
 Originally Posted by DEXWERX
Code:
Private Type HashTableEntry
Key As String ' <---- actually a hash code?
Value As Variant ' <---- where this points into the array structure shown immediately below?
End Type
Private HashTable(0 to 7) As HashTableEntry
And it's now being proposed that there's another structure (that's always maintained as sorted), that may look something like this?
Code:
Private Type SortedEntries
HashCode As String
FullKey As String
CollectionValue As Variant
CollectionIndex As Long
End Type
If this is true (or some approximation), and I'm not saying it's not, there would seem to have to be some pointer to it within the Collection's header structure. If this is true, it's curious that nobody has worked it out. But I will certainly agree that this could speed key searches up. Just having the full sorted table would allow binary searches.
Regards,
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|