首页
DreamJudge
院校信息
考研初试
考研复试
保研专区
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
cideyitanjiu
2024年2月29日 16:43
链表合并 题解:
P1025
回复 0
|
赞 1
|
浏览 1.0k
本题两种方法:1、数组暴力求解。2、链表慢慢计算 #include<stdio.h> #include<stdlib.h> //1、数组暴力求解(非链表套答案) //冒泡排序 void bubbleSort(int arr[],int n){ for(int i = 0;i < n-1;i++){ for(int j = 0; j < n - 1 - i;j++){ &n...
孙某人
2024年1月18日 19:23
链表合并 题解:跪求大佬帮忙看看
P1025
回复 0
|
赞 0
|
浏览 1.1k
#include<iostream> using namespace std; int main(){ int n=0; struct node{ int data; struct node *next; }; cin >> n; node *a=new node; a->next=NULL; node *b=a; for(int i=0;i<n;i++){ cin >> a->data; if(i==n-1) break; else{ a->...
孙某人
2024年1月18日 13:35
链表合并 题解:易错点:先判断是否为空
P1025
回复 2
|
赞 0
|
浏览 974
#include<iostream> using namespace std; int main(){ int n=0; struct node{ int data; struct node *next; }; cin >> n; node *a=new node; a->next=NULL; node *b=a; for(int i=0;i<n;i++){ cin >> a->data; if(i==n-1) break; else{ a->...
18937485169
2023年4月28日 14:16
数组
P1025
回复 0
|
赞 1
|
浏览 1.7k
#include<bits/stdc++.h> using namespace std; #define rep(i,s,e) for(int i=s;i<e;i++) #define per(i,s,e) for(int i=s;i>e;i--) int main(){ int n,x; vector<int> a; cin>>n; rep(i,0,n){ &n...
零壹
2023年3月26日 22:41
C语言求解
P1025
回复 0
|
赞 0
|
浏览 3.4k
#include<stdio.h> #include<stdlib.h> struct node{ int data; struct node*next; }; struct node*create(int len,int a[]){ struct node*head=(struct node*)malloc(sizeof(struct node)); struct node*pre=head; int i; for(i=0;i<len;i++){ struct node*now=(struc...
gold-Q
2023年3月24日 11:08
逻辑性强
P1025
回复 0
|
赞 1
|
浏览 2.9k
#include "bits/stdc++.h" #include <climits> using namespace std; struct LinkNode { int val; struct LinkNode * next; LinkNode(int x) : val(x), next(NULL){}; }; // 链表创建-有头结点 LinkNode *...
Hegel
2023年3月22日 21:19
合并两有序链表,输出合并结果
P1025
回复 0
|
赞 0
|
浏览 3.3k
#include <iostream> using namespace std; typedef struct LNode{ int data; struct LNode *next; }LNode,*List; int main() { List L1=new LNode,L2=new LNode; LNode *r1=L1,*r2=L2; L1->next=NULL,L2->next=NULL; int s1,s2; cin>>s1; for(int i=0;i<s1;i++){ LNode ...
Mihara
2022年7月1日 11:06
先建立链表、再合并
P1025
回复 0
|
赞 2
|
浏览 6.2k
关键点: 1.尾插法建立单链表 2.用两个指针去合并 #include <iostream> using namespace std; struct ListNode { int val; struct ListNode *next; ListNode(int value) : val(value), next(nullptr) {} }; int main() { int S1, S2; // 两个链表的虚拟头结点 ListNode *phead1 = new ...
Ang
2020年3月6日 21:44
偷分
P1025
回复 1
|
赞 0
|
浏览 12.0k
#include<iostream> #include<algorithm> using namespace std; int const maxn=201; int main(){ int n; cin>>n; int a[maxn]; for(int i=0;i<n;i++){ cin>>a[i]; } &n...
杨德胜
2021年3月20日 16:23
P1025 解题思路分享
P1025
回复 0
|
赞 0
|
浏览 9.8k
#include <bits/stdc++.h> using namespace std; typedef struct Node{ int n; struct Node* next; }Node,*Link; Link createnode(int e){ Link node=(Link)malloc(sizeof(Node)); node->next=NULL; node->n=e; } Link createlist(int s){ Link list=createnode(0); Link p=list; ...
1
2
3
4
5
题目
链表合并
题解数量
49
发布题解
在线答疑
热门题解
1
链表合并 题解:c实现链表合并
2
链表合并 题解:
3
链表合并 题解:
4
链表合并 题解:直接做一次归并排序的合并
5
链表合并 题解:
6
链表合并 题解:我是马云,我要关闭电子游戏
7
链表合并 题解:只为锻炼手搓链表以及合并链表,代码越长就越容易出一些小问题,因此一定要细心
8
链表合并 题解:链表实现
9
c++STL库里有链表合并函数merge()
10
合并两个有序的链表因此只需要单个比较插入