Skip Menu |

This queue is for tickets about the Algorithm-SkipList CPAN distribution.

Report information
The Basics
Id: 14557
Status: new
Priority: 0/
Queue: Algorithm-SkipList

People
Owner: Nobody in particular
Requestors: dwb7 [...] ccmr.cornell.edu
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.01
Fixed in: (no value)



Subject: duplicate keys and next_key broken
Hi. Using Algorithm-1.01 (and perlv5.6.1), it seems that next_key(), when using fingers and duplicate keys does not work as expected. With the finger, I would expect that the code would know where it is and be able to properly iterate through all the keys. This, however, is not the case. Using this snippet of perl: ($key, $finger, $value) = $proj_sl->first_key; print "$key : $value\n"; while ( defined($key)) { ($key, $finger, $value) = $proj_sl->next_key($key, $finger); print "$key : $value: @{$finger}\n"; } things work until the first duplicate, at which point, the code becomes stuck in an infinite loop: A58-3129-xxxx-xxx-xxx : 5836: Algorithm::SkipList::Node=ARRAY(0x8781ce8) A58-3137-xxxx-xxx-xxx : 5971: Algorithm::SkipList::Node=ARRAY(0x87a9400) A58-3197-xxxx-000-000 : 6092: Algorithm::SkipList::Node=ARRAY(0x87cb108) A58-3761-xxxx-xxx-xxx : 6067: Algorithm::SkipList::Node=ARRAY(0x87c3364) A58-3761-xxxx-xxx-xxx : 6065: Algorithm::SkipList::Node=ARRAY(0x87c31cc) A58-3761-xxxx-xxx-xxx : 6065: Algorithm::SkipList::Node=ARRAY(0x87c31cc) A58-3761-xxxx-xxx-xxx : 6065: Algorithm::SkipList::Node=ARRAY(0x87c31cc) A58-3761-xxxx-xxx-xxx : 6065: Algorithm::SkipList::Node=ARRAY(0x87c31cc) The "workaround" seems to be to use the "keys" method and then the find_duplicates method for each of these keys, but then one still has to separately parse each returned find_duplicates for > 1 entry and then skip the next number of keys returned (until a new key is returned). For example: A58-3103-xxxx-xxx-xxx : 5896 A58-3129-xxxx-xxx-xxx : 5836 A58-3137-xxxx-xxx-xxx : 5971 A58-3197-xxxx-000-000 : 6092 A58-3761-xxxx-xxx-xxx : 6067 6065 A58-3761-xxxx-xxx-xxx : 6067 6065 A58-4303-xxxx-xxx-xxx : 5898 A58-8307-xxxx-xxx-xxx : 6066 A58-8326-xxxx-xxx-xxx : 5840 A58-8330-xxxx-xxx-xxx : 5904 5903 A58-8330-xxxx-xxx-xxx : 5904 5903 A58-8351-xxxx-000-xxx : 5900 A58-8357-xxxx-xxx-xxx : 5893 is obtained from: @keys = $proj_sl->keys; foreach $key (@keys) { @values = $proj_sl->find_duplicates($key); print "$key : @values\n"; }