Home > Backend Development > PHP Tutorial > Efficient sorting problem

Efficient sorting problem

WBOY
Release: 2016-08-08 09:06:59
Original
844 people have browsed it

<code>$a=[1,2,3];
$b=[11,13,15];

排序结果:
1,11
1,13
1,15
2,11
2,13
2,15
3....
</code>
Copy after login
Copy after login

Seeking ideas

Reply content:

<code>$a=[1,2,3];
$b=[11,13,15];

排序结果:
1,11
1,13
1,15
2,11
2,13
2,15
3....
</code>
Copy after login
Copy after login

Seeking ideas

Sort the two lists separately, then use the high-priority list as the first-level loop, the low-priority list as the second-level loop, and do the Cartesian product of the two lists

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template