Hash vs Trie

This is a discussion on Hash vs Trie within the C Programming forums, part of the General Programming Boards category; Hi, I'm trying to implement solution to following problem in C: I have a large text file (apprx 50KB) .Now ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    3

    Hash vs Trie

    Hi,


    I'm trying to implement solution to following problem in C:

    I have a large text file (apprx 50KB) .Now i want to print the words in descending order according to their frequncies in given file.

    Which data structure would be best?? Hash tables or tries..or any other suggestion...

    Thanks

    faxo

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    What is your definition of "best" ?
    - easiest to implement
    - quickest to run
    - smallest amount of memory
    - gains the most marks in my assignment

    I would suggest you try them both (and others), because working out what is "best" is most effectively found out through direct experience.

    http://www.nist.gov/dads/
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,304
    Either of those ideas should work well.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with unaligned intrinsics
    By The Wazaa in forum C++ Programming
    Replies: 4
    Last Post: 02-18-2009, 11:36 AM
  2. Bernstein hash?
    By audinue in forum C Programming
    Replies: 0
    Last Post: 01-07-2009, 06:24 AM
  3. Serializing/deserializing problem
    By vsla in forum C Programming
    Replies: 3
    Last Post: 04-21-2008, 03:55 PM
  4. Group Project Help/Volunteer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 04-24-2007, 11:36 PM
  5. Not sure on hash table memory allocations
    By Thumper333 in forum C Programming
    Replies: 3
    Last Post: 09-27-2004, 09:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21