计算最小值和最大值 [英] calculating min and max

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

问题描述

我只想知道在一些随机数之间找到最小值和最大值的逻辑,例如

1 2 3 4 5 6或43 7 98 0 89任何想法?PLS!

i just wanna know the logic to find minimum and maximum between some random numbers such as
1 2 3 4 5 6 or 43 7 98 0 89 any ideas?PLS!

推荐答案

暂时忘掉代码。尝试用简单的英语算法,让你找到一堆数字中的最小值和最大值。


哦,我们没有告诉你答案。如果您真正尝试思考和编码,我们会帮助您。
Forget about the code for a moment. Try coming up with an algorithm in plain english that lets you find the minimum and the maximum in a bunch of numbers.

Oh, and we aren''t telling you the answer. We''ll assist you if you make real attempts at thought and code.



暂时忘掉代码。尝试用简单的英语算法,让你找到一堆数字中的最小值和最大值。


哦,我们没有告诉你答案。如果您真正尝试思考和编码,我们会帮助您。
Forget about the code for a moment. Try coming up with an algorithm in plain english that lets you find the minimum and the maximum in a bunch of numbers.

Oh, and we aren''t telling you the answer. We''ll assist you if you make real attempts at thought and code.



英语我会比较像
这样的数字
1 2 3 4

它会像

1< 2>>>>>>> 1分钟2max

2< 3>>>>>>> 2分钟3max

3< 4>>>>>>>> 3min 4max

然后我会将mins和maxes比较为


1< 2>>>>> 1分钟2max

2< 3>>>>> 2分钟3max

__________

2< 3 2min 3max

3< 4 3min 4 max

再一次

1< 2 1分2max sooooo分钟将是1

____________

3< 4 3min 4max sooooo max将是4


i想到代码3天,你们至少可以给我一个提示来进行统计!!!!

in english language i will compare the numbers like for
1 2 3 4
it will be like
1<2 >>>>>>1min 2max
2<3>>>>>>>2min 3max
3<4>>>>>>>3min 4max
then i will compare mins and maxes together like

1<2>>>>>1min 2max
2<3>>>>>2min 3max
__________
2<3 2min 3max
3<4 3min 4 max
one more time
1<2 1min 2max sooooo min will be 1
____________
3<4 3min 4max sooooo max will be 4

i thought about the code for 3 day can you guys at least give me a hint to statrt with!!!!


有趣的解决问题的方法。在那种方法中,你可以解决这个问题,但是有超过100个值要比较的行怎么样呢。这种方法需要一段时间才能完成。


你真正感兴趣的是什么?最小和最大。想想看,你只想知道最小值和最大值。你怎么看数字是否是最小的数字,然后你怎么看这个数字是否是最大的数字?
Interesting way of approaching the problem. In that method you work your way down, but what about a line that had over 100 values to compare. That method would take a while to go through.

What are you really interested in? minimum and maximum. Think about that, you only want to know minimum and maximum. How do you see if a number is the smallest number and then how do you see if that number is the largest number?


这篇关于计算最小值和最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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