Click here to Skip to main content
15,902,634 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Running Visual C++ 6.0 and .Net Pin
Anonymous13-Jul-02 13:53
Anonymous13-Jul-02 13:53 
Questionhow can i make a transparent dialog in win98 Pin
ttzzgg_8071312-Jul-02 2:31
ttzzgg_8071312-Jul-02 2:31 
AnswerRe: how can i make a transparent dialog in win98 Pin
benjymous12-Jul-02 2:44
benjymous12-Jul-02 2:44 
Questiondictionary, bag ..., what is that? Pin
includeh1012-Jul-02 2:12
includeh1012-Jul-02 2:12 
AnswerRe: dictionary, bag ..., what is that? Pin
Chris Losinger12-Jul-02 3:18
professionalChris Losinger12-Jul-02 3:18 
GeneralRe: dictionary, bag ..., what is that? Pin
includeh1012-Jul-02 3:24
includeh1012-Jul-02 3:24 
GeneralRe: dictionary, bag ..., what is that? Pin
Chris Losinger12-Jul-02 3:26
professionalChris Losinger12-Jul-02 3:26 
AnswerRe: dictionary, bag ..., what is that? Pin
Alexandru Savescu12-Jul-02 6:40
Alexandru Savescu12-Jul-02 6:40 
In STL a dictionary is implemented as a map (maps keys and values) and is a binary tree (a red-black tree under the VC implementation). Thus the tree is kept always sorted by its key, so we have logarithimc insertion and look up time.
A map cannot have duplicate keys. However if you want to use duplicate keys you can used multimap (also part of STL).

Another implemntation is to use a hash_map or hash_multimap (not part of the STL library but most of the STL implementations offer them - VC offers it in VC.NET).

A hash works like this:
you provide a hash function that "hashes" the key and thus you have a hashvalue. your hash_map has a vector of lists. The size of the vector may depend on a given hash size. When you want to insert your object, you hash the key, and with the obtained hashed value you insert the object in the in the list indexed at the hash value (i.e if your hashed value is 5 then you insert your element at the tail of the 5th list).
When you want to lookup an object, given the key, you hash the key and then you perform linear search at the list of the index of the hashed value to find your object

If the hash size is big enough you will have lists with only one element then the insertion and lookup time will be O(1), provided that your hash function is fast enough. (it was O (log(n) for a map). However if your hash size is too small (or you have too many elements in the dictionary) then your lists will be very big so inserting and looking up can be slow. That's why people use map and hash_map also.

Best regards,
Alexandru Savescu
GeneralCOleDispatchDriver Pin
AJ12312-Jul-02 1:09
AJ12312-Jul-02 1:09 
GeneralRe: COleDispatchDriver Pin
AJ12312-Jul-02 5:47
AJ12312-Jul-02 5:47 
GeneralProblems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 0:46
Alexandru Savescu12-Jul-02 0:46 
GeneralRe: Problems iterating through a std::map Pin
Christian Graus12-Jul-02 1:06
protectorChristian Graus12-Jul-02 1:06 
GeneralRe: Problems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 1:14
Alexandru Savescu12-Jul-02 1:14 
GeneralRe: Problems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 4:02
Alexandru Savescu12-Jul-02 4:02 
GeneralRe: Problems iterating through a std::map Pin
Christian Graus12-Jul-02 13:01
protectorChristian Graus12-Jul-02 13:01 
GeneralRe: Problems iterating through a std::map Pin
Alexandru Savescu12-Jul-02 5:31
Alexandru Savescu12-Jul-02 5:31 
Generallibrary for printing pdf's Pin
Bernhard12-Jul-02 0:30
Bernhard12-Jul-02 0:30 
GeneralRe: library for printing pdf's Pin
Roger Allen12-Jul-02 1:53
Roger Allen12-Jul-02 1:53 
GeneralRe: library for printing pdf's Pin
Bernhard14-Jul-02 19:21
Bernhard14-Jul-02 19:21 
GeneralProgram icon when minimized app Pin
ViolaCase11-Jul-02 23:20
ViolaCase11-Jul-02 23:20 
GeneralRe: Program icon when minimized app Pin
Nish Nishant12-Jul-02 1:11
sitebuilderNish Nishant12-Jul-02 1:11 
GeneralRe: Program icon when minimized app Pin
Rage12-Jul-02 1:24
professionalRage12-Jul-02 1:24 
GeneralRe: Program icon when minimized app Pin
ViolaCase12-Jul-02 4:15
ViolaCase12-Jul-02 4:15 
GeneralRe: Program icon when minimized app Pin
Nish Nishant12-Jul-02 5:29
sitebuilderNish Nishant12-Jul-02 5:29 
GeneralRe: Program icon when minimized app Pin
Rage12-Jul-02 1:57
professionalRage12-Jul-02 1:57 

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.