数据结构(浙江大学)
# 数据结构(浙江大学)
xingxing12323
上天有好生之德
展开
-
队列的实现
数组实现 #include <stdio.h> #include <stdlib.h> typedef int Position; typedef int ElementType; struct QNode{ ElementType* Data; Position Head,Tail; int MaxSize; }; typedef struct ...原创 2019-12-14 01:11:34 · 79 阅读 · 0 评论 -
堆栈的实现
数组实现堆栈 typedef int Position; struct SNode { ElementType *Data; /* 存储元素的数组 */ Position Top; /* 栈顶指针 */ int MaxSize; /* 堆栈最大容量 */ }; typedef struct SNode *Stack; typedef int bool...原创 2019-12-10 15:40:25 · 105 阅读 · 0 评论 -
线性表的实现
数组实现线性表 typedef int Position; typedef struct LNode *List; struct LNode{ ElementType Data[MAXSIZE]; Position Last; }; typedef int bool; #define TRUE 1 #define FALSE 0 #define ERROR -1 #define ...原创 2019-12-10 14:39:20 · 177 阅读 · 0 评论 -
二分法查找
函数接口定义: Position BinarySearch( List L, ElementType X ); 其中List结构定义如下: typedef int Position; typedef struct LNode *List; struct LNode { ElementType Data[MAXSIZE]; Position Last; /* 保存线性表中最后...原创 2019-12-07 22:40:10 · 100 阅读 · 0 评论 -
最大子序列问题
#include<stdio.h> #define N 100000 int MaxSubseqSum(int a[],int size); int main(void) { //方法一 int k=0,arr[N],result; scanf("%d",&k); for(int i=0;i<k;i++){ scanf("%...原创 2019-12-07 21:55:20 · 83 阅读 · 0 评论