In this article, i will try to explaing Lisch and Eisch database structure algorithms over an example program that i have prepared myself, in C programming language. As you know that both of these algorithms are used in some applications against collisions. There are many methods and algorithms that suits well with collisions and when 'coalesced' hashing is in game which means the new coming record goes at the bottom. As you have probably seen hundreds of same example (for now to confuse you that much); i will show that thing again. hash(key)=key mod 11 ( is the hashing function that we use as a function of table size )
By using the same logic, i am introducing a real life application which includes 50,000 records. That much record will be read from a file sequentially and will be written 6 different files which will be created in scope of lisch-eisch algorithms. Program starts creating LISCH-EISCH algorithm filtered files when it is executed and creates 6 different files by separating them with respect to packing factors. As you can imagine, these packing factors are obtained depending on the chosen table size in the corresponding files. Considering 50,000 records; .50. files uses 100003 record table size; hashing function will be hash(key)=key mod 100003 .75. files uses 66653 record table size; hashing function will be hash(key)=key mod 66653 .95. files uses 52631 record table size; hashing function will be hash(key)=key mod 52631 Records are read from file studentsSEQ.dat sequentially and written into the following files after their creation. In order to find the correct location of the records, fseek-fread-fwrite functions are used. studentsLISCH50.dat studentsLISCH75.dat studentsLISCH95.dat studentsEISCH50.dat studentsEISCH75.dat studentsEISCH95.dat (Format of the studentsSEQ.dat file is STUDENT-ID,NAME,SURNAME.) Regarding this Windows console application, outputs of the program are -time intervals of 6 file creations in millisecond -time interval of an arbitrary student match in sequential search -time interval of an arbitrary student match in direct access from the 6 file that has been created. |