Thread: hash tables

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #15
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by bithub View Post
    For a good balanced binary tree implementation (If you want to go this route), I suggest using a Red-Black tree. This is the same tree implementation used by gcc to implement std::map.
    While it's true that any tree with constant branching factor can perform insertion/lookup in O(n log n) (EDIT: Oops, meant O(log n) ) there is still a constant factor hiding there which isn't really negligible in practice. For evenly distributed sparse sets of integers it can be better to use a tree of higher branching factor, i.e. radix tree or some other.

    EDIT: Eh, radix tree wasn't exactly what I meant. My point is a tree can be a good alternative to a hash but it doesn't necessarily have to be a binary tree.
    Last edited by brewbuck; 06-30-2009 at 10:50 AM.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Iterable hash tables
    By OnionKnight in forum Tech Board
    Replies: 5
    Last Post: 07-21-2008, 02:02 AM
  2. developing hash tables in the C Programming language
    By w108dab in forum C Programming
    Replies: 1
    Last Post: 05-20-2008, 11:20 AM
  3. need help with hash tables with direct chaining
    By agentsmith in forum C Programming
    Replies: 4
    Last Post: 01-05-2008, 04:19 AM
  4. Group Project Help/Volunteer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2007, 11:36 PM
  5. Problems with Hash Tables
    By Zildjian in forum C Programming
    Replies: 6
    Last Post: 11-06-2003, 08:53 PM