代码改变世界

随笔档案-2012年05月

hdu 1159 最长公共子序列

2012-05-07 19:41 by 璋廊, 197 阅读, 收藏,
摘要: A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = <x1, x2, ..., xm> another sequence Z = <z1, z2, ..., zk> is a subsequence of X if there exists a strictly increasing sequence <i1, i2, ..., ik> of indices of X 阅读全文

实验四 栈和队列的基本操作

2012-05-05 22:23 by 璋廊, 645 阅读, 收藏,
摘要: (1)采用链式存储实现栈的初始化、入栈、出栈操作。(2)采用顺序存储实现栈的初始化、入栈、出栈操作。(3)采用链式存储实现队列的初始化、入队、出队操作。(4)采用顺序存储实现循环队列的初始化、入队、出队操作。(5)在主函数中设计一个简单的菜单,分别测试上述算法。#include<stdio.h>#include<stdlib.h>typedef struct point //建立结构体{ int data; struct point *right,*left;}Link,*List;List built(int n)//建立链表;{ List h,p,s; int i, 阅读全文

实验三 双链表

2012-05-05 22:21 by 璋廊, 228 阅读, 收藏,
摘要: #include<stdio.h>#include<stdlib.h>typedef struct point //建立结构体{ int data; struct point *right,*left;}Link,*List;List built(int n)//建立链表;{ List h,p,s; int i,x; h=(List)malloc(sizeof(Link)); s=h; s->left=NULL; for(i=1;i<=n;i++) { p=(List)malloc(sizeof(Link)); scanf("%d",&a 阅读全文