自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

CodeMonkey

记录小白成长

  • 博客(64)
  • 收藏
  • 关注

原创 代码片段和声明标识的区别

<%%> 代码片段的语法格式:<% Java代码或是脚本代码 %> <%!%> 声明标识的语法格式:<%! 声明变量或方法的代码 %> 区别:通过声明标识创建的变量和方法在当前JSP页面中有效,它的生命周期是从创建开始到服务器关闭结束;代码片段创建的变量和方法,也是在当前jsp页面中有效,但它的生命周期是页面关闭后就会被销毁。 ...

2019-11-07 11:43:49 840

原创 7-5 Tree Traversals Again (25 分)

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac...

2019-04-29 20:10:50 825

原创 7-1 Maximum Subsequence Sum (25 分)

Given a sequence ofKintegers {N​1​​,N​2​​, ...,N​K​​}. A continuous subsequence is defined to be {N​i​​,N​i+1​​, ...,N​j​​} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequen...

2019-04-22 15:29:31 426

原创 LeetCode547. 朋友圈 并查集

班上有N名学生。其中有些人是朋友,有些则不是。他们的友谊具有是传递性。如果已知 A 是 B的朋友,B 是 C的朋友,那么我们可以认为 A 也是 C的朋友。所谓的朋友圈,是指所有朋友的集合。 给定一个N * N的矩阵M,表示班级中学生之间的朋友关系。如果M[i][j] = 1,表示已知第 i 个和 j 个学生互为朋友关系,否则为不知道。你必须输出所有学生中的已知的朋友圈总数。 示...

2019-04-08 11:27:53 362

原创 数据库回顾

CREATE DATABASE kcdb ON PRIMARY (NAME = 'kcdb_data', FILENAME = '\\vmware-host\Shared Folders\桌面\kcdb_data.mdf', SIZE = 5MB, MAXSIZE = 500MB, FILEGROWTH = 10%) LOG ON (NAME = 'kcdb_log', FILENAME = '...

2019-03-04 22:47:42 922

原创 6-1 邻接矩阵存储图的深度优先遍历 (20 分)

试实现邻接矩阵存储图的深度优先遍历。 函数接口定义: void DFS( MGraph Graph, Vertex V, void (*Visit)(Vertex) ); 其中MGraph是邻接矩阵存储的图,定义如下: typedef struct GNode *PtrToGNode; struct GNode{ int Nv; /* 顶点数 */ int Ne; ...

2018-12-19 17:20:16 5293

原创 6-2 图的深度遍历-邻接表实现 (10 分)

本题要求实现邻接表存储图的深度优先遍历。 函数接口定义: void DFS(ALGraph *G,int i); 其中ALGraph是邻接表存储的图,定义如下: #define MAX_VERTEX_NUM 10 /*定义最大顶点数*/ typedef int Vertex; typedef struct ArcNode{ /*表结点*/ int adjv...

2018-12-19 17:19:32 10282 1

原创 6-3 邻接表存储图的广度优先遍历 (20 分)

试实现邻接表存储图的广度优先遍历。 函数接口定义: void BFS ( LGraph Graph, Vertex S, void (*Visit)(Vertex) ); 其中LGraph是邻接表存储的图,定义如下: /* 邻接点的定义 */ typedef struct AdjVNode *PtrToAdjVNode; struct AdjVNode{ Vertex Ad...

2018-12-19 17:18:47 3327

原创 7-12 抢红包 (25 分)

没有人没抢过红包吧…… 这里给出N个人之间互相发红包、抢红包的记录,请你统计一下他们抢红包的收获。 输入格式: 输入第一行给出一个正整数N(≤10​4​​),即参与发红包和抢红包的总人数,则这些人从1到N编号。随后N行,第i行给出编号为i的人发红包的记录,格式如下: KN​1​​P​1​​⋯N​K​​P​K​​ 其中K(0≤K≤20)是发出去的红包个数,N​i​​是抢到红包的人的编号,P​...

2018-12-15 20:50:26 754

原创 7-10 PAT排名汇总 (25 分)

计算机程序设计能力考试(Programming Ability Test,简称PAT)旨在通过统一组织的在线考试及自动评测方法客观地评判考生的算法设计与程序设计实现能力,科学的评价计算机程序设计人才,为企业选拔人才提供参考标准(网址http://www.patest.cn)。 每次考试会在若干个不同的考点同时举行,每个考点用局域网,产生本考点的成绩。考试结束后,各个考点的成绩将即刻汇总成一张总的...

2018-12-15 20:10:33 1480 1

原创 7-2 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 element from the input data,...

2018-12-14 19:03:00 616

原创 6-2 Iterative Mergesort (25 分)

How would you implement mergesort without using recursion? The idea of iterative mergesort is to start from N sorted sublists of length 1, and each time to merge a pair of adjacent sublists until one...

2018-12-13 23:10:27 2792

原创 6-5 No Greater Than X in BST (20 分)

6-5 No Greater Than X in BST (20 分) You are supposed to output, in decreasing order, all the elements no greater than X in a binary search tree T. Format of function: void Print_NGT( Tree T, int ...

2018-12-10 15:02:57 1080

原创 7-2 字符串关键字的散列映射 (25 分)

7-2 字符串关键字的散列映射 (25 分) 给定一系列由大写英文字母组成的字符串关键字和素数P,用移位法定义的散列函数H(Key)将关键字Key中的最后3个字符映射为整数,每个字符占5位;再用除留余数法将整数映射到长度为P的散列表中。例如将字符串AZDEG插入长度为1009的散列表中,我们首先将26个大写英文字母顺序映射到整数0~25;再通过移位将其映射为3×32​2​​+4×32+6=320...

2018-12-10 15:01:32 1805

原创 6-3 AVL Insertion (30 分)

You are supposed to implement the Insert function, which inserts an integer Key into an AVL tree T. The resulting tree must be returned. Format of function: AVLTree Insert ( AVLTree T, int Key ); ...

2018-12-10 14:51:03 3054 4

原创 6-2 LCA in BST (25 分)

The lowest common ancestor (LCA) of two nodes u and v in a tree T is the deepest node that has both u and v as descendants. Given any two nodes in a binary search tree (BST), you are supposed to find ...

2018-12-10 14:39:07 455

原创 6-8 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 );...

2018-12-03 19:39:07 1619

原创 6-9 Sort Three Distinct Keys (20 分)

Suppose you have an array of N elements, containing three distinct keys, "true", "false", and "maybe". Given an O(N) algorithm to rearrange the list so that all "false" elements precede "maybe" elemen...

2018-12-03 19:37:45 2167

原创 数据库实验六

-- 1. 用函数实现:求某个专业选修了某门课程的学生人数, --并调用函数求出计算机系“数据库”课程的选课人数。 create function num_course_dept(@dept as char(2),@cname as char(10)) returns int as BEGIN declare @num INT select @num=count(*) from sc,stude...

2018-12-01 15:13:04 10964

原创 数据库实验五

--1.创建新的SQL SERVER登录账号,登录名为usersf,密码为123。 sp_addlogin 'usersf','123' --2.为student数据库新建用户u1,其登录名为usersf。 use student sp_adduser 'usersf','u1' --3. 将对sc表的select,update 权限授予给用户u1,并验证u1的权限 grant select...

2018-12-01 15:12:28 2312

原创 数据库实验四

--一、对xsgl数据库完成下列操作要求: --1.将被全部学生都选修了的课程的总学分改为4学分。 update kc set kc.学分=4 where kc.课程号 in ( select cj.课程号 from cj group by cj.课程号 having count(cj.课程号)=( select count(xs.学号) from xs ) ) updat...

2018-12-01 15:11:50 5505

原创 数据库实验二

/*对xs表增加身份证号码属性列,要求是18位的字符类型*/ alter table xs add 身份证号码 char(18) /*通过生日计算年龄*/ select *,DATEDIFF(yy,CONVERT(varchar(10),CAST(SUBSTRING(xs.身份证号码,7,8) AS datetime),120),GETDATE()) 年龄 from xs; /*显示不同专业...

2018-12-01 15:11:16 993 2

原创 触发器作业

--在xs表插入平均成绩一列,使用触发器实现如果一个学生一门课登记成绩了,自动计算平均成绩并保存到xs表的对应平均成绩列中。 alter table xs add 平均成绩 float create trigger tg on cj for insert as update xs set xs.平均成绩=( select avg(cj.成绩) from cj,inserted ...

2018-12-01 15:10:01 1215

原创 数据库实验七

--1. 将stu数据库中student表的sno定义为主键; alter table student add constraint pk_sno primary key(sno) --2. 将数据库stu的表course的cno字段定义为主键,约束名称为cno_pk; alter table course add constraint cno_pk primary key(cno) --3...

2018-12-01 15:09:27 10837

原创 7-2 List Leaves (25 分)

  Given a tree, you are supposed to list all the leaves in the order of top down, and left to right. Input Specification: Each input file contains one test case. For each case, the first line gives...

2018-11-24 15:38:47 595

原创 7-1 树的同构 (25 分)

给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。     图1 图2 现给定两棵树,请你判断它们是否是同构的。   输入格式: 输入给出2棵二叉树树的信息。对于每棵树,首先在一行中给出一个非负整数N (≤...

2018-11-22 17:41:49 800

原创 数据库实验三

--(一)以数据库系统实验1中student数据库为基础,请使用T-SQL 语句实现进行以下操作: --1. 查询以‘DB_’开头,且倒数第3个字符为‘s’的课程的详细情况 select * from course where Cname like 'DB\_%s__' --2. 查询名字中第2个字为‘阳’的学生姓名和学号及选修的课程号、课程名 select Sname,student.Sno...

2018-11-02 20:20:17 7623 4

原创 习题1.9 有序数组的插入 (20 分)

bool Insert( List L, ElementType X ){ if(L-&gt;Last+1==MAXSIZE) return false; for (int i=0; i&lt;=L-&gt;Last; i++) { if(L-&gt;Data[i]==X) return false; els...

2018-10-28 14:42:14 8748

原创 习题2.3 数列求和-加强版 (20 分)

习题2.3 数列求和-加强版 (20 分) 给定某数字A(1≤A≤9)以及非负整数N(0≤N≤100000),求数列之和S=A+AA+AAA+⋯+AA⋯A(N个A)。例如A=1, N=3时,S=1+11+111=123。 输入格式: 输入数字A与非负整数N。 输出格式: 输出其N项数列之和S的值。 输入样例: 1 3 输出样例: 123   #include &lt...

2018-10-24 15:15:13 4101 16

原创 hdu 2393

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int T=sc.nextInt(); for(int k=0;k&lt;T;...

2018-10-23 21:19:31 190

原创 hdu 2500

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int n=sc.nextInt(); for(int i=0;i&lt;n;i+...

2018-10-23 21:18:48 194

原创 hdu 2502

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int T; T=sc.nextInt(); for(int k=0;k&...

2018-10-23 21:18:13 179

原创 hdu 2560

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); int T; int m,n; while(sc.hasNext()) { T=sc.nextInt(); while(...

2018-10-23 21:17:23 220

原创 hdu 2566

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int N = sc.nextInt(); for(int k=0;k&lt;N;...

2018-10-23 21:16:28 219

原创 hdu 2708

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=0; int[] word=new int[72]; int[] space=new int[72]; while(s...

2018-10-23 21:15:33 366

原创 hdu 2710

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(sc.hasNext()) { int n=sc.nextInt(); int[] input = new int...

2018-10-23 21:14:42 228

原创 hdu 1039

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()) { String str=sc.next(); if(str.equals("end"))...

2018-10-23 21:13:49 174

原创 hdu 1002

import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc= new Scanner(System.in); BigInteger a,b; while(sc.hasNext()) { ...

2018-10-23 21:12:53 107

原创 6-1 Evaluate Postfix Expression (25 分)

6-1 Evaluate Postfix Expression (25 分) Write a program to evaluate a postfix expression. You only have to handle four kinds of operators: +, -, x, and /. Format of functions: ElementType EvalPostf...

2018-10-23 18:45:44 3941

原创 7-1 Pop Sequence (25 分)

7-1 Pop Sequence (25 分) Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a p...

2018-10-22 16:30:49 1971

空空如也

空空如也

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

TA关注的人

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