随笔分类 - 考研王道
摘要:#include <iostream> //考研初始只需要完成setPartition即可 int setPartition(int a[],int n) { int pivotkey,low=0,low0 = 0,high=n-1,high0=n-1,flag=1,k=n/2,i; int s1=
阅读全文
摘要:Description 读取10个整型数据12 63 58 95 41 35 65 0 38 44,然后通过归并排序,对该组数据进行排序,输出有序结果,每个数的输出占3个空格 Input 12 63 58 95 41 35 65 0 38 44 Output 0 12 35 38 41 44 58
阅读全文
摘要:读取10个整型数据12 63 58 95 41 35 65 0 38 44,然后通过选择排序,堆排序,分别对该组数据进行排序,输出2次有序结果,每个数的输出占3个空格 #include <stdio.h> #include <stdlib.h> #include <time.h> #include
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #define N 7 typedef int ElemType; void Merge(ElemType A[],int low,int mid,int high) { static ElemType B[N]; //加
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string> typedef int ElemType; typedef struct { ElemType *elem; //存储元素的起始地址 int Tabl
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string> typedef int ElemType; typedef struct { ElemType *elem; //存储元素的起始地址 int Tabl
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string> typedef int ElemType; typedef struct { ElemType *elem; //存储元素的起始地址 int Tabl
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string> typedef int ElemType; typedef struct { ElemType *elem; //存储元素的起始地址 int Tabl
阅读全文
摘要:#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string> typedef int ElemType; typedef struct { ElemType *elem; //存储元素的起始地址 int Tabl
阅读全文
摘要:Description 读取10个元素 87 7 60 80 59 34 86 99 21 3,然后建立二叉查找树,中序遍历输出3 7 21 34 59 60 80 86 87 99,针对有序后的元素,存入一个长度为10的数组中,通过折半查找找到21的下标(下标为2),然后输出2 Input 标准输
阅读全文
摘要:#include <iostream> int MidSearch(int *A,int *B,int n) { //分别表示序列A和序列B的首位数,末位数和中位数,s是start简写,d是end简写 int s1=0, d1 = n - 1, m1, s2 = 0, d2 = n - 1, m2;
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef int KeyType; typedef struct BSTNode{ KeyType key; struct BSTNode *lchild,*rchild; }BSTNode,*BiTree; //非递归
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> typedef int KeyType; typedef struct BSTNode{ KeyType key; struct BSTNode *lchild,*rchild; }BSTNode,*BiTree; //非递归
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #include<time.h> typedef int ElemType; typedef struct { ElemType* elem; //整型指针 int TableLen; //存储动态数组里边元素的个数 }SST
阅读全文
摘要:#include<stdio.h> #include<stdlib.h> #include<time.h> typedef int ElemType; typedef struct { ElemType *elem; //整型指针,申请的堆空间的起始地址存入elem int TableLen; //
阅读全文
摘要:Description 读取字符串abcdefghij,然后层次建树建立一颗二叉树,然后前序遍历输出abdhiejcfg,注意不要打印前序遍历几个汉字 Input abcdefghij Output abdhiejcfg Sample Input 1 abcdefghij Sample Output
阅读全文
摘要:function.h // // Created by 93757 on 2023/3/21. // #ifndef INC_1_TREE_FUNCTION_H #define INC_1_TREE_FUNCTION_H #include <stdio.h> #include <stdlib.h>
阅读全文
摘要:function.h // // Created by 93757 on 2023/3/21. // #ifndef INC_1_TREE_FUNCTION_H #define INC_1_TREE_FUNCTION_H #include <stdio.h> #include <stdlib.h>
阅读全文
摘要:#include <iostream> #include <stdlib.h> typedef int elemtype; typedef struct link_node{ elemtype data; struct link_node *next; }link_node; typedef str
阅读全文
摘要:function函数 // // Created by 93757 on 2023/3/21. // #ifndef INC_1_TREE_FUNCTION_H #define INC_1_TREE_FUNCTION_H #include <stdio.h> #include <stdlib.h>
阅读全文