VB Hash Tablet? 
Author Message
 VB Hash Tablet?

What is a Hash Tablet, and how can I do it in Visual Basic? (VB 3.0
Pro)

Also are there any other way to access data faster than using a
For...Next?

Thanks!




Sat, 03 Apr 1999 03:00:00 GMT  
 VB Hash Tablet?

 > What is a Hash Tablet, and how can I do it in Visual Basic?
 > (VB 3.0 Pro)

Um. I think maybe you mean "hash table".  "Hashing" is a method
of manipulating an identifying field to locate the potential
position of information in a memory array, or in a file.
Typically, it will involve "logical" operations (AND, OR) and/or
arithmetic operations on the identifying field to yield a
number that is more-or-less evenly-distributed over the range
of members of an array or records allocated in a file.

 > Also are there any other way to access data faster than using a
 > For...Next?

Sure, there are quite a few: hashing can be one; binary search
can be another.  You'll find them in various books on programming.
The binary search works this way, in general:

 (1) your data must be "ordered" by some key idenfier
 (2) your data must be in an array or a record-oriented file
 (3) you look at the record that is halfway between beginning
     and end of the array or file
 (4) if it's not the one you want, then if the key id you are
     looking for is higher than the one in the array entry or
     record, then you look at the array entry or record that is
     halfway from where you are and the end or where you last
     looked (whichever is less); if the key you're looking for is
     less than in the array entry or record, then you'll next look
     at the one halfway from where you are to where you last
     looked or the beginning (whichever is greater)
 (5) if you've found it, you're done
 (6) if you're about to look again at the last place you looked,
     its not there
 (7) repeat from #4

 Larry Linson

---
 t SLMR 2.1a t



Wed, 07 Apr 1999 03:00:00 GMT  
 VB Hash Tablet?

Quote:


> > What is a Hash Tablet, and how can I do it in Visual Basic?
> > (VB 3.0 Pro)

>Um. I think maybe you mean "hash table".  "Hashing" is a method
>of manipulating an identifying field to locate the potential
>position of information in a memory array, or in a file.
>Typically, it will involve "logical" operations (AND, OR) and/or
>arithmetic operations on the identifying field to yield a
>number that is more-or-less evenly-distributed over the range
>of members of an array or records allocated in a file.

Close but no cigar.  Hashing does not need an array or grouping
of records.  The Boyer-Moore algorithm was written specifically to
match a user selected set of bytes in a large binary file such as
graphics file.

Hashing, usually, but no necessarily is done to find a string pattern
in say a large file.  The choices for searching are obvious.  You can
either do a brute force search or hash the source to determine if
patterns exist.  Then search for the pattern.  The standard algorithms
are Knuth-Pratt, Boyer-Moore, and Rabin-Karp.  While Rabin-Karp can
beat Boyer-Moore in some cases, it can also go geometric without warning.
Most people settle on some derivation of Boyer-Moore.  

If you can "read" C, then there are several good examples of derivatives
of Boyer-Moore in Snippets.  You can find Snippets on any SimTel archive
in /msdos/c/snip9503.zip.

Peter Mikalajunas

http://www.xnet.com/~kd9fb



Thu, 08 Apr 1999 03:00:00 GMT  
 VB Hash Tablet?



Quote:
>What is a Hash Tablet, and how can I do it in Visual Basic? (VB 3.0
>Pro)

>Also are there any other way to access data faster than using a
>For...Next?

>Thanks!



A hash Table (not tablet) is a way to organize data faster than just a clump.
Think of it as mail slots in a hotel.  You assign each piece of data to a
specific slot.  If you have 10,000 elements, you may want 100 hash slots
(stored as an array) with an average of 100 elements in each slot.  If you
know that "data1" is located in slot 43 you only need to search slot 43 for
the data (only 100 elements on average to check) as opposed to all 10,000.  
This is much faster.

It is called a hash table because you hash the data to decide where it should
go.  Say your data is words.  you could use the first letter to determine
where it goes (all a words in slot a, all b words in slot b, etc.)  Hashing
unfortunately has a tendency to clump certain slots and leave other slots
empty, making the system less efficient.  If you have a lot of p words and no
x words, this hash would not work well.  I will leave it up to you to research
the best method to hash, but a hint is to use a prime number of hash slots
becase that tends to spread things out best.  Why, because if you have a
divisable number of slots, you get patterns of repetition.

Oh, one other thing, because you have a fixed number of slots you can store
them as a fixed array, which means that there is no searching on the slot
itself.  You will need to search in the slot for the item however.

As for your question about the for...next loop.  I would use an external
datasource like a mdb file and simply have the database do the work for you.
It is really easy to connect and use a database.  You can even link controls
like textboxes directly to data fields.

Hope this answers your question.

        -brian



Tue, 27 Apr 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Tablet PC / VB 6 and Windows Journal integration

2. Tablet PC / VB 6 and Windows Journal intergation

3. Getting point co-ordinates from cad tablet/digitizer in VB application

4. Help using a Pen Tablet to capture signatures in VB needed

5. using wintab to access a graphics tablet in vb

6. VB Script Password Hash

7. VB/Perl Collection/Hash Question

8. Hashes in VB

9. MD5 hash in VB

10. HASH TABLE IN VB ???

11. Does VB have a Hash Table

12. MD5 Hashing using VB

 

 
Powered by phpBB® Forum Software