Data/File Structure and Algorithm for Retrieving Sorted Data Chunk Efficiently

From: Jane Austine (janeaustine50_at_hotmail.com)
Date: 10/05/04


Date: 5 Oct 2004 03:12:24 -0700

Hello.

I have student_names and their scores, which are between 0..100.

I want to retrieve in the sorted order in terms of score, Nth
student's name to N+10th student's name along with their scores.
(suppose a web page showing top 10 students and there are "next page"
link and if you follow the link there shows next top 10 students with
"prev" and "next" page links.)

The list is dynamically resized -- elements are added or deleted. The
list could go fairly long enough that pulling all the data on memory
at once is not a good choice.

What algorithm and data/file structure are most efficient? (the
environment is "cgi" based web environment)

Simplest approach would be using btree from bsddb. But there are only
"first"/"last" and "next"/"prev" moves. If I have to retrieve 20..29th
students, I have got to "first" and then "next" 19 times before I
finally get to 20th student, which is a waste of time(and memory).
Maybe I could keep the cursor position among sessions if I were using
a standalone server. However, it is in CGI environment.

What can I do instead? What data structure allows you to access
nth..n+10th data from the sorted list in a constant time?

Jane



Relevant Pages

  • Re: Data/File Structure and Algorithm for Retrieving Sorted Data Chunk Efficiently
    ... > I want to retrieve in the sorted order in terms of score, ... > What algorithm and data/file structure are most efficient? ... > nth..n+10th data from the sorted list in a constant time? ... 10,000 students with 100 bytes for name and score comes ...
    (comp.lang.python)
  • Accessibility hardware for the blind
    ... FreeBSD 6.2) to a group of physically challenged students. ... speak the entire screen. ... spoken command line environment so I'm looking for a hardware solution ... interpreting WebMin and will not read the I/O from a terminal window ...
    (freebsd-questions)
  • Re: Data/File Structure and Algorithm for Retrieving Sorted Data Chunk Efficiently
    ... > I want to retrieve in the sorted order in terms of score, ... students before just doing the simplest thing (ignore performance ... network delays that are present, ... If you've got more than 1000 students, it _might_ be worth ...
    (comp.lang.python)
  • Re: Forged mail addresses
    ... stubborn software work with Vista. ... successfully implement a dual XP Vista environment. ... Shouldn't be a factor for students if it's done right. ...
    (rec.arts.anime.misc)
  • Re: New Singaporeans - Third Rate Citizens?
    ... Launching a new environment programme, Mr Wong says the young must be ... the Central Singapore District will start a new programme next year to ... The National Environment Agency says the programme will encourage students ... There are over 80 schools in the Central Singapore District. ...
    (soc.culture.singapore)