GIDForums  

Go Back   GIDForums > Computer Programming Forums > .NET Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 20-Apr-2008, 14:02
madsiro madsiro is offline
New Member
 
Join Date: Mar 2008
Posts: 3
madsiro is on a distinguished road

class Dictionary in c#


Hi, I'm programming in C #, and I have a question about the class dictionary, I know that this work as a hash table, but I would like to know how that hash function uses (or which is the one that could use), and that size is its table, here is an example of Dictionary, and here is my question.
C-SHARP / C# Code:
private static Dictionary<string, double> PrepareFrequency(string[] words)
{
    Dictionary<string, double> table = new Dictionary<string, double>();

    foreach (string word in words)
    {
        if (table.ContainsKey(word))
            table[word]++;
        else
            table.Add(word, 1);
    }

    return table;
} 
Thanks for your attention.
Last edited by LuciWiz : 21-Apr-2008 at 06:54. Reason: Please insert your C# code between [c#] & [/c#] tags
  #2  
Old 21-Apr-2008, 07:01
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 889
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough

Re: class Dictionary in c#


Quote:
Originally Posted by madsiro
[snip]and here is my question.

What is the question?
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #3  
Old 21-Apr-2008, 11:09
madsiro madsiro is offline
New Member
 
Join Date: Mar 2008
Posts: 3
madsiro is on a distinguished road

Re: class Dictionary in c#


Quote:
Originally Posted by LuciWiz
What is the question?
Thanks for your replay, my question is
What function dispersion could be using Dictionary?
  #4  
Old 23-Jun-2008, 01:40
Menol_LK's Avatar
Menol_LK Menol_LK is offline
Junior Member
 
Join Date: Sep 2006
Location: Sri Lanka
Posts: 29
Menol_LK is on a distinguished road

Re: class Dictionary in c#


Dictionary is an extended version of Hash Table when it comes to .Net.

there are differences between .net hash table and dictionary,

some of them are:

* dictionary maintains the order that you add items to it where as hash table (in .net) does not

* Hash table allows you to avoid providing a key when you add an item by using a null value as key but a dictionary will raise an exception if you don't provide a key.
* etc.

basically, what a hash function does is it derives a small number from a large amount of data in a way that you can use that number to uniquely identify that particular data. Or in other words, you can use that number as an index to search among data.

According to my knowledge, Hashing is a theory that comes under Database Management (Not with programming) so if you want to learn more about hash
functions you should dig in data base area rather than programming sites.

I suggest you to go and read following wiki page :

http://en.wikipedia.org/wiki/Hash_function

Menol
menol.blogspot.com
 
 

Recent GIDBlog2nd Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning a Struct to a separate class usmsci CPP / C++ Forum 9 07-Feb-2007 08:34
Hard drive/CPU Diagnoses Issues binarybug Computer Hardware Forum 1 22-Jan-2007 19:23
Box Class, need help again :( TransformedBG CPP / C++ Forum 7 13-Nov-2006 15:11
C++ class -- Please help vnca_1 CPP / C++ Forum 3 14-Jun-2006 12:31
a tester class and then some. postage Java Forum 1 06-May-2006 15:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:35.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.