Skip to main content

Element distinctness revisited


The element distinctness problem is the problem of determining whether the elements of a list are distinct, that is, if \(x=(x_1,\ldots ,x_N)\) is a list with N elements, we ask whether the elements of x are distinct or not. The solution in a classical computer requires N queries because it uses sorting to check whether there are equal elements. In the quantum case, it is possible to solve the problem in \(O(N^{2/3})\) queries. There is an extension which asks whether there are k colliding elements, known as element k-distinctness problem. This work obtains optimal values of two critical parameters of Ambainis’ seminal quantum algorithm (SIAM J Comput 37(1):210–239, 2007). The first critical parameter is the number of repetitions of the algorithm’s main block, which inverts the phase of the marked elements and calls a subroutine. The second parameter is the number of quantum walk steps interlaced by oracle queries. We show that, when the optimal values of the parameters are used, the algorithm’s success probability is \(1-O(N^{1/(k+1)})\), quickly approaching 1. The specification of the exact running time and success probability is important in practical applications of this algorithm.

This is a preview of subscription content, access via your institution.


  1. Yao, A.C.C.: Near-optimal time–space tradeoff for element distinctness. In: Proceedings of 29th Annual Symposium on Foundations of Computer Science, pp. 91–97 (1988)

  2. Grigoriev, D., Karpinski, M., Heide, F.M., Smolensky, R.: A lower bound for randomized algebraic decision trees. Comput. Complex. 6(4), 357–375 (1996)

    Article  MathSciNet  MATH  Google Scholar 

  3. Beame, P., Saks, M., Sun, X., Vee, E.: Time–space trade-off lower bounds for randomized computation of decision problems. J. ACM 50(2), 154–195 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  4. Aaronson, S., Shi, Y.: Quantum lower bounds for the collision and the element distinctness problems. J. ACM 51(4), 595–605 (2004)

    Article  MathSciNet  MATH  Google Scholar 

  5. Ambainis, A.: Polynomial degree and lower bounds in quantum complexity: collision and element distinctness with small range. Theory Comput. 1, 37–46 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  6. Buhrman, H., Dürr, C., Heiligman, M., Høyer, P., Magniez, F., Santha, M., de Wolf, R.: Quantum algorithms for element distinctness. SIAM J. Comput. 34(6), 1324–1330 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  7. Ambainis, A.: Quantum walk algorithm for element distinctness. In: FOCS’04: Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science, pp. 22–31, Washington, DC (2004)

  8. Ambainis, A.: Quantum walk algorithm for element distinctness. SIAM J. Comput. 37(1), 210–239 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  9. Szegedy, M.: Quantum speed-up of Markov chain based algorithms. In: Proceedings of the 45th Annual IEEE Symposium on Foundations of Computer Science, FOCS’04, pp. 32–41, Washington, DC (2004)

  10. Magniez, F., Santha, M., Szegedy, M.: Quantum algorithms for the triangle problem. SIAM J. Comput. 37(2), 413–424 (2007)

    Article  MathSciNet  MATH  Google Scholar 

  11. Childs, A.M., Eisenberg, J.M.: Quantum algorithms for subset finding. Quantum Inf. Comput. 5(7), 593–604 (2005)

    MATH  Google Scholar 

  12. Kutin, S.: Quantum lower bound for the collision problem with small range. Theory Comput. 1, 29–36 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  13. Brassard, G., Høyer, P., Tapp, A.: Quantum cryptanalysis of hash and claw-free functions. In: Proceedings of LATIN’98: Theoretical Informatics: Third Latin American Symposium, Campinas, pp. 163–169 (1998)

  14. Santha, M.: Quantum walk based search algorithms. In: Proceedings of Theory and Applications of Models of Computation: 5th International Conference, TAMC 2008, Xi’an, pp. 31–46 (2008)

  15. Childs, A.M.: On the relationship between continuous- and discrete-time quantum walk. Commun. Math. Phys. 294(2), 581–603 (2010)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  16. Farhi, E., Gutmann, S.: Quantum computation and decision trees. Phys. Rev. A 58, 915–928 (1998)

    Article  ADS  MathSciNet  Google Scholar 

  17. Belovs, A.: Learning-graph-based quantum algorithm for \(k\)-distinctness. In: Proceedings of 2012 IEEE 53rd Annual Symposium on Foundations of Computer Science, pp. 207–216 (2012)

  18. Belovs, A., Childs, A.M., Jeffery, S., Kothari, R., Magniez, F.: Time-efficient quantum walks for 3-distinctness. In: Proceedings of Automata, Languages, and Programming: 40th International Colloquium, ICALP 2013, Riga, pp. 105–122 (2013)

  19. Rosmanis, A.: Quantum adversary lower bound for element distinctness with small range. Chic. J. Theor. Comput. Sci. 4, 2014 (2014)

    MathSciNet  MATH  Google Scholar 

  20. Kaplan, M.: Quantum attacks against iterated block ciphers. Mat. Vopr. Kriptogr. 7, 71–90 (2016)

    Article  MathSciNet  Google Scholar 

  21. Jeffery, S., Magniez, F., de Wolf, R.: Optimal parallel quantum query algorithms. Algorithmica 79(2), 509–529 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  22. Portugal, R., Santos, R.A.M., Fernandes, T.D., Gonçalves, D.N.: The staggered quantum walk model. Quantum Inf. Process. 15(1), 85–101 (2016)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  23. Portugal, R.: Establishing the equivalence between Szegedy’s and coined quantum walks using the staggered model. Quantum Inf. Process. 15(4), 1387–1409 (2016)

    Article  ADS  MathSciNet  MATH  Google Scholar 

  24. Portugal, R.: Staggered quantum walks on graphs. Phys. Rev. A 93, 062335 (2016)

    Article  ADS  MathSciNet  Google Scholar 

  25. Abreu, A.S.: Tesselaç oes em grafos e suas aplicaç oes em computaç ao quântica. Master’s thesis, UFRJ (2017)

  26. Shenvi, N., Kempe, J., Whaley, K.B.: A quantum random walk search algorithm. Phys. Rev. A 67(5), 052307 (2003)

    Article  ADS  Google Scholar 

  27. Ambainis, A., Kempe, J., Rivosh, A.: Coins make quantum walks faster. In: Proceedings of Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA, pp. 1099–1108 (2005)

  28. Tulsi, A.: General framework for quantum search algorithms. Phys. Rev. A 86, 042331 (2012)

    Article  ADS  Google Scholar 

  29. Portugal, R.: Quantum Walks and Search Algorithms. Springer, New York (2013)

    Book  MATH  Google Scholar 

  30. West, D.B.: Introduction to Graph Theory. Prentice Hall, Upper Saddle River (2000)

    Google Scholar 

  31. Brandstädt, A., Le, V.B., Spinrad, J.P.: Graph Classes: A Survey. SIAM, Philadelphia (1999)

    Book  MATH  Google Scholar 

  32. Harary, F.: Graph Theory. Addison-Wesley, Boston (1969)

    Book  MATH  Google Scholar 

Download references


The author acknowledges financial support from CNPq (Grant No. 303406/2015-1) and thanks Raqueline Santos for useful comments.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Renato Portugal.



In this appendix, we define the graph theory terms used in this work [30,31,32] and the staggered quantum walk [22,23,24].

A simple and undirected graph (simply graph) \(\varGamma (V,E)\) is defined by a set \(V(\varGamma )\) of vertices or nodes and a set \(E(\varGamma )\) of edges so that each edge links two vertices and two vertices are linked by at most one edge. Two vertices linked by an edge are called adjacent. Two edges that share a common vertex are also called adjacent. A subgraph \(\varGamma '(V',E')\), where \(V'(\varGamma ')\subset V(\varGamma )\) and \(E'(\varGamma ')\subset E(\varGamma )\), is an induced subgraph of \(\varGamma (V,E)\) if it has exactly the edges that appear in \(\varGamma \) over the same vertex set. If two vertices are adjacent in \(\varGamma \), they are also adjacent in the induced subgraph. A bipartite graph is a graph whose vertex set V is the union of two disjoint sets X and \(X'\) so that no two vertices in X are adjacent and no two vertices in \(X'\) are adjacent. A clique is a subset of vertices of a graph such that its induced subgraph is complete. A maximal clique is a clique that cannot be extended by including one more adjacent vertex, that is, it is not contained in a larger clique. A clique of size d is called a d-clique. A clique can have one vertex. A partition of the vertex set into cliques is a collection of vertex–disjoint cliques, whose union is the vertex set. Some references in graph theory use the term “clique” as a synonym of maximal clique. We avoid this notation here. A clique graph \(K(\varGamma )\) of a graph \(\varGamma \) is a graph such that every vertex represents a maximal clique of \(\varGamma \) and two vertices of \(K(\varGamma )\) are adjacent if and only if the underlying maximal cliques in \(\varGamma \) share at least one vertex in common. A line graph (or derived graph or interchange graph) of a graph \(\varGamma \) (called root graph) is another graph \(L(\varGamma )\) so that each vertex of \(L(\varGamma )\) represents an edge of \(\varGamma \) and two vertices of \(L(\varGamma )\) are adjacent if and only if their corresponding edges share a common vertex in \(\varGamma \). A proper coloring or simply coloring of a loopless graph is a labeling of the vertices with colors such that no two vertices sharing the same edge have the same color. A n-colorable graph is the one whose vertices can be colored with at most n colors so that no two adjacent vertices share the same color. This concept can be used for edges and other graph structures.

A graph tessellation \({\mathcal {T}}\) is a partition of the vertex set into cliques, that is, there are disjoint cliques \(c_1, \ldots , c_{\left| {\mathcal {T}}\right| }\) such \(\cup _{\ell =1}^{\left| {\mathcal {T}}\right| } c_\ell =V(\varGamma )\), where \(\left| {\mathcal {T}}\right| \) is the tessellation size. An element \(c_\ell \) of the tessellation is called a polygon (or tile). An edge belongs to the tessellation \({\mathcal {T}}\) if and only if its endpoints belong to the same polygon in \({\mathcal {T}}\). The set of edges belonging to \({\mathcal {T}}\) is denoted by \({\mathcal {E}}({\mathcal {T}})\). A graph tessellation cover of size n is a set of n tessellations \({\mathcal {T}}_1,\ldots ,{\mathcal {T}}_n\), whose union is the edge set, that is, \(\cup _{j=1}^n\,{\mathcal {E}}({\mathcal {T}}_j)=E(\varGamma )\). A graph is called n-tessellable if there is a tessellation cover of size at most n. The tessellation cover number is the size of a smallest tessellation cover of \(\varGamma \). A graph \(\varGamma \) is 2-tessellable if and only if \(K(\varGamma )\) is 2-colorable [24]. The definition of graph tessellation cover was introduced by Portugal et al. [22].

In its simplest form, a staggered quantum walk on a graph \(\varGamma (V,E)\) with a graph tessellation cover \({\mathcal {C}}=\{{\mathcal {T}}_1,\ldots ,{\mathcal {T}}_n\}\) is a quantum walk driven by the unitary operator \(U_{\mathcal {C}}=U_n\cdots U_2\cdot U_1\), where \(U_j\) is associated with tessellation \({\mathcal {T}}_j\) and is defined by

$$\begin{aligned} U_j\,=\,2\sum _{\ell =1}^{\left| {\mathcal {T}}_j\right| } \left| c_\ell ^{(j)} \right\rangle \left\langle c_\ell ^{(j)} \right| - I, \end{aligned}$$


$$\begin{aligned} \left| c_\ell ^{(j)} \right\rangle \,=\, \frac{1}{\sqrt{\left| c_\ell ^{(j)}\right| }}\sum _{v\in c_\ell ^{(j)}}\left| v \right\rangle . \end{aligned}$$

The dimension of Hilbert space is |V|, and the computational basis is indexed by the vertices of \(\varGamma \).

Ambainis’ graph [8] is a bipartite graph with \({N\atopwithdelims ()r}+{N\atopwithdelims (){r+1}}\) vertices. The vertices of the first set are r-subsets of [N] and of the second set are \((r+1)\)-subsets. A vertex \(v_1\) in the first set is adjacent to a vertex \(v_2\) in the second set if and only if \(|v_1\cap v_2|=r\). The graph \(\varGamma \) defined in Sect. 2, on which the 2-tessellable staggered quantum walk takes place, is the line graph of Ambainis’ graph, which on the other hand is the clique graph of \(\varGamma \). \(K(\varGamma )\) is 2-colorable because Ambainis’ graph is bipartite.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Portugal, R. Element distinctness revisited. Quantum Inf Process 17, 163 (2018).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI:


  • Quantum Computing
  • Quantum algorithm
  • Collision problem
  • Quantum walk
  • Staggered quantum walk
  • Element distinctness