iAudiophile.net Forums
Go Back   iAudiophile.net Forums > Flash-Memory Players > Cowon S9 > S9 Games & Apps

Post New Thread  Reply
 
Thread Tools Display Modes
Old 07-29-2009, 10:36   #31
jselby
Senior Member
 
Join Date: Mar 2005
Posts: 255
Default

Quote:
Originally Posted by islington View Post
Yes that's it.
You mean building a binary tree? I will try that, this could greatly improve the speed if there isnt problems with flash that would slow it.
No, not a binary tree. Though that could help. The concept is similar, but the binary search algorithm is performed on a sorted array (you could keep your current data structure). You keep track of three indexes into the array - low, middle, high. It goes something like this:

pseudo-code
Code:
function bsearch(search_array, search_word, low_idx, high_idx)
   /* search_array = array to search
    * search_word = word to search for
    * low_idx = index at which to start searching within the search array
    * high_idx = index at which to stop searching within the search array
    * 
    * function returns the index where the word is found, or -1 if the word
    * is not found.
    */

    middle_idx = 0   /* this will be set to the index in the middle of low_idx and high_idx */

    loop while low_idx is <= high_idx
        middle_idx = floor(low_idx + ((high_idx-low_idx)/2))

        if search_word > word at middle_idx
            low_idx = middle_idx + 1
        else if search_word < word at middle_idx
            high_idx = middle_idx - 1
        else
            the word has been found, it is at middle_idx.  return middle_idx
    end loop

    word was not found.  return -1
end function
So if the word you are searching for is greater then the word at middle_idx, you can ignore the first half of the array (and vice versa). Then you repeat the process for the other half of the array.

wikipedia has a pretty good article on them - http://en.wikipedia.org/wiki/Binary_search
jselby is offline View jselby's Photo Album   Reply With Quote
Old 07-29-2009, 11:46   #32
islington
Member
 
Join Date: Jul 2009
Location: grenoble
Posts: 63
Default

Yes this is a better idea than searching in a tree, realy shorter to code and same efficacity. Why do they bother us with trees at school?
As you said, with this method, you would enventualy loose the return of the first matching word, but then you would just have to scroll less, would'nt you?
islington is offline View islington's Photo Album   Reply With Quote
Old 07-29-2009, 12:37   #33
jselby
Senior Member
 
Join Date: Mar 2005
Posts: 255
Default

Quote:
Originally Posted by islington View Post
Yes this is a better idea than searching in a tree, realy shorter to code and same efficacity. Why do they bother us with trees at school?
heh. There are benefits to binary trees over the search algorithm. With a very large number of array elements you could run into integer overflow problems, especially in the middle_idx calculation. A binary tree is typically constructed using references/pointers, so you're less likely to run in to this. Inserting elements into a tree is faster too, since you only have to deal with the branch you are inserting into (unless it's a balanced tree). Inserting an element into the middle of an array requires you to rebuild the array - copy elements that go before the new element, copy elements that go after the new element, then stick them all back together.

Quote:
Originally Posted by islington View Post
As you said, with this method, you would enventualy loose the return of the first matching word, but then you would just have to scroll less, would'nt you?
Right, the algorithm I listed assumes you will either get an exact match or no match. You could maybe add a condition to check the first 3 or 4 letters. If they match, store that index in a "near_match_idx" variable. Then if no exact match is found return a list of 20 or so words centered around "near_match_idx".

I'm out of ideas at the moment. Good luck!
jselby is offline View jselby's Photo Album   Reply With Quote
Old 07-29-2009, 13:35   #34
schorsch
Member
 
Join Date: May 2009
Posts: 160
Default

is it right that the ifo file is an DVD Movie info file?
http://img5.imagebanana.com/view/z75k9qn2/stardict.jpg
schorsch is offline View schorsch's Photo Album   Reply With Quote
Old 07-29-2009, 15:09   #35
schorsch
Member
 
Join Date: May 2009
Posts: 160
Default

yeah! i have now an english - finnish dictionary =P
not really nessecary and it is a bit laggy but funny. would it not be very cool if everyody who get a knew finished dictionary post it here and you write them on the first site?
schorsch is offline View schorsch's Photo Album   Reply With Quote
Old 07-30-2009, 03:13   #36
islington
Member
 
Join Date: Jul 2009
Location: grenoble
Posts: 63
Default

Quote:
Originally Posted by schorsch View Post
yeah! i have now an english - finnish dictionary =P
not really nessecary and it is a bit laggy but funny. would it not be very cool if everyody who get a knew finished dictionary post it here and you write them on the first site?
The first site is just for hosting little files, I couldn't add hunderd of Mb on it and there's not so much bandwidth.
But what you can do is uploading it on something like rapidshare and i'll make a list of the "compiled" dics on the first post

The ifo file is just a text file, tty to open it with notepad and you'll see. Don't know about dvd movie ifo file.

Quote:
Originally Posted by jselby
heh. There are benefits to binary trees over the search algorithm. With a very large number of array elements you could run into integer overflow problems, especially in the middle_idx calculation. A binary tree is typically constructed using references/pointers, so you're less likely to run in to this. Inserting elements into a tree is faster too, since you only have to deal with the branch you are inserting into (unless it's a balanced tree). Inserting an element into the middle of an array requires you to rebuild the array - copy elements that go before the new element, copy elements that go after the new element, then stick them all back together.
Ok, thanks for the info. Didn't knew that. Wasn't much listening either ....

I just implemented the binary search algorithm and it's about 40 to 100 times faster than the first one
Don't have my cable so i cant try it on the S9 now, but tell me how it feels now !
islington is offline View islington's Photo Album   Reply With Quote
Old 07-30-2009, 04:28   #37
schorsch
Member
 
Join Date: May 2009
Posts: 160
Default

which upload site is legal and is there a site without creating an account?
EDIT: I have a problem i can't find the builder.exe folder? is there somebody who has vista and can tell me where to find it?

Last edited by schorsch; 07-30-2009 at 04:31..
schorsch is offline View schorsch's Photo Album   Reply With Quote
Old 07-30-2009, 09:36   #38
jselby
Senior Member
 
Join Date: Mar 2005
Posts: 255
Default

Quote:
Originally Posted by islington View Post
Ok, thanks for the info. Didn't knew that. Wasn't much listening either ....
Well, there will be exceptions to what I've stated. Some languages have built-in methods for inserting, deleting, etc from arrays that are pretty fast. There are other benefits to b-trees, but I was flying on memory and my lunch break was almost over. We use Oracle as our database server at work. Internally, oracle uses b-trees for table indexes. So there are real-world uses for them.

Quote:
Originally Posted by islington View Post
I just implemented the binary search algorithm and it's about 40 to 100 times faster than the first one
Don't have my cable so i cant try it on the S9 now, but tell me how it feels now !
Nice! I'll have to check it out later.
jselby is offline View jselby's Photo Album   Reply With Quote
Old 07-30-2009, 13:23   #39
jselby
Senior Member
 
Join Date: Mar 2005
Posts: 255
Default

I'm having trouble decompressing builder.7z. 7-zip says 'can not open file builder.7z as archive'.
jselby is offline View jselby's Photo Album   Reply With Quote
Old 07-30-2009, 15:28   #40
schorsch
Member
 
Join Date: May 2009
Posts: 160
Default

http://rapidshare.com/files/26189302..._Dict.zip.html
the first dictionary in the list =) English - Finnish dictionary
downloadable just 10 times =(
but an start!
i hope we can add some more dict!?
ps: i search my created .sol files =P can you help me where to find it on an (german) vista pc?
schorsch is offline View schorsch's Photo Album   Reply With Quote
Old 07-30-2009, 16:32   #41
schorsch
Member
 
Join Date: May 2009
Posts: 160
Default

and the next : http://rapidshare.com/files/26191271..._Dict.zip.html
=) an german englisch dictionary. this is real fun =P
do you add a list on the first site? i think this could be a very cool thing!
schorsch is offline View schorsch's Photo Album   Reply With Quote
Thanks from:
Old 07-30-2009, 17:28   #42
bashibash
Kiss The Dog
 
bashibash's Avatar
 
Join Date: Feb 2009
Posts: 503
Default

somebody has a dutch one?
__________________
Cowon S9 = Mighty
bashibash is offline View bashibash's Photo Album   Reply With Quote
Old 07-31-2009, 04:45   #43
schorsch
Member
 
Join Date: May 2009
Posts: 160
Default

yes here an english dutsch one: http://rapidshare.com/files/26207297...utsch.zip.html
schorsch is offline View schorsch's Photo Album   Reply With Quote
Thanks from:
Old 07-31-2009, 05:17   #44
bashibash
Kiss The Dog
 
bashibash's Avatar
 
Join Date: Feb 2009
Posts: 503
Default

thank you schorsch but i can't find anything, i mean, whatever i type in, i get a message with - mot non trouvé -, why can't it be found?
__________________
Cowon S9 = Mighty
bashibash is offline View bashibash's Photo Album   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 23:23.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.


Copyright © 2006-2011 CrowdGather |  About iAudiophile |  Advertisers | Investors | Legal | Contact