A QUICK REPLACING ALGORITHM FOR FINDING ALL CANDIDATE KEYS OF A RELATION SCHEME

In this paper, the common shortcoming of the replacing algorithms forfinding all candidate keys of a relation scheme proposed in literature is found out byanalyzing in detail, namely, the succeed candidate keys are so few that it needs toomany passes of search for finding all candidate keys of a relation scheme. In orderto improve the replacing algorlthm for finding all candidate keys of a relationscheme, the basic ameliorative thinking is proposed, it is that the number of FDchecked in each pass of search should be cut down and the succeed candidate keys ineach pass of search should be increased. In a relation scheme R (U, F), if F is aminimum cover, it must be the set of functional dependency which has the mini-mum cardinality. So, in this paper, all sets of functional dependency are minimumcovers. Besides this, in each pass of search, EF (X) is ehecked. Therefore, thenumber of FD checked in each pass of search must be cut down and the succeedcandidate keys in each pass must be increased. Then, a quick replacing algorithmfor finding all candidate keys of a relation scheme is proposed on above-mentionedameliorative thinking, and, the correctness of the algorithm is proved, the averageand worst-case time complexities of the algorithm are analyzed.