
数据结构
文章平均质量分 65
shen_bingyu
一句话介绍不了
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【数据结构】一颗二叉树的中序遍历和前序遍历,求后序遍历
最近机考,复习一下。之前做这道题时候没有用递归,今天用递归写了一下。前序:4,3,1,2,5,6,7中序: 1,3,2,4,6,5,7后序: 1,2,3,6,7,5,4思想很简单,就是前序的第一个一定是根,在中序的输出中,这个点左侧的都是左子树,右边的都是右子树。然后再递归的分别找左右子树的根。代码如下:#include using na原创 2014-12-19 19:31:27 · 1048 阅读 · 0 评论 -
【数据结构】SJTU OJ 1237
http://acm.sjtu.edu.cn/OnlineJudge/problem/1237烦死了烦死了应该按照年份考虑的,自己做的时候又忘记减入度,真是活该。快复习!!#include using namespace std;int begin=1,tail=0,Q[100001]={0},cnt=0,tmp=0,res=0,de;int begin_=1,tail_=0,原创 2014-12-21 18:59:18 · 727 阅读 · 0 评论 -
【数据结构】SJTU OJ 1233
http://acm.sjtu.edu.cn/OnlineJudge/problem/1233回溯之后要记得改变状态啊啊啊啊啊啊啊!!!!记住主要的思想是什么!!#include using namespace std;int M,cnt=0;class graph{private: struct edgeNode{ int原创 2014-12-21 19:02:49 · 1212 阅读 · 0 评论 -
【数据结构】SJTU OJ 1234
http://acm.sjtu.edu.cn/OnlineJudge/problem/1234注意不相交集的写法啊。还有就是如果只是KRUSTRAL算法的话就按照这个写吧。#include using namespace std;int a[100001],b[100001],w[100001],parent[100001];void Union(int r1,int r2)原创 2014-12-21 23:50:23 · 993 阅读 · 0 评论 -
【数据结构】USACO clocks
最暴力的办法,开始超了。改了一些循环的控制就对了。http://acm.sjtu.edu.cn/OnlineJudge/problem/1047#include //clock//usaco#include using namespace std;void change(int &x){ x=(x+3)%12;}void change(int n,int a原创 2014-12-23 18:14:06 · 572 阅读 · 0 评论 -
【数据结构】红黑树的实现
Talk is cheap, show me the code.红黑树真是抄了好久才抄完,要是有时间真应该重新写一下。#ifndef _RED_BLACK_TREE_HPP_#define _RED_BLACK_TREE_HPP_#include #include using namespace std;enum RBTColor{RED, BLACK};template原创 2014-12-13 15:53:04 · 729 阅读 · 0 评论 -
【数据结构】邓玉欣的编程作业indexing
第一次的project的第一题。大概意思就是自己实现原创 2014-10-31 14:05:40 · 1069 阅读 · 0 评论 -
【数据结构】dengyuxin的project1.2
虽然很简单还是贴出来吧。#ifndef POLYON_H_INCLUDED#define POLYON_H_INCLUDED#include using namespace std;class node{ public: int pa; int times; node *next; node(int p = 0,int t = 0,node* n=原创 2014-10-27 23:13:56 · 540 阅读 · 1 评论 -
欢迎使用优快云-markdown编辑器
简单LinkedList 的java代码实现: public class LinkedListNode { public int value; public LinkedListNode next; public LinkedListNode(int value) { this.value = value; this.next = null; }原创 2015-07-10 11:51:01 · 539 阅读 · 0 评论