自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 雨课堂 项目管理 期末答案

项目管理答案

2024-01-03 13:41:14 891

原创 第三章总结

算法第三章总结实战训练动态规划算法通常用于求解具有某种最有性质的问题。适用动态规划策略解决的问题具有以下3个性质:1.最优化原理,也称最优子结构:如果问题的最优解包含的子问题的解也是最优的,就称该问题具有最优子结构,既满足最优化原理。2.无后向性,即某阶段一旦确定,就不受这个状态以后决策的影响。也就是说,某状态以后的过程不会影响以前的状态,只与当前状态有关,这种特性被称为无后向性。3.重叠子问题;即子问题之间是不独立的,一个子问题在下一阶段决策中可能被多次使用。对有分解过程的问题还表现在;自顶向下

2021-11-02 19:48:53 419

原创 算法第二章思维导图

算法第二章思维导图//真没有被迫营业//FFT解决大数乘法#include<cmath>#include<cstdio>#include<vector>#include<queue>#include<cstring>#include<iomanip>#include<stdlib.h>#include<iostream>#include<algorithm>#define l

2021-10-11 23:37:07 214

原创 数据结构,代码填空

本函数的功能是从有N个元素的线性表A中查找第K小的元素。函数的初始调用为Qselect(A, K, 0, N-1)。请完成下列填空。ElementType Qselect( ElementType A[], int K, int Left, int Right ){ ElementType Pivot = A[Left]; int L = Left, R = Right+1; while (1) { while ( A[++L] < Pivot ) ;

2021-04-27 16:46:18 2461

原创 数据结构 编程题7.1

7-1 一元多项式的乘法与加法运算 (20分)设计函数分别求两个一元多项式的乘积与和。输入格式:输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。输出格式:输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空格分隔,但结尾不能有多余空格。零多项式应输出0 0。输入样例:4 3 4 -5 2 6 1 -2 03 5 20 -7 4 3 1输出样例:1

2020-12-23 20:24:11 193

原创 数据结构 函数题6.20

6-20 No Less Than X in BST (20分)You are supposed to output, in decreasing order, all the elements no less than X in a binary search tree T.Format of function:void Print_NLT( Tree T, int X );where Tree is defined as the following:typedef struct Tre

2020-12-22 15:38:12 131

原创 数据结构 函数题6.19

6-19 Count Connected Components (20分)Write a function to count the number of connected components in a given graph.Format of functions:int CountConnectedComponents( LGraph Graph );where LGraph is defined as the following:typedef struct AdjVNode *Pt

2020-12-22 15:35:18 196

原创 数据结构函数题6.18

6-18 Two Stacks In One Array (20分)Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.Format of functions:Stack CreateStack( int MaxElements );int IsEmp

2020-12-22 14:55:05 79

原创 数据结构 函数题 6.17

6-17 Shortest Path [2] (25分)Write a program to find the weighted shortest distances from any vertex to a given source vertex in a digraph. It is guaranteed that all the weights are positive.Format of functions:void ShortestDist( MGraph Graph, int dist[

2020-12-22 14:41:56 96

原创 数据结构 函数题6.16

6-16 Topological Sort (25分)Write a program to find the topological order in a digraph.Format of functions:bool TopSort( LGraph Graph, Vertex TopOrder[] );where LGraph is defined as the following:typedef struct AdjVNode *PtrToAdjVNode;struct AdjVNo

2020-12-22 14:15:32 126

原创 数据结构 函数题6.15

6-15 求单链表结点的阶乘和 (15分)本题要求实现一个函数,求单链表L结点的阶乘和。这里默认所有结点的值非负,且题目保证结果在int范围内。函数接口定义:int FactorialSum( List L );其中单链表List的定义如下:typedef struct Node PtrToNode;struct Node {int Data; / 存储结点数据 /PtrToNode Next; / 指向下一个结点的指针 /};typedef PtrToNode List; / 定

2020-12-22 13:15:40 75

原创 数据结构 函数题6.14

6-14 Add Two Polynomials (20分)Write a function to add two polynomials. Do not destroy the input. Use a linked list implementation with a dummy head node. Note: The zero polynomial is represented by an empty list with only the dummy head node.Format of fu

2020-12-21 17:09:58 215

原创 数据结构 函数题6.13

6-13 Percolate Up and Down (20分)Write the routines to do a “percolate up” and a “percolate down” in a binary min-heap.Format of functions:void PercolateUp( int p, PriorityQueue H );void PercolateDown( int p, PriorityQueue H );where int p is the po

2020-12-19 09:06:39 158 1

原创 数据结构 函数题6.12

6-12 二叉搜索树的操作集 (30分)本题要求实现给定二叉搜索树的5种常用操作。函数接口定义:BinTree Insert( BinTree BST, ElementType X );BinTree Delete( BinTree BST, ElementType X );Position Find( BinTree BST, ElementType X );Position FindMin( BinTree BST );Position FindMax( BinTree BST );

2020-12-07 17:16:09 84

原创 数据结构 函数题6.11

6-11 Level-order Traversal (25分)Write a routine to list out the nodes of a binary tree in “level-order”. List the root, then nodes at depth 1, followed by nodes at depth 2, and so on. You must do this in linear time.Format of functions:void Level_ord

2020-12-07 16:52:41 173

原创 数据结构 函数题6.10

6-10 二叉树的遍历 (25分)本题要求给定二叉树的4种遍历。函数定义接口void InorderTraversal( BinTree BT );void PreorderTraversal( BinTree BT );void PostorderTraversal( BinTree BT );void LevelorderTraversal( BinTree BT );裁判测试程序样例:#include <stdio.h>#include <stdlib.h&

2020-12-02 19:07:58 74

原创 数据结构 函数题6.9

#6-9 求二叉树高度 (20分)本题要求给定二叉树的高度。函数接口定义:int GetHeight( BinTree BT );其中BinTree结构定义如下:typedef struct TNode *Position;typedef Position BinTree;struct TNode{ElementType Data;BinTree Left;BinTree Right;};要求函数返回给定二叉树BT的高度值。裁判测试程序样例:#include <stdio

2020-11-28 15:41:28 123

原创 数据结构 函数题6.8

#6-8 先序输出叶结点 (15分)本题要求按照先序遍历的顺序输出给定二叉树的叶结点。函数接口定义:void PreorderPrintLeaves( BinTree BT );其中BinTree结构定义如下:typedef struct TNode *Position;typedef Position BinTree;struct TNode{ElementType Data;BinTree Left;BinTree Right;};裁判测试程序样例:#include &

2020-11-23 16:57:49 132

原创 数据结构 函数题6.7

#6-7 Deque (25分)A “deque” is a data structure consisting of a list of items, on which the following operations are possible:Push(X,D): Insert item X on the front end of deque D.Pop(D): Remove the front item from deque D and return it.Inject(X,D): Ins

2020-11-19 08:07:35 148

原创 数据结构 函数题6.6

#6-6 带头结点的链式表操作集 (20分)本题要求实现带头结点的链式表操作集。函数接口定义:List MakeEmpty();Position Find( List L, ElementType X );bool Insert( List L, ElementType X, Position P );bool Delete( List L, Position P );List MakeEmpty(){ List L=(List)malloc(sizeof(struct LNode

2020-11-17 15:21:29 153

原创 数据结构 函数题6.5

#6-5 链式表操作集 (20分)本题要求实现链式表的操作集。函数接口定义:Position Find( List L, ElementType X );List Insert( List L, ElementType X, Position P );List Delete( List L, Position P );Position Find( List L, ElementType X ){ while(L) { if(L->Data==X) return L;

2020-11-17 15:05:29 119

原创 数据结构 函数题 6.4

#6-4 链式表的按序号查找 (10分)本题要求实现一个函数,找到并返回链式表的第K个元素。函数接口定义:ElementType FindKth( List L, int K );ElementType FindKth( List L, int K ){ int cnt=1; while(L) { if(cnt==K) return L->Data; cnt++; L=L->Next; } return ERROR;}...

2020-11-17 15:03:39 75

原创 数据结构 函数题6.3

#6-3 求链式表的表长 (10分)本题要求实现一个函数,求链式表的表长。函数接口定义:int Length( List L );int Length( List L ){ int cnt=0; while(L!=NULL) { cnt++; L=L->Next; } return cnt;}

2020-11-17 15:02:24 60

原创 数据结构 函数题6.2

#6-2 顺序表操作集 (20分)本题要求实现顺序表的操作集。函数接口定义:List MakeEmpty();Position Find( List L, ElementType X );bool Insert( List L, ElementType X, Position P );bool Delete( List L, Position P );List MakeEmpty(){ List l=(List)malloc(sizeof(struct LNode)); l->

2020-11-17 15:01:11 134

原创 数据结构 函数题6.1

#6-1 单链表逆转 (20分)本题要求实现一个函数,将给定的单链表逆转。函数接口定义:List Reverse( List L );List Reverse( List L ){ List l,t; t=NULL; l=NULL; while(L) { t=L->Next; L->Next=l; l=L; L=t; } return l;}...

2020-11-17 14:58:32 43

空空如也

空空如也

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

TA关注的人

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