使用线程编写二进制搜索程序 [英] to write a binary search program using threads

查看:104
本文介绍了使用线程编写二进制搜索程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以使用java编写程序来使用线程进行二进制搜索。
用于划分数组的一个线程和用于对数组进行排序的一个线程。

can we use write a program in java for binary search using threads. one thread for dividing the array and one for sorting the array.

推荐答案

当然。假设数组已排序,从概念上将数组拆分为与线程一样多的部分,并让每个线程对每个部分执行二进制搜索。

Sure. Assuming the array is sorted, notionally split the array into as many parts as you have threads and have each thread perform a binary search on each part.

这篇关于使用线程编写二进制搜索程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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