Summary of algorithm for intersection of inverted permutation table

Source: Internet
Author: User

Http://bbs.sjtu.edu.cn/bbstcon,board,Algorithm,reid,1225812893.html

I summed it up as follows: 1.1 SvS and swapping Svsalgorithm 1 pseudo-code for Svssvs (set, K) 1:sort the sets by size (|set[0]|≤|set[1] | ≤... ≤|set[k]|). 2:let the smallest set s[0] is the candidate answer set.3:for each set s[i], I = 1. . . K do initialize _[k] = 0.4:for Each set s[i], I = 1. . . K Do5:for each element e in the candidate answer set Do6:search for E in s[i] in the range l[i] to |s[i]|,7:and Update L[i] to the last position probed in the previous Step.8:if E is not found Then9:remove e from candidate Answer Set,10:and Advance E to the next element in the answer Set.11:end If12:end for13:end for this is a common algorithm, it is first Find the shortest two sets, and then find out whether the elements in the first collection appear inside the second set; the Swapping_svs considered by demaine is slightly different from the above algorithm, that is, after each comparison, take a collection containing fewer elements to compare with the next set. This algorithm works better when the second collection compares the first set to the second set, but the experiment shows that this is a rare occurrence.  1.2 Small adaptivealgorithm 2 pseudo-code for small_adaptivesmall_adaptive (set, K) 1:while no set is empty Do2:sort the Sets by increasing number of remaining Elements.3:pick an ElimInator e = set[0][0] from the smallest set.4:elimset←1.5:repeat6:search for E in set[elimset].7:incremen T Elimset;8:until s = k or E is not found in set[elimset]9:if s = k Then10:add e to Answer.11:end if12:end While this is a hybrid algorithm that combines the advantages of SVS and adaptive. It is characterized by sorting each set by the number of elements that have not been inspected, by comparing the minimum number of elements that have not been inspected and the lesser of the collection, to find one element of the public, and then to find it in other collections, and to end up with a collection that has been searched. 1.3 Sequential and Random sequentialalgorithm 3 pseudo-code for sequentialsequential (set, K) 1:choose an eliminator e = SE  T[0][0], in the set Elimset←0.2:consider the first set, I←1.3:while the Eliminator e _=∞do4:search in Set[i] for E5:if the search found e then6:increase the occurrence counter.7:if the value of occurrence counter is K-then Output e End If8:end If9:if The value of the occurrence counter is k, or e were not found then/* if counted to K or E not found */10     : Update the Eliminator to E←SET[I][SUCC (e)]. /* Assigns the E value to the next value in the collection now */11:end If12:consider the next set in cyclic order i←i + 1 mod k.     /* Loop shift to select a new collection */13:end Whilebarbay and Kenyon introduced, for the uncertainty of the complexity of the sample lookup is better, each time in the collection of the lookup is used to quickly find. The difference between rsequential and sequential is that sequential selects the next set in the loop as the next search set, and rsequential randomly picks a collection. 1.4 Baeza-yates and Baeza-yates Sorted algorithm 4 pseudo-code for Baezayatesbaezayates (set, K) 1:sort the sets by size (| set[0]| ≤|set[1]| ≤... ≤|set[k]|). 2:let the smallest set set[0] is the candidate answer set.3:for each set set[i], I = 1. . . K Do4:candidate←byintersect (Candidate, Set[i], 0, |candidate|? 1, 0,|set[i]|? 1) 5:sort the candidate Set.6:end Forbyintersect (SetA, Setb, MinA, MaxA, Minb, MAXB) 1:if SetA or Setb is empty then return endif.2:let m = (MinA + MaxA )/2 and let Mediana is the element at Seta[m].3:search for Mediana in Setb.4:if Mediana is found Then5:add Mediana t  o result.6:end if7:let r be the insertion rank of Mediana in Setb.8:solve the intersection recursively on both sides of R and M in each set. Baeza-yates (Baizain-Yates, who has a well-known book "Modern Information Retrieval") proposed the method, mainly by using the idea of division and treatment, take out the short set of intermediate elements, in a longer setIn the search for this element, the shorter and longer sets are divided into 2 parts, which are then recursively searched in each of the 2 sections. Note: In this way, each time you search for 2 sets, the intersection of the output is unordered, so you need to reorder the intersection and then compare the search to the 3rd collection. Baeza-yates Sorted is an improvement of the above method, that is, when saving the public elements are ordered to save, the entire intermediate element must be saved to ensure that the first half of the search to the middle element has been saved, so that processing can save the last time the intersection of the search to sort again, But at the expense of intermediate processing, there is a need to increase the processing details. 1.5 summarizes all of the above algorithms have linear time complexity in the worst case scenario. Baezayates, So_baezayates, small_adaptive, and SVS have significant advantages over the size of the collection, and Small_adaptive is the only one by one that has a greater advantage when the algorithm removes elements in the set that cause the size of the set to change dynamically. ; sequential and rsequential are not sensitive to collection size.

Summary of algorithm for intersection of permutation tables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.