Elsevier

Journal of Algorithms

Volume 7, Issue 4, December 1986, Pages 449-462
Journal of Algorithms

On the number of queries necessary to identify a permutation

https://doi.org/10.1016/0196-6774(86)90013-1Get rights and content

Abstract

Let p and q be two permutations over {1, 2,…, n}. We denote by m(p, q) the number of integers i, 1 ≤ in, such that p(i) = q(i). For each fixed permutation p, a query is a permutation q of the same size and the answer a(q) to this query is m(p, q). We investigate the problem of finding the minimum number of queries required to identify an unknown permutation p. A polynomial-time algorithm that identifies a permutation of size n by O(n · log2n) queries is presented. The lower bound of this problem is also considered. It is proved that the problem of determining the size of the search space created by a given set of queries and answers is #P-complete. Since this counting problem is essential for the analysis of the lower bound, a complete analysis of the lower bound appears infeasible. We conjecture, based on some preliminary analysis, that the lower bound is Ω(n · log2n).

References (11)

  • L.G Valiant

    The complexity of computing the permanent

    Theoret. Comput. Sci.

    (1979)
  • V Chvátal

    Mastermind

    Combinatorica

    (1983)
  • M.R Garey et al.

    Computers and Intractability: A Guide to the Theory of NP-Completeness

    (1979)
  • J Gyllenkog

    Writing a computer program to play Mastermind that appears to be intelligent

    SIGART News

    (1983)
  • D.E Knuth
There are more references available in the full text version of this article.

Cited by (16)

  • Query complexity of mastermind variants

    2018, Discrete Mathematics
    Citation Excerpt :

    In 1963 Erdős and Rényi [6] studied the two-color variant of this game, and after the release of Mastermind, Knuth showed that a minimax strategy guarantees guessing the hidden vector in no more than 5 turns [13]. Many authors have since studied algorithms to minimize the number of guesses required in the worst case [4,3,14,9,5,11,2,12,7,8], and almost all of these results will be introduced and discussed at relevant points in this paper. We note here that the work of Jäger and Peczarski [11,12] and Goddard [7,8] deal with finding explicit optimal bounds for small numbers of colors and pegs, whereas we deal with asymptotics when both of these quantities are large.

  • Strategy optimization for deductive games

    2007, European Journal of Operational Research
  • Finding a needle in a haystack using hints and evolutionary computation: The case of evolutionary MasterMind

    2006, Applied Soft Computing Journal
    Citation Excerpt :

    This result is consistent with Knuth's, but it is a clear improvement over it. Variants of the MasterMind game have also been researched by Flood [27] and Ko and Teng [28]. Other approaches have also been reviewed in one of our previous papers [29].

  • Optimal strategies for the static black-peg AB game with two and three pegs

    2023, Discrete Mathematics, Algorithms and Applications
View all citing articles on Scopus

This research was supported in part by the National Science Foundation Grant MCS-8103479A01.

View full text