Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
unsorted_set::erase not O(1) when nearly empty
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
ShaunJ  
View profile   Translate to Translated (View Original)
 More options 6 Nov, 05:13
Newsgroups: comp.lang.c++.moderated
From: ShaunJ <sjack...@gmail.com>
Date: Thu, 5 Nov 2009 23:13:48 CST
Local: Fri 6 Nov 2009 05:13
Subject: unsorted_set::erase not O(1) when nearly empty
unsorted_set::erase should be O(1) complexity in time. It also returns
a pointer to the next element in the data structure. For most
implementations of a hashtable, this means iterating through all the
empty buckets looking for the next element. If the hashtable is empty,
this means checking every single bucket. If there's a large number of
buckets, this takes a really long time.

Of course this is implementation specific, but most implementations I
can think of would be affected by this.

Cheers,
Shaun

--
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Maxim Yegorushkin  
View profile   Translate to Translated (View Original)
 More options 8 Nov, 00:23
Newsgroups: comp.lang.c++.moderated
From: Maxim Yegorushkin <maxim.yegorush...@gmail.com>
Date: Sat, 7 Nov 2009 18:23:41 CST
Local: Sun 8 Nov 2009 00:23
Subject: Re: unsorted_set::erase not O(1) when nearly empty
On 06/11/09 05:13, ShaunJ wrote:

> unsorted_set::erase should be O(1) complexity in time. It also returns
> a pointer to the next element in the data structure. For most
> implementations of a hashtable, this means iterating through all the
> empty buckets looking for the next element. If the hashtable is empty,
> this means checking every single bucket. If there's a large number of
> buckets, this takes a really long time.

> Of course this is implementation specific, but most implementations I
> can think of would be affected by this.

There are interesting new (concurrent) implementations of hash tables
based on split-ordered lists. They store all elements in one long list,
so that iterating such a hash is the same as iterating a list. Google
for split-ordered list.

--
Max

      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google