Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Tree's and the likes...

  • 12-04-2005 3:49am
    #1
    Registered Users, Registered Users 2 Posts: 4,276 ✭✭✭


    Howdy,

    Just reading up for an assignment. Basically we've been told to use a balanced tree. I want to find an alternative (Just to be different ;) )

    Well the tree has to take in a book's text and count the frequency of how often certain words appear next to each other.

    The only alternative I've been able to think up so far was 2 linked lists which cross paths, in effect making a hash map. But I don't think it would be very effienct. Since the text taken in will be so large I can't really risk having massive nodes so I guess a b-tree would be the best option. However that said my knowledge of data structures doesn't extend very far :)

    Can anyone offer me some tips / advice? I'm leaning towards a standard AVL Tree as currently seems the easiest to implement but I'm sure just about everyone else has had the same idea. Would like to learn something new…


Comments

  • Registered Users, Registered Users 2 Posts: 7,278 ✭✭✭kenmc


    if you were told to use a Balanced tree then you better do so....
    call it the requirements spec of the project.


  • Registered Users, Registered Users 2 Posts: 4,276 ✭✭✭damnyanks


    Nah its not a requirment :) Its a reccomendation. It's probably reccomended because from what I've seen its the best way to go about doing things... but then again I only really know what he's taught us :)


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 93,602 Mod ✭✭✭✭Capt'n Midnight


    You could use a B-tree and optimise every so often to get the branches roughly equal.

    If the book has N words then you could optimise the tree at Sqrt(N) words and again at Sqrt(Sqrt(N)) , some waffle about assuming that the word distribution in English won't differ a huge lot between a book / chapter / page / paragraph.

    If you want pain then you could use a pigeon sort too..


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    That SOUNDS like a compression algorithm is going to make an appearance. Stick with the tree, I'd say.


Advertisement