查找最大整数数组中? [英] Find Maximum Integer in Array?

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

问题描述

我有两个数组,一个是非常大(超过万条)等数组是小(小于1000个条目),这将是最好的方法找到阵列的所有条目的最大数量?

I have two arrays, one is very large (more than million entries) and other array is small (less than 1000 entries), what would be the best approach to find maximum number out of all entries in arrays ?

感谢。

推荐答案

如果数组为无序,那么你必须做一个线性搜索查找每个最大值。如果阵列的的排序,然后简单地采取从每个数组的第一个或最后一个元素(根据排序顺序)。

If the arrays are unsorted then you must do a linear search to find the largest value in each. If the arrays are sorted then simply take the first or last element from each array (depending on the sort order).

这篇关于查找最大整数数组中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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