首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
lingdongyang
2024年3月13日 21:30
单链表 题解:
P1015
回复 0
|
赞 6
|
浏览 1.3k
#include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct Node { int Element;//数据 struct Node* Next;//存储下一个结点的地址 }Node; void sort(int num[]) { for (int i = 0; i < 5; i++) { for (int j = 0; j < 5 - 1 - i; j++) { if (num[j + 1] < num...
周小黑02477
2024年3月11日 19:20
为什么程序不对劲,有大佬看看吗
P1015
回复 2
|
赞 0
|
浏览 890
#include<stdio.h> #include<string> #include <stdlib.h> #include<iostream> #include<string.h> #include<algorithm> using namespace std; int s[10]; struct node { int element; struct node *next; }; struct node* create() { struct node* head, ...
orderrr
2024年3月10日 17:31
单链表 题解:c 解决
P1015
回复 0
|
赞 1
|
浏览 1.2k
#include <stdio.h> #include <malloc.h> #include <stdlib.h> struct Node { int Element; // 节点中的元素为整数类型 struct Node *Next; // 指向下一个节点 }; void sort(int num[]) // 冒泡排序 { for (int i = 0; i < 5; i++) { int min = i; for (int j...
promising
2024年3月10日 17:23
单链表 题解:
P1015
回复 0
|
赞 0
|
浏览 1.1k
用数组保存输入的五个数,冒泡排序后再用尾插法插入链表,遍历链表 #include<stdio.h> #include<stdlib.h> int main() { typedef struct LNode { int data; // 节点中的元素为整数类型 struct LNode * next; // 指向下一个节点...
熹微
2024年3月7日 22:04
单链表 题解:
P1015
回复 3
|
赞 0
|
浏览 1.1k
兄弟们,为什么我这个再编译器下运行是可以的,而再平台上运行时,一直说运行时错误,这个原因是什么呢? #include<stdio.h> #include<stdlib.h> typedef struct Node { int Element; // 节点中的元素为整数类型 struct Node * Next; // 指向下一个节点 }Lnode,LinkList; void Fac(LinkList **linkList,int n){ Lnode *NE...
huanghu
2024年3月6日 19:11
单链表 题解:
P1015
回复 0
|
赞 1
|
浏览 932
#include<stdio.h> #include<iostream> #include<malloc.h> using namespace std; //在以下程序中完成单链表的排序,输入五个数即可 typedef struct Node{ int data; struct Node *next; }LinkNode,*LinkList; void init(LinkList &L) { // 申请一个头结点 ...
小王桐学
2024年1月27日 22:04
单链表 题解:C++
P1015
回复 0
|
赞 4
|
浏览 1.3k
C++用& #include <stdio.h> #include <stdlib.h> typedef struct Node { int data; //节点中的元素为整数类型 struct Node * next; //指向下一个节点 }LNode,*LinkList; void InitList(LinkList &L,int n) { int i; L = (LNode *)malloc(sizeof(LinkList)); L->next = NULL; for(i...
零壹
2023年3月26日 09:07
c-头插法
P1015
回复 0
|
赞 3
|
浏览 3.1k
先对数组进行冒泡排序,然后头插法创建链表,最后就链表遍历输出即可,也可以用尾插法啦。 #include<stdio.h> #include<stdlib.h> struct node{ struct node*next; int data; }; struct node* create(int a[],int len){ int i; struct node*head=(struct node*)malloc(sizeof(struct node)); struct node*t=(struct node*)mal...
Hegel
2023年3月18日 20:48
边输入边插入单链表,简单插入排序
P1015
回复 0
|
赞 0
|
浏览 3.7k
#include <iostream> using namespace std; struct Node { int Element; // 节点中的元素为整数类型 struct Node* Next; // 指向下一个节点 }; int main() { struct Node* L = new Node; L->Next = NULL; for (int i = 0; i < 5; i++) { struct Node* k = new Node, * p = L; cin >> k->Elemen...
wenjuice
2022年3月14日 16:19
冒泡排序优化,减少比较次数
P1015
回复 0
|
赞 0
|
浏览 6.7k
// 冒泡排序优化 void sortList(LinkList &L, int n) { Node *p, *q; int temp, k = n - 1, s; bool flag; // 是否有序 for (int i = 0; i < n; i++) { p = L; q = L->next; // 从头开始 s = 0; flag = true; for (int j = 0; j < k; j++) { if (p->data > q->data) { temp ...
1
2
3
4
题目
单链表
题解数量
39
发布题解
在线答疑
热门题解
1
单链表 题解:用单链表的冒泡排序 C语言
2
单链表 题解:
3
单链表 题解:顺便回忆一下头插法
4
单链表 题解:不会真以为我会用链表吧孩子
5
(单链表的创建和排序)练习是学知识的,钻空子没有意义
6
单链表 题解:
7
1015单链表(注释详细)
8
单链表 题解:你怎么知道我next节点全是nullptr
9
单链表 题解:C++
10
c-头插法