随笔分类 - PTA-数据结构与算法题目集(中文)
摘要:本题要求实现二分查找算法。 函数接口定义: Position BinarySearch( List L, ElementType X ); 其中List结构定义如下: typedef int Position; typedef struct LNode *List; struct LNode { E
阅读全文
摘要:本题要求给定二叉树的4种遍历。 函数接口定义: void InorderTraversal( BinTree BT ); void PreorderTraversal( BinTree BT ); void PostorderTraversal( BinTree BT ); void Levelor
阅读全文
摘要:本题要求给定二叉树的高度。 函数接口定义: int GetHeight( BinTree BT ); 其中BinTree结构定义如下: typedef struct TNode *Position; typedef Position BinTree; struct TNode{ ElementTyp
阅读全文
摘要:本题要求在一个数组中实现两个堆栈。 函数接口定义: Stack CreateStack( int MaxSize );bool Push( Stack S, ElementType X, int Tag );ElementType Pop( Stack S, int Tag ); 其中Tag是堆栈编
阅读全文
摘要:本题要求实现带头结点的链式表操作集。 函数接口定义: List MakeEmpty(); Position Find( List L, ElementType X ); bool Insert( List L, ElementType X, Position P ); bool Delete( Li
阅读全文
摘要:本题要求实现链式表的操作集。 函数接口定义: Position Find( List L, ElementType X ); List Insert( List L, ElementType X, Position P ); List Delete( List L, Position P ); 其中
阅读全文
摘要:本题要求实现一个函数,找到并返回链式表的第K个元素。 函数接口定义: ElementType FindKth( List L, int K ); 其中List结构定义如下: typedef struct LNode *PtrToLNode; struct LNode { ElementType Da
阅读全文
摘要:本题要求实现一个函数,求链式表的表长。 函数接口定义: int Length( List L ); 其中List结构定义如下: typedef struct LNode *PtrToLNode; struct LNode { ElementType Data; PtrToLNode Next; };
阅读全文
摘要:6-2 顺序表操作集 本题要求实现顺序表的操作集 函数接口定义: List MakeEmpty(); Position Find( List L, ElementType X ); bool Insert( List L, ElementType X, Position P ); bool Dele
阅读全文
摘要:6-1 单链表逆转 本题要求实现一个函数,将给定的单链表逆转。 函数接口定义: List Reverse( List L ); 其中List结构定义如下: typedef struct Node *PtrToNode; struct Node { ElementType Data; /* 存储结点数
阅读全文