如何在java语言中使用两个线程找到数组的最大值? [英] How do I find maximum value of an array using two threads in java language?

查看:116
本文介绍了如何在java语言中使用两个线程找到数组的最大值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是在java编程语言中使用两个线程找到数组的最大值。



我尝试了什么: < br $> b $ b

iam一无所知,对此知之甚少

My question is to find maximum value of an array using two threads in java programming language.

What I have tried:

iam clueless and dont know anything about this

推荐答案

首先,解决没有线程的问题。带线程的版本将使用相同的算法。



每个线程将解决阵列的一部分(一半)上的问题。

然后主程序将返回每个线程的答案并合并它们以便给出整个问题的答案。
First, solve the problem without threads. The version with threads will use the same algorithm.

Each thread will solve the problem on a part (the half) of the array.
Then the main program will get back the answer of each thread and merge them in order to give the answer to the whole problem.


参见 Java™教程 [ ^ ]。


这篇关于如何在java语言中使用两个线程找到数组的最大值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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