[Coco] "C string searching question

Bill Pierce ooogalapasooo at aol.com
Tue Oct 2 04:19:18 EDT 2012


The files will be on whoever's computer they are on as this is a publicly available program, so no guarantee of any sort what-so-ever.
 
I'm probably going to use a 10 character search string as most things people would search for wouldn't have much more, though the titles can be up to 33 characters. So the search has to look through all 33 chars of 500 strings for a match of 10 chars at the most, but could be less according to what the user specifies in the search, so the size of the searcg string will be variable.
 
 All I want to do is search throuh a list of strings and find ONE occurance of the search string, this can be anywhere in the string being searched, not just at the beginning, then if that ocurrance is not the right one, it will be discarded and the next occurance will be searched. No catalogging is done and nothing is saved.
 
 One thing I've failed to mention... all the strings are in memory. There will be no disk activity, only memory reads. The file directory is read when the directory is chosen and the strings are initiated then. The user will search at any given time, for any given string. The directories can be changed at any time so no sort of sort, token or database can be created as the next time more songs may have been thrown into the directory since the last.. It has to be a realtime search.
 
To see what I'm trying to search, just download the Sound Chaser Beta from my links and intall the programs the the music dirs from the 2nd & 3rd disks (all music into one dir). Then run the program and you'll see what the list is.
Please read the docs before installing or running as there's a lot to this program thought it's pretty straight forward.
 
 
Bill P


Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Bill Pierce
ooogalapasooo at aol.com




-----Original Message-----
From: John Kent <jekent at optusnet.com.au>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Tue, Oct 2, 2012 3:35 am
Subject: Re: [Coco] "C string searching question



If the records are ordered alphabetically based on the record name and 
the search strings are sorted alphabetical you could do a sort of merge 
search.
i.e. Once you match the first string you can work from that point in 
each list to match the next string.
The near optimal sort is a Batcher sort although it's a trade off 
between speed and memory space.
You can do a recursive successive approximation sort, or an insertion 
sort if you are building the search list entry by entry.
You could use a linked list or double linked list, so you only have to 
move the pointers rather than the whole record.
There is a Sort and Merge package for Flex9 for the 6809.
Google for sorting and searching algorithms.

John.

On 2/10/2012 3:22 PM, Bill Pierce wrote:
> This is why I was doing byte by byte search... find fist char, then match 2nd, 
?no match? move to next char in string and start over. I had it working just 
doing first word search, then started editing the code to move through the 
string for any occurance and got it messed up. Now I can't seem to get it back 
to the working version... and by the way, it was pretty fast through almost 200 
songs. I didn't try any higher counts yet.
>
> Bill P
>
> Music from the Tandy/Radio Shack Color Computer 2 & 3
> https://sites.google.com/site/dabarnstudio/
> Bill Pierce
> ooogalapasooo at aol.com
>
>

-- 
http://www.johnkent.com.au
http://members.optusnet.com.au/jekent



--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco

 



More information about the Coco mailing list