We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
这段bubble sort代码是错误的,一个冒泡排序却操作了两个数组。
void sort_cpuid_by_max_freq(const std::vector<int>& max_freqs, std::vector<int>* cpu_ids, std::vector<int>* cluster_ids) { ... // sort cpuid as big core first // simple bubble sort for (int i = 0; i < cpu_num; i++) { for (int j = i + 1; j < cpu_num; j++) { if (max_freqs[i] < max_freqs[j]) { // swap int tmp = cpu_ids->at(i); cpu_ids->at(i) = cpu_ids->at(j); cpu_ids->at(j) = tmp; } } }
The text was updated successfully, but these errors were encountered:
您好,没明白您的意思,贴出的冒泡排序代码只针对 cpu_ids 数组进行了排序,没有操作两个数组。
Sorry, something went wrong.
列几个数据演算一下就明白了。代码调整了cpu_ids数组的元素顺序,但是比较大小确实参考另一个数组的值,但这个数组的元素位置没变动,因此参考的值实际上不匹配了。
好的,我明白您的意思了。 非常感谢您的指出~
您好,非常抱歉这么晚才合入您的PR。在这个PR中 #10518 ,我们采纳了您的代码解决了这个问题,合入develop分支后您就可以关闭这个issue了。再次感谢您对Paddle-Lite的关注与贡献!
您好,没明白您的意思,贴出的冒泡排序代码只针对 cpu_ids 数组进行了排序,没有操作两个数组。 列几个数据演算一下就明白了。代码调整了cpu_ids数组的元素顺序,但是比较大小确实参考另一个数组的值,但这个数组的元素位置没变动,因此参考的值实际上不匹配了。
shentanyue
No branches or pull requests
这段bubble sort代码是错误的,一个冒泡排序却操作了两个数组。
The text was updated successfully, but these errors were encountered: