Abstract
We show that the fundamental tasks of sorting lists and building search trees or heaps can be modeled as quadratic unconstrained binary optimization problems (QUBOs). The idea is to understand these tasks as permutation problems and to devise QUBOs whose solutions represent appropriate permutation matrices. We discuss how to construct such QUBOs and how to solve them using Hopfield nets or adiabatic quantum computing. In short, we show that neurocomputing methods or quantum computers can solve problems usually associated with abstract data structures.
Introduction
Traditionally, Quadratic Unconstrained Binary Optimization (QUBO) is reserved for NP-hard combinatorial problems like the Traveling Salesperson Problem or graph partitioning. Classical algorithms for sorting, such as Quicksort or Mergesort, are highly efficient with $O(n \log n)$ complexity, making them the standard for von Neumann architectures.
However, as computing shifts toward non-von Neumann architectures—specifically quantum annealers and neuromorphic chips—there is a growing need to perform basic data manipulation within an optimization framework. If future hardware is natively designed to minimize energy in QUBO-like systems, we must understand how to "program" these systems for foundational operations like sorting or organizing heaps. This research provides the mathematical framework to bridge that gap.
Methodology: Sorting as Optimization
The core approach frames sorting as a permutation problem. Given an unordered list $x$, the goal is to find a permutation matrix $P$ such that the resulting vector $y = Px$ is sorted.
1. The Rearrangement Inequality
The authors utilize the rearrangement inequality, which states that the inner product of two vectors is minimized when they are sorted in opposite orders. By defining a fixed "target" vector $n = [1, 2, \dots, n]^T$, sorting becomes an optimization objective: finding the permutation that minimizes the product between the input data and this target structure.
2. Vectorization and Constraints
To fit the QUBO format, the $n \times n$ permutation matrix is flattened into a vector of size $N = n^2$. Because a valid permutation matrix must have rows and columns that sum to exactly one, these constraints are incorporated into the objective function using Lagrange multipliers. This transforms a constrained linear problem into an unconstrained quadratic one, suitable for energy-minimization solvers.
3. Programmable Data Structures
A key insight is that abstract data structures like binary search trees and heaps are essentially specifically ordered lists. By serializing these structures (e.g., via breadth-first traversal) and setting the target vector $n$ accordingly, the same QUBO framework can build complex data structures.
Optimization and Results
The researchers tested their formulation using Hopfield Networks—recurrent neural networks that evolve toward stable, minimum-energy states. Using synthetic numerical sequences (e.g., $n=7$), they observed that the energy landscape for sorting is surprisingly well-behaved compared to NP-hard problems.
In experimental trials, the Hopfield networks consistently converged to the correct permutation in $O(n)$ steps. The versatility of the model was demonstrated by successfully constructing ascending sorted lists, binary search trees, and maximum heaps from the same input data by merely changing the target vector.
Discussion and Limitations
While this work proves that neurocomputing and quantum methods can handle abstract data structures, several challenges remain:
- Scalability: The current formulation requires $n^2$ binary variables to sort $n$ numbers. This quadratic growth is a significant overhead compared to classical $O(n \log n)$ algorithms.
- Parameter Sensitivity: Performance relies on the selection of Lagrange multipliers. While a simple heuristic ($\lambda = n$) was used here, more complex datasets may require fine-tuning.
- Hardware Implementation: These results are based on simulations. The next logical step is testing on physical hardware, such as D-Wave quantum annealers, to determine if there are tangible advantages in speed or energy efficiency over classical sorting methods.
By treating QUBOs as programmable machines, this research opens the door for emerging hardware to perform the foundational tasks of computer science.
Summary updated