![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
lzk_1049668876
stay hungry stay foolish
展开
-
数据结构归并排序及其实现
/****------------------***归并排序:(n logn)算法基本思想:将两个及以上的有序表合成一个新的有序表时间复杂度分析:主要两个函数的时间花销T[n]=数组的划分(O(n))和有序数组的归并排序(T[n/2])公式:T[n]=2T[n/2]+O(n);结果:T[n]=O(nlogn);空间复杂度:O(n)优点:非常稳定***-------------...原创 2018-07-01 10:38:08 · 316 阅读 · 0 评论 -
【poj3171 Cleaning Shifts】【数据结构优化dp】【最少区间覆盖代价】
【链接】http://poj.org/problem?id=3171【题意】有N个贴纸,可覆盖范围为[ai,bi],售价ci,问要覆盖L,R,区间,最少需要多少代价【分析】dp[i]代表覆盖区间[L,i]的最小花费。将所有贴纸按右端点排序,设当前贴纸为[ai,bi],价格ci,状态转移方程为:dp[i]=min{f[x]}+ci (ai-1<=x<bi)【...原创 2018-08-27 13:12:37 · 337 阅读 · 0 评论 -
【数据结构】【合并两个有序链表】
#include<stdio.h>#include<string.h>#include<stdlib.h>const int maxn = 1e5 + 5;struct node { int num; struct node *next;};struct node* merage(struct node*head1, struct node...原创 2018-10-22 22:08:19 · 271 阅读 · 0 评论 -
【数据结构】【多项式链表实现相加】
#include<bits/stdc++.h>using namespace std;const int inf = 0x3f3f3f3f;const int maxn = 1006;struct node { double coef; int exp; struct node*next;};struct node*Add(struct node *head1,...原创 2018-10-22 22:09:19 · 242 阅读 · 0 评论