home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!rz.uni-karlsruhe.de!stepsun.uni-kl.de!uklirb!posthorn!vier!neuhaus
- From: neuhaus@vier.informatik.uni-kl.de (Stephan Neuhaus (HiWi Mattern))
- Subject: Re: Balanced Trees (Re: Why Are Red-Black Trees Obscure?)
- Message-ID: <neuhaus.715007061@vier>
- Sender: news@posthorn.informatik.uni-kl.de (News system account)
- Nntp-Posting-Host: vier.informatik.uni-kl.de
- Organization: University of Kaiserslautern, Germany
- References: <1992Aug26.183817.7371@reed.edu> <1992Aug27.115551.7958@daimi.aau.dk> <PSU.92Aug27104235@ptero.cs.duke.edu> <1992Aug27.215924.24525@reed.edu>
- Date: Fri, 28 Aug 1992 13:04:21 GMT
- Lines: 41
-
- orpheus@reed.edu (P. Hawthorne) writes:
-
- > Has anyone used frequency of node access data to bias the tree balancing
- >rotation operations toward shorter paths?
-
- Not quite, but I have used self-organizing linear lists in a program
- that spent almost 90% of its time doing lookups, with startling
- results.
-
- The main data structure was a trie, with the brethren linked together
- in a linked list. The linked lists were about 20--30 elements long,
- and the trie was 8--10 levels deep. I have tried both common forms of
- self-organizing lists in my program, with roughly the same speedup
- compared to unorganized or sorted lists:
-
- 1. When an element is successfully found in the list, move it to the
- front of the list so that it may be found faster in subsequent
- searches.
-
- 2. When an element is successfully found in the list, exchange it
- with its predecessor.
-
- The probability distribution for my keys was such that I rarely needed
- more than one pointer traversal per list to find the proper element.
- With sorted lists, the situation became more complex and hard to
- analyze, since the relative ordering of a particular item in a list
- was not connected to its frequency in retrievals. Anyway, I managed
- to get a speedup by a factor of 15 (roughly) for shallow tries.
-
- Observation: The longer the lists, the more speedup was obtained.
- This is quite natural when you think about it for a minute.
-
- The probability distribution of my keys was roughly exponential, i.e.,
- in a list sorted by frequency of access, item i+1 was p% less likely
- to appear in a retrieval operation than item i, where p is independent
- of i.
-
- Have fun.
- --
- Stephan <neuhaus@informatik.uni-kl.de>
- sig closed for inventory. Please leave your pickaxe outside.
-