Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

求图最短路径 #144

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

求图最短路径 #144

wants to merge 5 commits into from

Conversation

Cassie8888
Copy link
Contributor

No description provided.

Copy link
Contributor

@c4pr1c3 c4pr1c3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

随机抽查到,给了一点建议,是否修改自己拿主意,非强制要求修改。

}
//图的基本操作

Status LocateVex(MGraph *G,int v1,int v2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照我们课件中的操作定义,LocateVex应该是实现若G中存在顶点u,则返回该顶点在图中“位置” ;否则返回其它信息,你这里实际的连线操作是不是用InsertArc更合适?

// 在G中增添弧<v,w>,若G是无向的,
// 则还增添对称弧<w,v>。
InsertArc(&G, v, w); 

{
int i;
int j;
//根据用例直接赋值。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

虽然就题论题你这里这样写是能得到正确答案的,但建议以后在实际应用编程时,尽量把这种参数配置类的工作交给调用者(函数)在调用函数时执行传参操作,代码的封装可复用就会一点点积累起来了。

int j;

MGraph Graph;
CreateUDN(&Graph);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CreateUDN 有个返回值,再判断一下返回值就更有范儿了~

int i;
int j;

MGraph Graph;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C/C++代码中,我们习惯于使用小写字母打头的单词表示一个变量。大写字母开头的单词,我们的编码风格惯例是留给结构体函数名方法的。

@c4pr1c3 c4pr1c3 mentioned this pull request May 17, 2017
Merged
Copy link
Collaborator

@cucyoyo cucyoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

代码整体完成较为良好,注意仔细阅读作业要求。

查找节点:6
该元素存在,删除该节点,重新打印树
10 3 1 7 4 14 13 19 22 20 30
Program ended with exit code: 0
Copy link
Collaborator

@cucyoyo cucyoyo Jun 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意按照作业要求打印输出,数字之间使用", "分隔

root = Insert(root, 5);
root = Insert(root, 19);
root = Insert(root, 22);
root = Insert(root, 30);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

建议使用一个创建树的函数,统一进行树的初始化插入操作

Copy link
Collaborator

@cucyoyo cucyoyo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 需要修改:简单选择排序的实现。
  • 二叉排序树作业修改通过
  • 哈希表操作完成没有问题
  • 建议修改:
    • 使用有意义的变量名称提高代码可读性
    • 自动格式化代码

if ( p[i] < p[j]&&(++s1))
{
swap(p[i],p[j]);
s2+=3;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意再去理解简单选择排序的原理并修改此处的代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants