Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

(Double) Linked Lists

Name: Anonymous 2008-04-27 16:01

I've been trying to write a little forum application that scales to million of threads in a category and million posts in a thread. The idea is that viewing a category or thread on any page will only take n+const key lookups in a database (like berkeleydb) where n is the number of items (threads or posts) on the page.

Implementing threads and posts as double linked lists makes it really easy to view the oldest and newest items (and adding new items) but obviously pagination doesn't work at all and also deletion is going to be a bitch because you have to "find" the item first.

I've been thinking about adding "shortcuts" to every 10th, 100th, 1000th, etc item to the next 10th, 100th, 1000th, etc item, but then deleting becomes very very expensive because you possibly have to update thousands of shortcuts. Is there a solution that doesn't suffer from having one really bad operation (or requires in-memory indices)? Or maybe a n+log(items)+const solution...

This is just a thought experiment about data structures but it has been driving me kinda nuts lately :p

Name: Anonymous 2008-04-30 23:29

>>40
Hash tables have O(n) worst case performance too, but you can't rearrange them to fix it.

Name: Anonymous 2008-04-30 23:58

>>41
O(n) until they're saturated.

>>40
binary trees have O(n) worst case performance
Did you mean O(log n)?

Name: Anonymous 2008-05-01 1:25

>>42
Did you mean O(log n)?
Worst case: A degenerate tree, which is essentially a linked list, which is O(n)

Name: Anonymous 2008-05-01 2:10

>>43
Such a thing wouldn't happen if you rebalance the tree when modifying it.

Name: Anonymous 2008-05-01 23:00

>>45

You can't rebalance a B-tree. But you could rebalance a hash table.

Name: Anonymous 2008-05-01 23:32

>>45
You can rebalance a B-tree, but you cannot tune a fish.

Name: Anonymous 2008-05-01 23:55

>>45
Your post has severe internal inconsistencies. Please fsck before mounting.

Name: Anonymous 2008-05-02 0:42

FSCK MY ANUS

Name: HAX MY ANUS MEME FAN 2008-05-02 0:55

>>48
I do not endorse this.

Name: Anonymous 2008-05-02 1:16

>>48
But you can't tune a fish sandwich.

Name: Anonymous 2008-05-02 1:31

>>50
But you can sandwich a fish tune.

Name: Anonymous 2008-05-02 2:39

ITT, kids who don't understand the practicalities of implementing this. And who don't understand what a modified preorder tree traversal is, or why its the best solution.

Name: Anonymous 2008-05-03 0:50

>>52
fag

Name: Anonymous 2010-11-27 17:08

Name: Anonymous 2010-12-21 7:22

Name: Sgt.Kabukiman䖉 2012-05-22 23:32

All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy
 All work and no play makes Jack a dull boy

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List