Click here to Skip to main content
15,888,802 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to Save Picture(Image) Pin
Niklas L7-Jun-10 3:57
Niklas L7-Jun-10 3:57 
Questionhow to paint a bitmap to the dialog client dc from the memory dc Pin
Krauze5-Jun-10 14:54
Krauze5-Jun-10 14:54 
AnswerRe: how to paint a bitmap to the dialog client dc from the memory dc Pin
Niklas L6-Jun-10 11:15
Niklas L6-Jun-10 11:15 
QuestionHow to overlay Direct3d model in live webcam feed Pin
GreenGiant835-Jun-10 8:58
GreenGiant835-Jun-10 8:58 
QuestionHelp with hash tables in C Pin
arnluci5-Jun-10 6:48
arnluci5-Jun-10 6:48 
AnswerRe: Help with hash tables in C Pin
Luc Pattyn5-Jun-10 8:10
sitebuilderLuc Pattyn5-Jun-10 8:10 
GeneralRe: Help with hash tables in C Pin
arnluci5-Jun-10 11:09
arnluci5-Jun-10 11:09 
GeneralRe: Help with hash tables in C Pin
Luc Pattyn5-Jun-10 11:31
sitebuilderLuc Pattyn5-Jun-10 11:31 
Here is the way I imagine it could be done:
- for each item, calculate the hash value any way you see fit (but consistently of course);
- use the lowest N bits of the hash as the bucket number;
- have a bucket array with 2^N entries, each holding one pointer (initially null);
- represent each bucket as a linked list.

So to find an existing item, calculate hash, mask away all but N bits, get the list head from the bucket array, start scanning the list.

When the linked lists start to grow beyond some threshold, increase N and recreate the entire hash table.

I'm not saying that is how it is done, I'm not claiming that is the best way to do it either, but I have done such things myself in such way (long before libraries or .NET offered them). The easiest way to store words of text would be to use the first letter as a hash (not a good probability distribution, but extremely fast!).

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read formatted code with indentation, so please use PRE tags for code snippets.

I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).

GeneralRe: Help with hash tables in C Pin
Saurabh.Garg6-Jun-10 2:16
Saurabh.Garg6-Jun-10 2:16 
GeneralRe: Help with hash tables in C [modified] Pin
arnluci21-Jun-10 10:31
arnluci21-Jun-10 10:31 
Questionwhy does it use so many memory [modified][Solved] Pin
yu-jian5-Jun-10 5:25
yu-jian5-Jun-10 5:25 
AnswerRe: why does it use so many memory Pin
Aescleal5-Jun-10 6:17
Aescleal5-Jun-10 6:17 
GeneralRe: why does it use so many memory Pin
yu-jian6-Jun-10 3:10
yu-jian6-Jun-10 3:10 
GeneralRe: why does it use so many memory Pin
Aescleal6-Jun-10 7:18
Aescleal6-Jun-10 7:18 
AnswerRe: why does it use so many memory Pin
Hristo-Bojilov5-Jun-10 6:24
Hristo-Bojilov5-Jun-10 6:24 
QuestionRe: why does it use so many memory Pin
Randor 5-Jun-10 7:02
professional Randor 5-Jun-10 7:02 
QuestionRe: why does it use so many memory Pin
David Crow7-Jun-10 4:17
David Crow7-Jun-10 4:17 
QuestionHow to Save Image from WebBrowser control Pin
voo doo125-Jun-10 5:23
voo doo125-Jun-10 5:23 
AnswerRe: How to Save Image from WebBrowser control Pin
Hristo-Bojilov5-Jun-10 6:35
Hristo-Bojilov5-Jun-10 6:35 
GeneralRe: How to Save Image from WebBrowser control Pin
voo doo125-Jun-10 7:21
voo doo125-Jun-10 7:21 
GeneralRe: How to Save Image from WebBrowser control Pin
Hristo-Bojilov5-Jun-10 8:14
Hristo-Bojilov5-Jun-10 8:14 
GeneralRe: How to Save Image from WebBrowser control Pin
voo doo125-Jun-10 16:09
voo doo125-Jun-10 16:09 
GeneralRe: How to Save Image from WebBrowser control [modified] Pin
Hristo-Bojilov6-Jun-10 2:57
Hristo-Bojilov6-Jun-10 2:57 
GeneralRe: How to Save Image from WebBrowser control Pin
voo doo126-Jun-10 4:54
voo doo126-Jun-10 4:54 
GeneralRe: How to Save Image from WebBrowser control Pin
Hristo-Bojilov6-Jun-10 5:06
Hristo-Bojilov6-Jun-10 5:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.