在C#中的程序中实现0(log)n搜索 [英] implementing a 0(log)n search in a program in C#

查看:90
本文介绍了在C#中的程序中实现0(log)n搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以举一个例子,说明如何在C#程序中实现0(log)n的搜索.
我还被要求通过在要搜索的文件上创建索引文件来索引要搜索的文件...
我已经在互联网上搜索了如何执行此操作,但是我的努力没有取得任何成果.

Can i have an example of how to implement a search of 0(log)n in a C# program.
i am also requested to index the file to be searched by creating an index file on the file to be searched...
I have searched the internet on how to do this but my efforts did not bear any fruits.

your help will be highly appreciated in this matter.

推荐答案

请参阅我对问题的评论.

二叉搜索树给出所需的平均时间复杂度O(log N),但是当树变为线性时,最坏的情况当然是O(N).请参见平均时间复杂度"很重要.)

请正确书写并理解该符号.请参见
http://en.wikipedia.org/wiki/Big_O_notation [
Please see my comments to the question.

A binary search tree gives the required average time complexity of O(log N), but worst case is, of course, O(N), when a tree becomes linear. See http://www.google.com/search?hl=en&source=hp&q=site%3ACodeProject.com+SAKryukov&aq=f&aqi=&aql=&oq=[^].

(Again, the formulation of the problem is not all correct, mentioning "average time complexity" is important.)

Please write and understand the notation correctly. See http://en.wikipedia.org/wiki/Big_O_notation[^].

If I''m right in my guess that this is a school assignment, regards to your teacher. Tell her/him that her/his question got my vote of 3. No more. :-)

—SA


这篇关于在C#中的程序中实现0(log)n搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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