小编Ada*_*rry的帖子

具有两个嵌套循环的非递归合并排序 - 如何?

第一个问题,是的,这是一个功课问题.我们的任务是在数组上执行合并排序(我很熟悉),但在某种程度上我不确定如何做.通常我会有一个单独的合并和合并排序功能,并使用这两个.然而,听起来他想用一种方法做所有事情?我只是希望也许有人可以帮我清理一下,或者说出我能更好理解的条款.

从作业:

您需要实现一个非递归版本的merge-sort算法.安排两个嵌套循环来完成此任务.外循环应提供合并段的大小.内环应该注意选择段的位置.内循环应从左边缘开始,并将分段向右移动.排列左,中,右变量的适当值,以便通过迭代调用合并(a,left,middle,right)来完成排序.

我讨厌这么模糊,但我真的不明白他在说什么.首先,"外环应该提供段的大小"是什么意思?循环如何提供任何东西?下一句话怎么样?他对段的意思是什么?数据?

我不是要求代码,但任何伪代码都会非常有用.

如果有人可以尝试破译他的意思,我会很感激.我已经通过电子邮件向他发了电子邮件,但已经过了几个小时,我还没有回复.

谢谢!

c++ sorting algorithm mergesort

11
推荐指数
1
解决办法
9976
查看次数

C++重载提取运算符 - 错误无法访问类中声明的私有成员

我正在做一些功课并收到最奇怪的错误.希望你能提供帮助.我收到此错误:

无法在课堂上访问私人会员

注意:我显然没有写完这个,但我试着去测试错误.非常感谢您的任何输入!

// Amanda 
// SoccerPlayer.cpp : main project file.
// October 6, 2012
/* a. Design a SoccerPlayer class that includes three integer fields: a player's jersey     number,
number of goals, and number of assists. Overload extraction and insertion operators for     the class.
b. Include an operation>() function for the class. One SoccerPlayer is considered greater
than another if the sum of goals plus assists is greater.
c. Create an array of 11 SoccerPlayers, then use the …
Run Code Online (Sandbox Code Playgroud)

c++ operator-overloading private-members ostream

5
推荐指数
1
解决办法
2526
查看次数