04 2022 档案

摘要:二叉搜索树的操作集 本题要求实现给定二叉搜索树的5种常用操作 函数接口定义 BinTree Insert( BinTree BST, ElementType X ); BinTree Delete( BinTree BST, ElementType X ); Position Find( BinTr 阅读全文
posted @ 2022-04-22 20:51 里列昂遗失的记事本 阅读(61) 评论(0) 推荐(0)
摘要:先序输出叶结点 本题要求按照先序遍历顺序输出给定二叉树的叶节点 函数接口定义 void PreorderPrintLeaves( BinTree BT ); 其中BinTree结构定义如下: typedef struct TNode *Position; typedef Position BinTr 阅读全文
posted @ 2022-04-22 20:18 里列昂遗失的记事本 阅读(80) 评论(0) 推荐(0)
摘要:求二叉树高度 本题要求给定二叉树的高度 函数接口定义 int GetHeight( BinTree BT ); 其中BinTree结构定义如下: typedef struct TNode *Position; typedef Position BinTree; struct TNode{ Eleme 阅读全文
posted @ 2022-04-22 20:11 里列昂遗失的记事本 阅读(96) 评论(0) 推荐(0)
摘要:二分查找 本题要求实现二分查找算法。 函数接口定义 Position BinarySearch( List L, ElementType X ); 其中List结构定义如下: typedef int Position; typedef struct LNode *List; struct LNode 阅读全文
posted @ 2022-04-20 20:31 里列昂遗失的记事本 阅读(31) 评论(0) 推荐(0)
摘要:二叉树的遍历 本题要求给定二叉树的4种遍历 函数接口定义 void InorderTraversal( BinTree BT ); void PreorderTraversal( BinTree BT ); void PostorderTraversal( BinTree BT ); void Le 阅读全文
posted @ 2022-04-20 20:02 里列昂遗失的记事本 阅读(54) 评论(0) 推荐(0)
摘要:在一个数组中实现两个堆栈 本题要求在数组中实现两个堆栈 函数接口定义 Stack CreateStack( int MaxSize ); bool Push( Stack S, ElementType X, int Tag ); ElementType Pop( Stack S, int Tag ) 阅读全文
posted @ 2022-04-19 22:01 里列昂遗失的记事本 阅读(120) 评论(0) 推荐(0)
摘要:#include<stdio.h> void Swap(int *x, int *y) { int t; t = *x; *x = *y; *y = t; } int Partition(int A[], int p, int r) { int X = A[p]; /* 选取第一个数为主元 主元不动 阅读全文
posted @ 2022-04-18 14:29 里列昂遗失的记事本 阅读(113) 评论(0) 推荐(0)
摘要:带头结点的链式表操作集 本题要求实现带头结点的链式表操作集 函数接口定义 Position Find( List L, ElementType X ); List Insert( List L, ElementType X, Position P ); List Delete( List L, Po 阅读全文
posted @ 2022-04-16 22:12 里列昂遗失的记事本 阅读(98) 评论(0) 推荐(0)
摘要:链式表操作集 本题要求实现链式表的操作集 函数接口定义 Position Find( List L, ElementType X ); List Insert( List L, ElementType X, Position P ); List Delete( List L, Position P 阅读全文
posted @ 2022-04-16 11:48 里列昂遗失的记事本 阅读(100) 评论(0) 推荐(0)
摘要:链式表的按序号查找 本题要求实现一个函数,找到并返回链式表的第K个元素、 函数接口定义 ElementType FindKth( List L, int K ); 其中List结构定义如下: typedef struct LNode *PtrToLNode; struct LNode { Eleme 阅读全文
posted @ 2022-04-15 19:37 里列昂遗失的记事本 阅读(94) 评论(0) 推荐(0)
摘要:求链式表的表长 本题要求实现一个函数,求链式表的表厂。 函数式接口定义 int Length( List L ); 其中List结构定义如下: typedef struct LNode *PtrToLNode; struct LNode { ElementType Data; PtrToLNode 阅读全文
posted @ 2022-04-15 16:07 里列昂遗失的记事本 阅读(58) 评论(0) 推荐(0)
摘要:顺序表操作集 本题要求实现顺序表的操作集 函数接口定义 List MakeEmpty(); Position Find( List L, ElementType X ); bool Insert( List L, ElementType X, Position P ); bool Delete( L 阅读全文
posted @ 2022-04-15 15:55 里列昂遗失的记事本 阅读(100) 评论(0) 推荐(0)
摘要:单链表逆转 本题要求实现一个函数,将给定的单链表逆转 函数接口定义 List Reverse(List L); 其中List结构定义如下: typedef struct Node *PtrToNode; struct Node{ ElementType Data; /* 存储结点数据 */ PtrT 阅读全文
posted @ 2022-04-15 11:37 里列昂遗失的记事本 阅读(53) 评论(0) 推荐(0)
摘要:自测-1 打印沙漏 要求写个程序把给定的符号打印成沙漏的形状。例如给定17个“*”,要求按下列格式打印 ***** *** * *** ***** 所谓“沙漏形状”,是指每行输出奇数个符号;各行符号中心对齐;相邻两行符号数差2;符号数先从大到小顺序递减到1,再从小到大顺序递增;首尾符号数相等。 给定 阅读全文
posted @ 2022-04-14 08:20 里列昂遗失的记事本 阅读(177) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<malloc.h> #include<stdlib.h> struct AvlNode; typedef struct AvlNode *Position; typedef struct AvlNode *AvlTree; typedef cha 阅读全文
posted @ 2022-04-10 16:45 里列昂遗失的记事本 阅读(30) 评论(0) 推荐(0)
摘要:Divide-and-conquer algorithm in multiplication \[ x^n=x\cdot x\cdot x\cdots x \] 时间复杂度为O(n),有n-1个乘法 \[ x^n=x^\frac n2\cdot x^\frac n2\qquad\mbox{if x 阅读全文
posted @ 2022-04-08 14:44 里列昂遗失的记事本 阅读(432) 评论(0) 推荐(0)
摘要:BinarySearchTree #include<stdlib.h> #include<malloc.h> #include<stdio.h> struct TreeNode; typedef struct TreeNode *Position; typedef struct TreeNode * 阅读全文
posted @ 2022-04-01 19:41 里列昂遗失的记事本 阅读(35) 评论(0) 推荐(0)