Re: time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Jonathan Worthington
Nicholas Clark wrote: My understanding is that this makes Perl 5 hash tables amortised O(1). Hopefully someone else will answer the Perl 6 side properly. My understanding is that the point of a hash table data structure was that lookups are amortised O(1). However, doing it right - and cert

Re: time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Nicholas Clark
On Sat, Aug 22, 2009 at 10:27:58PM +0100, Nicholas Clark wrote: > Perl 5's hash tables consist of an array of linked lists. The list elements > consist of a pointer to the next element, pointer to the value stored, and > pointer to a structure, usually shared, containing the key (length, octets, >

Re: time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Nicholas Clark
> On Sat, Aug 22, 2009 at 4:04 PM, Nicholas Clark wrote: > > > On Sat, Aug 22, 2009 at 04:01:13PM -0500, Forrest Sheng Bao wrote: > > > Does anyone know the time complexity of searching elements in hash tables > > in > > > Perl? Suppose the number of elements is n. > > > > > > I have no idea on h

Re: time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Buddha Buck
On Sat, Aug 22, 2009 at 5:07 PM, Forrest Sheng Bao wrote: > Oh, I mean both Perl 5 and Perl 6. I couldn't find proper list to ask this > question. So I asked in this list. I'm not sure perl6-language is the proper place to be asking about the time-complexity of hashes in Perl6, or at least, not th

Re: time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Forrest Sheng Bao
Oh, I mean both Perl 5 and Perl 6. I couldn't find proper list to ask this question. So I asked in this list. Cheers, Forrest Forrest Sheng Bao, BSEE, Graduate Student Dept. of Computer Science/Electrical Engineering, Texas Tech University http://narnia.cs.ttu.edu Sent from Lubbock, TX, United St

Re: time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Nicholas Clark
On Sat, Aug 22, 2009 at 04:01:13PM -0500, Forrest Sheng Bao wrote: > Does anyone know the time complexity of searching elements in hash tables in > Perl? Suppose the number of elements is n. > > I have no idea on how Perl automatically builds the hash function and the > table. If you can tell me h

time complexity of searching elements in hash tables in Perl

2009-08-22 Thread Forrest Sheng Bao
Does anyone know the time complexity of searching elements in hash tables in Perl? Suppose the number of elements is n. I have no idea on how Perl automatically builds the hash function and the table. If you can tell me how it works, that is also helpful. I can analyze the algorithm myself. Cheer