C#中排序算法的建议 [英] Advice for sorting algorithm in C#

查看:53
本文介绍了C#中排序算法的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有在c#中创建算法的任务,它会根据以下规则订购一些结果:



如果A> B和C> B => A,C,B ....



谢谢



我的尝试:



i haf尝试使用冒泡排序,但它会弄乱而不是结果。

Hi,

I have task for creating algorithm in c# that will order some results with the following rule:

if A > B and C > B => A, C, B ....

Thanks

What I have tried:

i haf tried with bubble sort but it messing but results.

推荐答案

从这里开始:冒泡排序 - 维基百科 [ ^ ] - 它解释它,演示它,它甚至提供了伪代码,您可以将其转换为C#(或任何其他语言,因为您要求三个)。 br $> b $ b

这是你的作业:我们不是为你做的。尝试一下,如果你遇到一个特定的问题,请询问(告诉我们你尝试了什么,你如何测试它,并解释你做了什么),我们很乐意帮助你 - 但我们不会为你做这一切!
Start here: Bubble sort - Wikipedia[^] - it explains it, demonstrates it, and it even provides pseudo code that you can translate into C# (or any other language since you ask for three).

This is your homework: we don't do it for you. Give it a try, and if you meet a specific problem ask about that (showing us what you tried, how you tested it, and explaining what happened when you did) and we will be happy to help you - but we are not going to do it all for you!


引用:

如果A> B和C> B => A,C,B ....

if A > B and C > B => A, C, B ....



检查该规则,这是错误的。

展示你的工作,解释问题,你会得到帮助。



我们不做你的HomeWork。

HomeWork不会测试你乞求别人做你的工作的技巧,它是让您思考并帮助您的老师检查您对所学课程的理解以及您应用这些课程时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

所以,试一试,重读你的课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找到数学并做出必要的调整以适应你的实际问题。


Check that rule, it is wrong.
Show your work, explain the problem and you will get help.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.


这篇关于C#中排序算法的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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