自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 Pop Sequence

//每次自增加1入栈,如果栈顶元素与读取的当前元素相同则出栈 //如果栈满也没有匹配当前元素则no #include <stdio.h> #include <stdlib.h> typedef struct Node *Stack; struct Node { int Data; struct Node *Next; }; Stack CreateStack();...

2019-11-09 14:41:49 128

原创 Reversing Linked List(7个测试点只过了3个,好难,放弃了)

#include <stdio.h> #include <stdlib.h> typedef struct Node *List; struct Node { int Address; int Data; int NxtAdd; List Next; }; List Create(int *N, int *K); void Print(List list); L...

2019-10-16 21:14:38 478

原创 PTA数据结构与算法中文-两个有序链表序列的合并

函数: List Merge( List L1, List L2 ) { List L3, head, temp, hL1, hL2; int data; head = (List)malloc(sizeof(struct Node)); head->Next = NULL; L3 = head; hL1 = L1; hL2 = L2; for ( L1=L1->N...

2019-10-11 19:02:48 273

原创 PTA数据结构与算法中文-一元多项式的乘法与加法运算

//Polynomial addition and multiplicatin #include <stdio.h> #include <stdlib.h> typedef struct PolyNode *Polynomial; struct PolyNode { int coef; int expon; struct PolyNode *next; }; P...

2019-10-11 18:14:09 288

原创 浙大数据结构笔记-最大堆

最大堆 最大堆的存储结构-完全二叉树,数组存储 typedef struct HeapStruct *MaxHeap; struct HeapStruct{ ElementType *Elements; int Size; int Capacity; }; 最大堆操作 MaxHeap Create( int maxsize ){ MaxHeap H = (MaxHeap)malloc(...

2019-10-02 15:43:59 206 2

原创 浙大数据结构笔记-二叉搜索树

二叉搜索树 二叉搜索树的查找-递归实现 Position Find( ElementType X, BinTree BST ) { if ( !BST ) return NULL; if ( X > BST->Data ) return Find(X, BST->Right); else if ( X < BST->Data ) return Fin...

2019-10-01 21:16:48 170

原创 浙大数据结构笔记-二叉树的遍历

二叉树 链表式存储结构 二叉树结构 typedef struct TreeNode *BinTree; typedef BinTree Position; struct TreeNode { ElementType Data; BinTree Left; BinTree Right; }; 堆栈结构 typedef struct StackNode *Stack; struct Stack...

2019-10-01 11:00:31 355

原创 浙大数据结构笔记-二分法

二分法 int BinarySearch(StaticTable tbl, ElementType x){ //Ascending order int left, right, mid, Found = 0; left = 1; right = tbl->Length; while ( left <= right ) { mid = ( left + right ) /...

2019-09-27 21:15:26 88

原创 PTA数据结构与算法中文-在一个数组中实现两个堆栈

测试: #include <stdio.h> #include <stdlib.h> #include <string.h> #define ERROR 1e8 typedef int ElementType; typedef enum { push, pop, end } Operation; typedef enum { false, true } boo...

2019-09-24 16:12:40 204

原创 PTA数据结构与算法中文-带头结点的链式表操作集

提交 List MakeEmpty() { List head = (List)malloc(sizeof(struct LNode)); head->Next = NULL; return head; } Position Find( List L, ElementType X ) { if ( L!=NULL ) { List p = L->Next; for (...

2019-09-23 22:04:32 304

原创 PTA数据结构与算法中文-链式表操作集

提交代码 Position Find( List L, ElementType X ) { List p = L; for ( p=L; p; p=p->Next) { if ( p->Data == X) return p; } return ERROR; } List Insert( List L, ElementType X, Position P ) { ...

2019-09-23 20:32:14 196

原创 PTA数据结构与算法中文-链式表的按序号查找

ElementType FindKth( List L, int K ){ int i = 1; List p = L; for ( p=L; p; p=p->Next){ if ( i== K) return p->Data; i++; } return ERROR; }

2019-09-23 15:49:56 137

原创 PTA数据结构与算法中文-求链表的表长

int Length( List L ){ List p; int i = 0; for ( p=L; p; p=p->Next) i++; return i; }

2019-09-23 15:30:48 350

原创 PTA数据结构与算法中文-单链表逆转

List Reverse(List L) { List head=NULL, p=L; List temp = NULL; if (L == NULL) return NULL; while (p){ temp = p; p = p->Next; temp->Next = head; head = tem...

2019-09-23 14:58:27 234

原创 浙大数据结构笔记-单链表

浙大数据结构笔记-单链表 #include <stdio.h> #include <stdlib.h> #include "node.h" //typedef struct _node{ // int value; // struct _node *next; //} Node; typedef struct _list{ Node *head; } List; v...

2019-09-23 14:58:12 159

原创 PTA数据结构与算法中文-顺序表操作集

#include <stdio.h> #include <stdlib.h> #define MAXSIZE 6 #define ERROR -1 typedef enum {false, true} bool; typedef int ElementType; typedef int Position; typedef struct LNode *List; struc...

2019-09-23 12:18:45 177

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除