在对数时间内找到未排序数组中的最小值

编程入门 行业动态 更新时间:2024-10-24 20:16:37
本文介绍了在对数时间内找到未排序数组中的最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

是否有一种算法可以找到对数时间(O(logn))中未排序数组的最小值?还是只能在线性时间内进行?我不想平行.

Is there an algorithmic approach to find the minimum of an unsorted array in logarithmic time ( O(logn) )? Or is it only possible in linear time? I don't want to go parallel.

谢谢

迈克尔

推荐答案

如果列表未排序,则搜索必须至少是线性的.您必须至少查看每个项目一次,因为您没有看过的任何东西都可能比您已经看过的东西少.

If the list is unsorted, your search has to be at least linear. You must look at each item at least once, because anything you haven't looked at might be less than what you've already seen.

更多推荐

在对数时间内找到未排序数组中的最小值

本文发布于:2023-11-30 12:13:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649902.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:序数   对数   时间内   组中   最小值

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!