什么是对未知长度数组进行排序并搜索该数组中任何字符的最简单有用的方法? [英] What is an easiest and helpful method to sort an array of unknown length and search any character in that array?

查看:70
本文介绍了什么是对未知长度数组进行排序并搜索该数组中任何字符的最简单有用的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为此目的读了太多方法,但现在我很困惑bcz一些方法很好但是它们在所有条件下都不可行所以我需要一个好的和简单的方法,即使我们不知道它也适用于所有情况阵列长度

请至少写一个程序,解决有关此主题的任何问题

我等待

提前致谢... 。



我尝试了什么:



i尝试了很多方法,他们是非常漫长而复杂的,这就是为什么我需要一个简单易懂的方法来节省我的时间

所以请告诉我你现在使用的方法。

i read too many methods for this purpose but now i am confused bcz some methods are good but they are not workable in all conditions so i need a good and easy method which works in all situation even if we don't know the length of array
please write at least one program only which solves any problem about this topic
I am waiting
Thanks in advance....

What I have tried:

i tried many methods and they are very long and complex that's why i need a simple and understandable method which saves my time
So please tell me your method which u are using now.

推荐答案

您始终知道现有数组的大小。要么通过了解大小本身,要么通过查找可以通过迭代找到的指定结束标记(例如,标识C类型字符串结尾的NULL字符)。



对于排序算法,只需在网上搜索c ++排序算法之类的内容。大多数程序员将使用高级排序算法,因为他们更喜欢性能以节省自己的时间(特别是因为有很多示例实现)。一个普通的程序员只会使用一种C ++标准排序方法。



但是,最简单(最容易理解)的排序算法可能是冒泡排序。



You always know the size of an existing array. Either by knowing the size itself or by looking for a specified end marker which can be found by iteration (e.g. the NULL character identifying the end of a C type string).

For sorting algorithms just search the web for something like "c++ sort algorithms". Most programmers will use advanced sorting algorithms because they prefer performance to saving their own time (especially because there are lot of example implementations). A common programmer will just use one of C++ standard sort methods.

However, the simplest (easiest to understand) sorting algorithm is probably "Bubble Sort".

引用:

请至少编写一个程序,解决有关此主题的任何问题

please write at least one program only which solves any problem about this topic

这不会发生在这里。我们不提供订单代码。



That is not going to happen here. We do not provide code on order.

引用:

这节省了我的时间

但是我们应该投入我们的时间?

But we should invest our time instead?


引用:

请至少写一个程序,解决有关此主题的任何问题

please write at least one program only which solves any problem about this topic



No.

我们不做你的功课:它是为一个原因。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但我们不打算为你做这一切!


No.
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


阅读排序算法概述。通常情况下,分而治之是一个不错的选择。不仅用于排序,还用于查找。



为您的需求量身定制的代码就是您的任务。
Read this overview of sorting algorhitms. Normally the divide and conquer is a good choice. Not only for sorting but also in lookup.

Tailoring the code for your needs is your tasks.


这篇关于什么是对未知长度数组进行排序并搜索该数组中任何字符的最简单有用的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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