- 博客(60)
- 资源 (25)
- 收藏
- 关注
原创 梁力《程序设计与C语言》_第七章 结构体【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-12-27 11:45:01
267
原创 西交考研915宝典 C语言题库
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>u...
2019-12-27 11:39:25
1039
原创 梁力《程序设计与C语言》_第三章 控制语句【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-12-27 11:39:10
318
原创 梁力《程序设计与C语言》_第四章 数组【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-12-27 11:38:55
220
原创 梁力《程序设计与C语言》_第六章 指针【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-12-27 11:38:42
189
原创 梁力《程序设计与C语言》_第五章 函数【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-12-27 11:38:24
200
原创 19版考研数据结构王道课后习题代码-树 下【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-10-09 09:38:41
250
原创 19版考研数据结构王道课后习题代码-线性表【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-10-07 15:05:32
336
原创 19版考研数据结构王道课后习题代码-栈和队列【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-10-07 14:08:40
302
原创 19版考研数据结构王道课后习题代码-树 上【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-09-30 12:18:56
320
原创 梁力《程序设计与C语言》_第一章 程序设计基础【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>u...
2019-09-18 15:10:54
654
原创 19版考研数据结构王道课后习题代码-图【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-09-18 14:26:40
471
原创 19版考研数据结构王道课后习题代码-查找【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-09-17 11:48:30
489
原创 19版考研数据结构王道课后习题代码-排序【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-09-16 23:36:09
424
原创 18版考研数据结构天勤课后习题代码-查找【完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>u...
2019-09-11 14:18:31
329
原创 18版考研数据结构天勤课后习题代码-排序【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>u...
2019-09-11 10:52:05
229
原创 18版考研数据结构天勤课后习题代码-图【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>u...
2019-09-10 14:01:09
398
原创 18版考研数据结构天勤课后习题代码-二叉树 重难点代码
1、区分insert函数构造二叉排序树、由中后序构造树、由先序构造满二叉树的区别insert函数构造二叉排序树:是一个节点一个节点插入由中后序构造树、由先序构造满二叉树:通过递归把一个数组构建成一棵树/*//查找值为key的节点 天勤P140 例6-3BiTree *insert(BiTree *&root,char ch){ if(root==NULL...
2019-09-10 09:56:24
365
原创 18版考研数据结构天勤课后习题代码-二叉树【未完】
#include <iostream>#include <stdio.h>#include <cstdio>#include <string>#include <string.h>#include <math.h>#include <algorithm>#include <stack>...
2019-09-09 12:28:49
229
原创 18版考研数据结构天勤课后习题代码-数组、矩阵与广义表【完】
#include <iostream>using namespace std;#define maxSize 101/*//把非零元素移动到数组前端 天勤P122(二)1void Remove(int a[],int n){ int i=0,j=n-1; while(i<j) { while(i<j&&...
2019-09-08 21:22:32
313
原创 18版考研数据结构天勤课后习题代码-串【完】
#include <iostream>using namespace std;#define maxSize 101typedef struct String{ char data[maxSize]; int length;}String;/*//把值为ch1的字符替换为ch2 天勤P103 二 1(1)void Replace(String &...
2019-09-08 13:16:24
299
原创 18版考研数据结构天勤课后习题代码-线性表【完】
#include <iostream>using namespace std;#define maxSize 101//顺序表插入元素 天勤P26 例2-1/*typedef struct Sqlist{int data[maxSize];int length;};void insert(Sqlist &s,int x){int cnt=...
2019-09-07 12:52:36
345
原创 18版考研数据结构天勤课后习题代码-栈和队列【完】
#include <iostream>using namespace std;#define maxSize 101//括号匹配 天勤P61 例3-1/*char data[101];int top=-1;int match(char exp[],int n){ for(int i=0;i<n;i++) { if(exp[i]==...
2019-09-06 14:09:02
338
原创 A-B
//// main.cpp// DataStructure//// Created by 刘子琪 on 2019/8/26.// Copyright © 2019年 Maze. All rights reserved.//#include <iostream>using namespace std;typedef struct LNode{ int...
2019-08-26 10:47:41
487
原创 【打印】顺时针打印矩阵
目描述输入一个矩阵,按照从外向里以顺时针的顺序依次打印出每一个数字,例如,如果输入如下4 X 4矩阵: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 则依次打印出数字1,2,3,4,8,12,16,15,14,13,9,5,6,7,11,10.在代码中包含多个循环,需要判断多个边界条件!!打印第一圈的左上角的坐标是(1,1),第二圈的左上角的坐标是(2,...
2019-03-17 13:30:39
145
原创 【栈】包含min函数的栈
题目描述定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1))。仅添加一个成员变量存放最小元素是不够的,也就是说最小元素被弹出栈时,我们希望能够得到次小元素。因此需要一个辅助栈存放每次压栈后的最小值。class Solution {public: stack<int>s1,s2; //s1存储栈内数据,s2存储每次压栈...
2019-03-16 21:57:15
106
原创 【树】二叉树的镜像(递归)、树的子结构(递归)难、从上往下打印二叉树(层次遍历)、二叉搜索树的后序遍历序列(递归)难、二叉树的深度(递归)
题目描述操作给定的二叉树,将其变换为源二叉树的镜像。输入描述:二叉树的镜像定义:源二叉树 8 / \ 6 10 / \ / \ 5 7 9 11 镜像二叉树 8 / \ 10 6 / \ / \ 11 9 7 5...
2019-03-16 20:54:46
215
原创 【位运算】二进制中1的个数
题目描述输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。把一个整数减去1,再和原整数做与运算,会把整数最右边的一个1变成0,那么一个整数的二进制表示中有多少个1,就可以进行多少次这样的操作。class Solution {public: int NumberOf1(int n) { int cnt=0; while(n)...
2019-03-15 15:07:20
118
原创 牛客 剑 二维数组中的查找、重建二叉树(前中建树)、【链表】合并两个排序的链表(递归)、【数组】和为S的两个数字、【字符串】左旋转字符串(递归)、【树】把二叉树打印成多行(层数的处理)
题目描述在一个二维数组中(每个一维数组的长度相同),每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。思路:在如下矩阵中找7,从右上角的9开始找,因为9>7,剔除9这一列,分析剩下3列;因为8>7,剔除8这一列;因为2<7,剔除2这一行向下寻找;因为4<7,剔除4这一行...
2019-03-14 17:33:39
252
原创 【找规律】乙1049
1049 数列的片段和 (20 分)给定一个正数数列,我们可以从中截取任意的连续的几个数,称为片段。例如,给定数列 { 0.1, 0.2, 0.3, 0.4 },我们有 (0.1) (0.1, 0.2) (0.1, 0.2, 0.3) (0.1, 0.2, 0.3, 0.4) (0.2) (0.2, 0.3) (0.2, 0.3, 0.4) (0.3) (0.3, 0.4) (0.4) 这 1...
2019-02-27 17:59:13
205
原创 【递归】2的幂次方、变态跳台阶、牛 矩形覆盖
题目描述 Every positive number can be presented by the exponential form.For example, 137 = 2^7 + 2^3 + 2^0。 Let's present a^b by the form a(b).Then 137 is presented by 2(7)+2(3)+2(0). Since 7 = 2...
2019-02-27 10:27:44
208
原创 牛客 计算表达式【非栈的方式】
对于一个不存在括号的表达式进行计算输入描述:存在多种数据,每组数据一行,表达式不存在空格输出描述:输出结果示例1输入复制6/2+3+3*4输出复制18#include <stdio.h>#include <cstdio>#include <string>#include <string.h&...
2019-02-24 14:40:16
145
原创 牛客 全排列【调用函数】
题目描述给定一个由不同的小写字母组成的字符串,输出这个字符串的所有全排列。 我们假设对于小写字母有'a' < 'b' < ... < 'y' < 'z',而且给定的字符串中的字母已经按照从小到大的顺序排列。输入描述:输入只有一行,是一个由不同的小写字母组成的字符串,已知字符串的长度在1到6之间。输出描述:输出这个字符串的所有排列方式,每行一个排列。要...
2019-02-23 10:17:46
172
原创 【快速幂】牛客 求root(N,k)
题目描述 N<k时,root(N,k) = N,否则,root(N,k) = root(N',k)。N'为N的k进制表示的各位数字之和。输入x,y,k,输出root(x^y,k)的值 (这里^为乘方,不是异或),2=<k<=16,0<x,y<2000000000,有一半的测试点里 x^y 会溢出int的范围(>=2000000000) 输入描述:...
2019-02-22 18:12:51
260
原创 【树】建树遍历 甲1102【找根节点】、1115 Counting Nodes in a BST(数一层的节点数)
1102 Invert a Binary Tree (25 分)The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so...
2019-02-16 15:28:43
282
1
原创 【巧思】甲1093
1093 Count PAT's (25 分)The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and ...
2019-02-13 17:40:10
115
原创 【排序】PAT甲1089
1089 Insert or Merge (25 分)According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one...
2019-02-12 20:40:34
201
原创 【数学类】牛客 整数拆分、【大数】N的阶乘、大整数的因子、a+b、大整数排序
题目描述一个整数总可以拆分为2的幂的和,例如: 7=1+2+4 7=1+2+2+2 7=1+1+1+4 7=1+1+1+2+2 7=1+1+1+1+1+2 7=1+1+1+1+1+1+1 总共有六种不同的拆分方式。 再比如:4可以拆分成:4 = 4,4 = 1 + 1 + 1 + 1,4 = 2 + 2,4=1+1+2。 用f(n)表示n的不同拆分的种数,例如f(7)=6. 要求编写程序,读入...
2019-02-12 20:13:23
317
原创 【位操作】牛客 位操作练习
题目描述给出两个不大于65535的非负整数,判断其中一个的16位二进制表示形式,是否能由另一个的16位二进制表示形式经过循环左移若干位而得到。 循环左移和普通左移的区别在于:最左边的那一位经过循环左移一位后就会被移到最右边去。比如: 1011 0000 0000 0001 经过循环左移一位后,变成 0110 0000 0000 0011, 若是循环左移2位,则变成 1100 0000 0000...
2019-02-12 20:06:55
224
原创 【日期类】牛客 今年的第几天、日期差值、打印日期
题目描述输入年、月、日,计算该天是本年的第几天。输入描述:包括三个整数年(1<=Y<=3000)、月(1<=M<=12)、日(1<=D<=31)。输出描述:输入可能有多组测试数据,对于每一组测试数据,输出一个整数,代表Input中的年、月、日对应本年的第几天。示例1输入复制1990 9 202000 5 1输出复制...
2019-02-12 20:01:53
275
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人