在对数时间内找到未排序数组中的最小值 [英] Finding the minimum in an unsorted array in logarithmic time

查看:60
本文介绍了在对数时间内找到未排序数组中的最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种算法可以找到对数时间(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.

这篇关于在对数时间内找到未排序数组中的最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆