
数据结构
Ray.C.L
不开longlong见祖宗
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Running Median(对顶堆维护中位数)
题目链接 题意:给你n个数,当数字个数为奇数时输出此时的中位数 思路:以第一个数作为mid值,建立一个大顶堆一个小顶堆,大于mid的加入小顶堆,小于mid 的加入大顶堆若两堆相差2个数更新mid,注意格式 在这里插入代码片 ...原创 2020-04-09 19:41:09 · 748 阅读 · 0 评论 -
N个最小和加强版
思路:每2个一对算最小的n个和,每次将加完后的n个和更新到a[i][j]最后算出的就是答案。记得清理优先队列 #include <iostream> #include <algorithm> #include <cmath> #include <cstring> #include <cstdio> #include <set&g...原创 2020-03-01 15:54:45 · 322 阅读 · 0 评论 -
二叉树建立及遍历
#include "stdio.h" #include "stdlib.h" typedef struct tree { char data; struct tree *lchild; struct tree *rchild; }*Ptree; Ptree createTree() //树的建立 { char ch; Ptree t; ...原创 2019-10-13 22:37:54 · 121 阅读 · 1 评论 -
02-线性结构1 两个有序链表序列的合并
#include <stdio.h> #include <stdlib.h> #include<bits/stdc++.h> typedef int ElementType; typedef struct Node *PtrToNode; struct Node { ElementType Data; PtrToNode Next; ...原创 2019-10-03 19:06:39 · 104 阅读 · 0 评论