This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is there a good arithmetic to find a record from large numbers of records in EEPRom?

I have large numbers of records store in 24C256,4 bytes for 1 record. The record store
in EEPRom is in sequence,and I want to find a record matched data from them.
I now write a subfunction like following:
First,I read record 1 form EEPRom,verify it and find if it is match my data. If
match, return "1"(the record NO.);If no,I read record 2 ... and so on. If the last
record is reached and it is still not the record I wanted,The function will return
"0". Is this called Compare In Sequence Arithmetic?
Routine will be very slowly when the matched record is in the back of EEPRom.
The Dichotomy Arithmetic and Cut In Block Arithmetic cann't be use because of the
record stored in EEPRom is random.
Can you tell me a good arithmetic? Thank you.

Parents
  • David,

    If the data is placed in memory in an ascending or descending structure then you could use a bisection algorithm. This algorithm will find your result in log2n tests. However, if the data is not in any order then you will probably have to use a linear or hash based algorithm.

Reply
  • David,

    If the data is placed in memory in an ascending or descending structure then you could use a bisection algorithm. This algorithm will find your result in log2n tests. However, if the data is not in any order then you will probably have to use a linear or hash based algorithm.

Children
No data