Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > Graphs & Hash Tables (re: programming)
Pages (2): [1] 2 »   Last Thread   Next Thread
Share
Author
Thread    Post A Reply
UglyDave
i ran a marathon : )



Registered: Jan 2003
Location: Buncrana, Éire
Graphs & Hash Tables (re: programming)

ok folks, here's the deal..

i have an exam in the morning, and i was sick & missed two lectures.

$5 to the first person who can give me a brief explanation of what both of these things are.

thank you very much.

David

Old Post Jan-10-2004 00:12  Ireland
Click Here to See the Profile for UglyDave Click here to Send UglyDave a Private Message Visit UglyDave's homepage! Add UglyDave to your buddy list Report this Post Reply w/Quote Edit/Delete Message
DigiNut
You kids get off my lawn!



Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
Re: Graphs & Hash Tables (re: programming)

quote:
Originally posted by UglyDave
ok folks, here's the deal..

i have an exam in the morning, and i was sick & missed two lectures.

$5 to the first person who can give me a brief explanation of what both of these things are.

thank you very much.

David

A hash table is a system of storing objects based on some numeric function of that object. A hash can be any function, but as an example, let's say you're storing strings in a 100-element hash table, one way of hashing would be to take the ASCII codes of all the characters, add them together (sum), and store the string in array element (sum % 100).

The purpose is to provide a faster method of storing and searching, i.e. rather than having to sort alphabetically or scan through the entire array to find something.

Of course there also needs to be a system of dealing with hash conflicts, since no hashing function is completely unique. But that's a whole other topic.

As for graphs... I think we need some context there.


___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here

Old Post Jan-10-2004 00:23  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Noisician
Harsh electronic purity



Registered: Aug 2001
Location:
Re: Re: Graphs & Hash Tables (re: programming)

quote:
Originally posted by DigiNut
A hash table is a system of storing objects based on some numeric function of that object. A hash can be any function, but as an example, let's say you're storing strings in a 100-element hash table, one way of hashing would be to take the ASCII codes of all the characters, add them together (sum), and store the string in array element (sum % 100).

The purpose is to provide a faster method of storing and searching, i.e. rather than having to sort alphabetically or scan through the entire array to find something.

Of course there also needs to be a system of dealing with hash conflicts, since no hashing function is completely unique. But that's a whole other topic.

As for graphs... I think we need some context there.


yes, basically.

hash tables are among the most convenient data-storage structures when it comes to insertion and searching (it's practically o[1] in the big-o notation). coders usually use them when there's a need to look up tens of thousands of items in less than a second. in fact, hash tabels *are* the fastest data structure. they are especially useful when large amounts of data are involved. they are what is typically used in spell checkers and as symbol tables in compilers. another advantage of the tables is their insensitivity toward the order in which data is stored/inserted (unlike trees). as a result, programming for hash tables is much and much easier than for (binary) trees. there are three kinds of their conceptual implementations: linear probing, quadric probing and separate chaining. all of them have their pros and cons. though hash tables with separate chaining are the hardest to program.

of course, as with all data-storage structures, hash tables have their own disadvantages. for one thing, all of them are based on arrays, and arrays are somewhat hard to expend once they've been created. in addition, with hash tables, there's no way to visit the stored items in any kind of order - that is, no ordered traversal is basically possible. that's where binary search trees would be a better choice. also, the efficiency of some particular kinds of hash tables is inversely proportional to their "fullness." their performance might decrease drastically if they become too full.

as for the graphs, i *think* in this case it referes to the big-o notation, which is merely a measure of the efficiency of a particular algorithm. one important thing to remember is that the purpose of a big-o graph (which shows the relationship between time and number of items) is NOT to depict an actual figure for running time, but rather to demonstrate the way running times are affected by the number of items. in other words, this is a kind of comparison that is directly related to the number of items. different algorithms have different running time in big-o notation and therefore have different graphs. for example,

the running time of linear search is represented through the o(n) notation where n is the number of items in the array.
the running time of insertion in an *unoredered* array is always o(1) = 1
the running time of insertion in an ordered array is o(n)
the running time of deletion in any array is o(n) as well
binary search is proportional to log(n)
etc. etc.

another important thing to know is the fact that the majority of these algorithms are represented through monotonously-increasing functions, which is a very bad thing because it in fact shows that the efficiency drops when the number of items increases. i can't think of any algorithm whose graph is a monotonously-decreasing function, which would be just perfect. because of this limitation, an algorithm that runs in o(1) time is the best.

this is why hash tables are almost ideal when working with huge amounts of data. no mattar how many data items there are, insertion and searching take close to constant time, the perfect o(1)!


___________________

Last edited by Noisician on Jan-10-2004 at 03:05

Old Post Jan-10-2004 02:58 
Click Here to See the Profile for Noisician Click here to Send Noisician a Private Message Visit Noisician's homepage! Add Noisician to your buddy list Report this Post Reply w/Quote Edit/Delete Message
DigiNut
You kids get off my lawn!



Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
Re: Re: Re: Graphs & Hash Tables (re: programming)

quote:
Originally posted by Noisician
yes, basically.
...in fact, hash tabels *are* the fastest data structure. they are especially useful when large amounts of data are involved.

Not true, there are also scatter table implementations which eliminate the clustering/coalescence problems (re-hashing algorithms). They have all the advantages of hash tables but are more effective at dealing with collisions. I wasn't going to get into that but since you brought up the subject...

Even better is a self-chained scatter table, but that's pretty hard to implement.

Hash tables are the most convenient because they're readily available in the default C++/Java libraries.


___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here

Old Post Jan-10-2004 03:04  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Noisician
Harsh electronic purity



Registered: Aug 2001
Location:
Re: Re: Re: Re: Graphs & Hash Tables (re: programming)

quote:
Originally posted by DigiNut
Not true, there are also scatter table implementations which eliminate the clustering/coalescence problems (re-hashing algorithms). They have all the advantages of hash tables but are more effective at dealing with collisions. I wasn't going to get into that but since you brought up the subject...

Even better is a self-chained scatter table, but that's pretty hard to implement.

Hash tables are the most convenient because they're readily available in the default C++/Java libraries.


quote:
Originally posted by Noisician
also, the efficiency of some particular kinds of hash tables is inversely proportional to their "fullness." their performance might decrease drastically if they become too full.


both chained scatter and open scatter algorithms may cause removal to be very complicated due to their limited capacity. as such tables become more saturated with data, their chains tend to accrete, creating new, anfractuous data-chains, which SIGNIFICANTLY slows down the search and removal operations.


___________________

Old Post Jan-10-2004 03:35 
Click Here to See the Profile for Noisician Click here to Send Noisician a Private Message Visit Noisician's homepage! Add Noisician to your buddy list Report this Post Reply w/Quote Edit/Delete Message
DigiNut
You kids get off my lawn!



Registered: Dec 2002
Location: Toronto, Self-proclaimed Centre of the Universe
Re: Re: Re: Re: Re: Graphs & Hash Tables (re: programming)

quote:
Originally posted by Noisician
both chained scatter and open scatter algorithms may cause removal to be very complicated due to their limited capacity. as they become more saturated with data, their chains tend to accrete, creating new, anfractuous data-chains, which SIGNIFICANTLY slows down the search and removal operations.

That would be coalescence, which is why instead of that, you use re-hashing or inner chaining (not separate chaining).


___________________
My party schedule:
2009-02-21 - DJ Attention @ I'm So Popular
2009-06-18 - DJ Annoying @ People Need To Know Where I'll Be
2012-11-32 - DJ Insufferable ɸ Or At Least the Stalkers I Complain About
2048-06-66 - Spastic & Whocares Although I'm Actually Flattered
9999-45-81 - Tweaker Gimp I Probably Won't Even Go To This But I Have To Make Sure I Fill Up All The Available Space Here

Old Post Jan-10-2004 03:39  Canada
Click Here to See the Profile for DigiNut Click here to Send DigiNut a Private Message Add DigiNut to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Noisician
Harsh electronic purity



Registered: Aug 2001
Location:

quote:
Originally posted by DigiNut
That would be coalescence, which is why instead of that, you use re-hashing or inner chaining (not separate chaining).



that solution is not ideal, either. even though using a second hash function drastically reduces *primary* clustering, the same problem exists nevertheless: the performance deteriorates as the table fills up.

and before u've mentioned this, of course u can use more than two functions, but such schemes would be very and very hard to implement.


___________________

Old Post Jan-10-2004 04:30 
Click Here to See the Profile for Noisician Click here to Send Noisician a Private Message Visit Noisician's homepage! Add Noisician to your buddy list Report this Post Reply w/Quote Edit/Delete Message
TrAnCe CoNtRoL
Made of Love



Registered: Jan 2001
Location: D Town, Michigan, USA/DTA #9
Re: Re: Re: Graphs & Hash Tables (re: programming)

quote:
Originally posted by Noisician
yes, basically.

hash tables are among the most convenient data-storage structures when it comes to insertion and searching (it's practically o[1] in the big-o notation). coders usually use them when there's a need to look up tens of thousands of items in less than a second. in fact, hash tabels *are* the fastest data structure. they are especially useful when large amounts of data are involved. they are what is typically used in spell checkers and as symbol tables in compilers. another advantage of the tables is their insensitivity toward the order in which data is stored/inserted (unlike trees). as a result, programming for hash tables is much and much easier than for (binary) trees. there are three kinds of their conceptual implementations: linear probing, quadric probing and separate chaining. all of them have their pros and cons. though hash tables with separate chaining are the hardest to program.

of course, as with all data-storage structures, hash tables have their own disadvantages. for one thing, all of them are based on arrays, and arrays are somewhat hard to expend once they've been created. in addition, with hash tables, there's no way to visit the stored items in any kind of order - that is, no ordered traversal is basically possible. that's where binary search trees would be a better choice. also, the efficiency of some particular kinds of hash tables is inversely proportional to their "fullness." their performance might decrease drastically if they become too full.

as for the graphs, i *think* in this case it referes to the big-o notation, which is merely a measure of the efficiency of a particular algorithm. one important thing to remember is that the purpose of a big-o graph (which shows the relationship between time and number of items) is NOT to depict an actual figure for running time, but rather to demonstrate the way running times are affected by the number of items. in other words, this is a kind of comparison that is directly related to the number of items. different algorithms have different running time in big-o notation and therefore have different graphs. for example,

the running time of linear search is represented through the o(n) notation where n is the number of items in the array.
the running time of insertion in an *unoredered* array is always o(1) = 1
the running time of insertion in an ordered array is o(n)
the running time of deletion in any array is o(n) as well
binary search is proportional to log(n)
etc. etc.

another important thing to know is the fact that the majority of these algorithms are represented through monotonously-increasing functions, which is a very bad thing because it in fact shows that the efficiency drops when the number of items increases. i can't think of any algorithm whose graph is a monotonously-decreasing function, which would be just perfect. because of this limitation, an algorithm that runs in o(1) time is the best.

this is why hash tables are almost ideal when working with huge amounts of data. no mattar how many data items there are, insertion and searching take close to constant time, the perfect o(1)!


hmm yes i agree

Old Post Jan-10-2004 04:56  United States
Click Here to See the Profile for TrAnCe CoNtRoL Click here to Send TrAnCe CoNtRoL a Private Message Add TrAnCe CoNtRoL to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Photo_bot_2k1
Photo_bot_2k5 ;D



Registered: Jan 2002
Location: Berkeley,CA

nerds.


___________________

Old Post Jan-10-2004 10:35  United States
Click Here to See the Profile for Photo_bot_2k1 Click here to Send Photo_bot_2k1 a Private Message Add Photo_bot_2k1 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Perfect_Cheezit
Machine Beat



Registered: Jul 2003
Location: MNTA #08

tranceaddict > hw resource help

i wonder if, when i get to college, ill be asking for help in this forum

Old Post Jan-10-2004 10:57  United States
Click Here to See the Profile for Perfect_Cheezit Click here to Send Perfect_Cheezit a Private Message Add Perfect_Cheezit to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Psionic
Dark & Dirty



Registered: Apr 2003
Location: Boston, MA

quote:
Originally posted by Photo_bot_2k1
nerds.


Old Post Jan-10-2004 11:04  Israel
Click Here to See the Profile for Psionic Click here to Send Psionic a Private Message Add Psionic to your buddy list Report this Post Reply w/Quote Edit/Delete Message
ASOT100
Supreme tranceaddict



Registered: May 2003
Location:

quote:
Originally posted by Photo_bot_2k1
nerds.



someone's jealous

Old Post Jan-10-2004 11:53  United States
Click Here to See the Profile for ASOT100 Click here to Send ASOT100 a Private Message Add ASOT100 to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > Graphs & Hash Tables (re: programming)
Post New Thread    Post A Reply

Pages (2): [1] 2 »  
Last Thread   Next Thread
Click here to listen to the sample!Pause playbackHardfloor - Acperience (ID Remix). [2003] [1]

Click here to listen to the sample!Pause playbackFerry Corsten - "I Love You" [2004]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 19:43.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!