C#程序使用二进制搜索技术搜索字符串 [英] c# program to search for a string using binary search technique

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

问题描述

我该如何用C#编写一个使用二进制搜索技术在字符串数组中搜索字符串的程序.使用线性搜索是很容易的,但是使用二进制搜索则变得很复杂.我得到的唯一提示是列表必须首先排序.我完全不知道该如何实现...

how can i write a program in c# that searches for a string in a string array using binary search technique.with linear it was pretty easy but with binary search it becomes complicated.the only hint i got was that the list has to be sorted first.i completely have no idea how to achieve this.pllzz help!!!..

推荐答案

在代码项目中有很多关于它的好文章网站:
http://www.codeproject.com/search. aspx?q = binary + search& x = 13& y = 9& sbo = kw [ Google [ ^ ].将来,您应该先尝试一下,然后再问:)
There are a couple of good articles about it on the codeproject site:
http://www.codeproject.com/search.aspx?q=binary+search&x=13&y=9&sbo=kw[^]

If you cant find anything here you should have a look at Google[^]. In the future you should try it yourself first, before you ask :)


http://www.dotnetperls.com/array-binarysearch [^ ]


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

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