Home >Backend Development >PHP Tutorial >Efficient sorting problem

Efficient sorting problem

WBOY
WBOYOriginal
2016-08-08 09:06:59819browse

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

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

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>

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

Statement:
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