-
Notifications
You must be signed in to change notification settings - Fork 46
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
整理目录后的作业 #18
Merged
Merged
整理目录后的作业 #18
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
55d93e8
周继存数据结构作业
springwintersummer c88aec1
第一次交代码
springwintersummer a2f4bad
第二次作业第一次代码
springwintersummer a80d803
第二次作业第一次提交
springwintersummer afffe56
第一次修改和第二次作业
springwintersummer d4d7413
运算符重载&基本操作
springwintersummer ef14efd
三次作业的提交
springwintersummer 910a890
第五次作业第一次提交
springwintersummer 4ee908e
二叉树计算高度和最大宽度,以及叶子非叶子节点
springwintersummer 3f61980
前面有问题的第一次作业和第四次拆分链表
springwintersummer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#include<stdio.h> | ||
#include<stdlib.h> | ||
struct list{ | ||
int data; | ||
struct list *next; | ||
}; | ||
void input(struct list *head,int number) | ||
{ | ||
printf("������Ӧ��������\n"); | ||
int i; | ||
struct list *temp; | ||
struct list *end; | ||
end=head; | ||
for(i=0;i!=number;i++) | ||
{ | ||
temp=(struct list *)malloc(sizeof(struct list)); | ||
scanf("%d",&temp->data); | ||
end->next=temp; | ||
temp->next=NULL; | ||
end=temp; | ||
} | ||
} | ||
void sort(struct list *l1,struct list *l2) | ||
{ | ||
struct list *p1,*p2,*temp; | ||
p1=l1; | ||
p2=l2->next; | ||
while(p1->next&&p2) | ||
{ | ||
if(p1->next->data>p2->data) | ||
{ | ||
temp=p2->next; | ||
p2->next=p1->next; | ||
p1->next=p2; | ||
p2=temp; | ||
} | ||
else | ||
p1=p1->next; | ||
} | ||
if(p2) | ||
p1->next=p2; | ||
} | ||
void output(struct list *head) | ||
{ | ||
printf("���Lc��\n"); | ||
while(head->next) | ||
{ | ||
printf("%d ",head->next->data); | ||
head=head->next; | ||
} | ||
} | ||
int main() | ||
{ | ||
int num; | ||
list *h1,*h2; | ||
h1=(struct list*)malloc(sizeof(struct list)); | ||
h2=(struct list*)malloc(sizeof(struct list)); | ||
h1->next=NULL; | ||
h2->next=NULL; | ||
printf("����La�ij��ȣ�\n"); | ||
scanf("%d",&num); | ||
input(h1,num); | ||
printf("����Lb�ij���:\n"); | ||
scanf("%d",&num); | ||
input(h2,num); | ||
sort(h1,h2); | ||
output(h1); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.c
去调试无误后再行提交struct list *h1,*h2;
,