data structure for large no of words ??


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: data structure for large no of words ??

  1. #1
    mk Guest

    data structure for large no of words ??


    Hi,
    I originally posted this in one of the Java groups, but it was suggested
    that I also post it here:

    Hi,
    I want to store a large number of words (kind of like a mini dictionary ???)
    and want to be able to look up individual words(e.g find dog, cat) and also
    look for words that start with certain letters (words that start with do,
    ca etc)
    The simplest way (for me anyway) so far is to store all of the words in a
    big array, but this takes up a lot of space and I guess will have download
    implications ....
    I was also thinking of storing all the words in some sort of tree-like structure,
    with each letter being a node in the tree (to remove redundant info). However,
    having thought of this clever idea, I don't know how I could go about searching
    this "tree-like" thing for my desired words .....

    Any suggestions about how to store a large no of words in a space efficient
    way, but at the same time making it relatively easy to search for the required
    words ????

    Thansk for your help.

    mk


  2. #2
    Richard Dalton . Guest

    Re: data structure for large no of words ??




    Hi,

    I'm not clear as to whether you want to store all these
    words in memory, or in a file. I'm assuming you need
    to keep them in a file, but be able to search the file
    quickly and efficiently at runtime.

    Have you thought about using a Database. An Access DB
    would do the trick nicely. You could make a table called words,
    similar to the following:

    ID, Word, <any other fields, definitions etc.>

    This would allow you to search for specific words using
    or patterns such as ca* using the 'Like' keyword.

    If you don't want dublicate words you could forget about
    ID, and make Word the primary key.

    -Richard



    "mk" <emkae99@yahoo.com> wrote:
    >
    >Hi,
    >I originally posted this in one of the Java groups, but it was suggested
    >that I also post it here:
    >
    >Hi,
    >I want to store a large number of words (kind of like a mini dictionary

    ???)
    >and want to be able to look up individual words(e.g find dog, cat) and also
    >look for words that start with certain letters (words that start with do,
    >ca etc)
    >The simplest way (for me anyway) so far is to store all of the words in

    a
    >big array, but this takes up a lot of space and I guess will have download
    >implications ....
    >I was also thinking of storing all the words in some sort of tree-like structure,
    >with each letter being a node in the tree (to remove redundant info). However,
    >having thought of this clever idea, I don't know how I could go about searching
    >this "tree-like" thing for my desired words .....
    >
    >Any suggestions about how to store a large no of words in a space efficient
    >way, but at the same time making it relatively easy to search for the required
    >words ????
    >
    >Thansk for your help.
    >
    >mk
    >



  3. #3
    mk Guest

    Re: data structure for large no of words ??


    Thanks for your reply, but I wanted to keep it all in memory.

    "Richard Dalton" . wrote:
    >
    >
    >
    >Hi,
    >
    > I'm not clear as to whether you want to store all these
    > words in memory, or in a file. I'm assuming you need
    > to keep them in a file, but be able to search the file
    > quickly and efficiently at runtime.
    >
    > Have you thought about using a Database. An Access DB
    > would do the trick nicely. You could make a table called words,
    > similar to the following:
    >
    > ID, Word, <any other fields, definitions etc.>
    >
    > This would allow you to search for specific words using
    > or patterns such as ca* using the 'Like' keyword.
    >
    > If you don't want dublicate words you could forget about
    > ID, and make Word the primary key.
    >
    >-Richard
    >
    >
    >
    >"mk" <emkae99@yahoo.com> wrote:
    >>
    >>Hi,
    >>I originally posted this in one of the Java groups, but it was suggested
    >>that I also post it here:
    >>
    >>Hi,
    >>I want to store a large number of words (kind of like a mini dictionary

    >???)
    >>and want to be able to look up individual words(e.g find dog, cat) and

    also
    >>look for words that start with certain letters (words that start with do,
    >>ca etc)
    >>The simplest way (for me anyway) so far is to store all of the words in

    >a
    >>big array, but this takes up a lot of space and I guess will have download
    >>implications ....
    >>I was also thinking of storing all the words in some sort of tree-like

    structure,
    >>with each letter being a node in the tree (to remove redundant info). However,
    >>having thought of this clever idea, I don't know how I could go about searching
    >>this "tree-like" thing for my desired words .....
    >>
    >>Any suggestions about how to store a large no of words in a space efficient
    >>way, but at the same time making it relatively easy to search for the required
    >>words ????
    >>
    >>Thansk for your help.
    >>
    >>mk
    >>

    >



  4. #4
    Joe \Nuke Me Xemu\ Foster Guest

    Re: data structure for large no of words ??

    "mk" <emkae99@yahoo.com> wrote in message <news:3a6b73a8$1@news.devx.com>...

    > Hi,
    > I originally posted this in one of the Java groups, but it was suggested
    > that I also post it here:
    >
    > Hi,
    > I want to store a large number of words (kind of like a mini dictionary ???)
    > and want to be able to look up individual words(e.g find dog, cat) and also
    > look for words that start with certain letters (words that start with do,
    > ca etc)
    > The simplest way (for me anyway) so far is to store all of the words in a
    > big array, but this takes up a lot of space and I guess will have download
    > implications ....


    What download implications? Will this list be static, or will you be
    adding, changing, and removing entries all the time? A sorted array
    is compact and allows binary searching, which can be finessed to
    allow looking for ranges, unlike most hashing schemes. There ought
    to be red/black binary tree implementations out there, if you need
    to insert and delete things a lot.

    --
    Joe Foster <mailto:jfoster@ricochet.net> Got Thetans? <http://www.xenu.net/>
    WARNING: I cannot be held responsible for the above They're coming to
    because my cats have apparently learned to type. take me away, ha ha!



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center