Click here to Skip to main content
15,924,452 members
Home / Discussions / Algorithms
   

Algorithms

 
AnswerRe: Random Numbers: Is there anything really random? Pin
Frank Kerrigan2-May-07 5:58
Frank Kerrigan2-May-07 5:58 
QuestionProducer/Consumer Questions Pin
Leslie Sanford26-Apr-07 12:29
Leslie Sanford26-Apr-07 12:29 
AnswerRe: Producer/Consumer Questions Pin
Luc Pattyn26-Apr-07 13:50
sitebuilderLuc Pattyn26-Apr-07 13:50 
GeneralRe: Producer/Consumer Questions Pin
Leslie Sanford29-Apr-07 17:09
Leslie Sanford29-Apr-07 17:09 
QuestionLinked lists vs. Arrays Pin
Leslie Sanford25-Apr-07 9:44
Leslie Sanford25-Apr-07 9:44 
AnswerRe: Linked lists vs. Arrays Pin
Luc Pattyn25-Apr-07 14:55
sitebuilderLuc Pattyn25-Apr-07 14:55 
AnswerRe: Linked lists vs. Arrays Pin
Shog925-Apr-07 14:57
sitebuilderShog925-Apr-07 14:57 
GeneralRe: Linked lists vs. Arrays Pin
Leslie Sanford25-Apr-07 15:04
Leslie Sanford25-Apr-07 15:04 
Shog9 wrote:
Hashtable. Of course, it has its own disadvantages.


I was thinking hashtable in conjunction with a linked list might come close to giving the best of both worlds. If you need in order traversal, you iterate through the linked list. If you need to remove an item, you look it up in the hashtable first (the items serve as keys while the linked list nodes are the values for each entry into the hashtable), get the linked list node, and remove it from the list. This saves having to traverse the list to find the node that needs to be removed.

This has the problem of duplicating the list in the hashtable, which may not be reasonable if the list is large and memory use is a concern. But more importantly for me is that I can't think how the hashtable/linked list combo gives you O(1) index access as an array does. In fact, I can't think of how to access the items in the hashtable by index at all.
GeneralRe: Linked lists vs. Arrays Pin
Shog925-Apr-07 15:24
sitebuilderShog925-Apr-07 15:24 
GeneralRe: Linked lists vs. Arrays Pin
Leslie Sanford25-Apr-07 15:38
Leslie Sanford25-Apr-07 15:38 
GeneralRe: Linked lists vs. Arrays Pin
Shog925-Apr-07 16:15
sitebuilderShog925-Apr-07 16:15 
GeneralRe: Linked lists vs. Arrays Pin
cp987625-Apr-07 15:42
cp987625-Apr-07 15:42 
GeneralRe: Linked lists vs. Arrays Pin
Chris-Kaiser26-Apr-07 7:16
Chris-Kaiser26-Apr-07 7:16 
GeneralHybrid List source Pin
Chris-Kaiser26-Apr-07 7:24
Chris-Kaiser26-Apr-07 7:24 
GeneralRe: Hybrid List source Pin
Leslie Sanford26-Apr-07 12:35
Leslie Sanford26-Apr-07 12:35 
GeneralRe: Hybrid List source Pin
Chris-Kaiser27-Apr-07 11:51
Chris-Kaiser27-Apr-07 11:51 
GeneralRe: Linked lists vs. Arrays Pin
Stephen Hewitt26-Apr-07 14:02
Stephen Hewitt26-Apr-07 14:02 
AnswerRe: Linked lists vs. Arrays Pin
Stephen Hewitt25-Apr-07 18:02
Stephen Hewitt25-Apr-07 18:02 
QuestionLine intersection Pin
abalbo24-Apr-07 4:38
abalbo24-Apr-07 4:38 
AnswerRe: Line intersection Pin
Arun.Immanuel24-Apr-07 4:56
Arun.Immanuel24-Apr-07 4:56 
QuestionThreshholding ? Pin
Ray Kinsella24-Apr-07 3:19
Ray Kinsella24-Apr-07 3:19 
AnswerRe: Threshholding ? Pin
David Crow24-Apr-07 3:39
David Crow24-Apr-07 3:39 
QuestionLoop Pin
MoustafaS21-Apr-07 9:21
MoustafaS21-Apr-07 9:21 
GeneralRe: Loop Pin
MoustafaS21-Apr-07 10:27
MoustafaS21-Apr-07 10:27 
AnswerRe: Loop Pin
Frank Kerrigan2-May-07 5:45
Frank Kerrigan2-May-07 5:45 

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.