We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hello everybody my project is based on 8031 microcontroller and using keil development tools . i am storing some 1000 strings(each string has eight letters) on a atmel serial flash.all the strings will arrive to the system via rs232 serial communication.i am storing all the strings serially. but searching for a particular string is very very slow.can somebody tell me which sorting and searching is good and fast.also i have very less on chip RAM . so the sorting should be done outside the system and then downloaded via rs232. thanking you
Actually, if I were sorting externally, I'd just go for qsort() because it's already in the standard C libary. Why write your own sort function? No matter how simple to write, it can't be simpler than just using one that already exists. See this thread where David Lin has a very similar problem: http://www.keil.com/forum/docs/thread3350.asp http://www.wikipedia.org/wiki/Search_algorithm If you have a fixed table, sorted outside your system, then I'd second the recommendation for a binary search. It's easy to code, and simple. For reasonably small amounts of data (and small processors!), the complexity of the code matters as well as just the "big-O" asymptotic performance.