自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

NJU_ChopinXBP的博客

https://github.com/ChopinXBP

  • 博客(8)
  • 资源 (22)
  • 收藏
  • 关注

原创 LeetCode(263 & 264):丑数 I II Ugly Number I II(Java)

2020.12.30 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 丑数I只需要验证是否为丑数即可,直接将其除净即可。丑数II要求返回指定顺位的丑数,可以采用归并的思想。 用三指针指向下一个需要乘n(n=2/3/5)进行拓展的数字,相当于做一个三路归并。 找出三个指针的最小元素,将指针后移。如果有多组指针的当前值都是min,指针都需要后移,保证 ugly 数组中不会加入重复元素。 传送门:丑数 W

2020-12-30 17:48:35 136

原创 LeetCode(262):行程和用户 Trips and Users(SQL)

2020.12.29 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 传送门:行程和用户 Trips 表中存所有出租车的行程信息。每段行程有唯一键 Id,Client_Id 和 Driver_Id 是 Users 表中 Users_Id 的外键。Status 是枚举类型,枚举成员为 (‘completed’, ‘cancelled_by_driver’, ‘cancelled_by_client’)。

2020-12-29 17:41:31 184

原创 LeetCode(258):各位相加 Add Digits(Java)

2020.12.27 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 智力题 规律很简单:数字为0时,结果为0;数字为9的倍数时,结果为9;其他情况下为除以9的余数。 假设输入的数字是一个5位数字num,则num的各位分别为a、b、c、d、e。 有如下关系:num = a * 10000 + b * 1000 + c * 100 + d * 10 + e 即:num = (a + b + c + d

2020-12-27 20:49:53 154

原创 LeetCode(1292):元素和小于等于阈值的正方形的最大边长 Maximum Side Length of a Square(Java)

2020.12.24 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 原地动态规划 + 前缀和。 遍历每一个位置ij时,将该位的数值置为从该位起左边的1的总个数,例如对于矩阵 [1,1,3,2], [1,1,4,3], [1,2,4,2] 遍历结束后效果为: [1,2,5,7], [1,2,6,9], [1,3,7,9] 为了统计正方形矩阵的面积,可以假定当前位置ij为正方

2020-12-24 16:12:52 188 1

原创 LeetCode(185):部门工资前三高的所有员工 Department Top Three Salaries(SQL)

2020.12.23 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 传送门:部门工资前三高的所有员工 Employee 表包含所有员工信息,每个员工有其对应的工号 Id,姓名 Name,工资 Salary 和部门编号 DepartmentId 。 +----+-------+--------+--------------+ | Id | Name | Salary | DepartmentId |

2020-12-23 19:32:37 227

原创 LeetCode(168):Excel表列名称 Excel Sheet Column Title(Java)

2020.12.21 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 这题实质上是移位进制转换问题。 xi*26^(i-1) + … + x3*26^2 + x2*26^1 + x1*26^0 = n 每次num=n%26可以取出最低位的xi=num,n/=26可以去掉最低位的xi. 但题目每个位的范围是1-26,而不是0-25。因此当num==26时需要进行修正,将n-1是使n不满足26的倍数,再

2020-12-21 16:17:20 176

原创 LeetCode(626):换座位 Exchange Seats(SQL)

2020.12.20 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 传送门:换座位 小美是一所中学的信息科技老师,她有一张 seat 座位表,平时用来储存学生名字和与他们相对应的座位 id。 其中纵列的 id 是连续递增的 小美想改变相邻俩学生的座位。 你能不能帮她写一个 SQL query 来输出小美想要的结果呢? 示例: +---------+---------+ | id | stu

2020-12-20 19:40:56 187

原创 LeetCode(1226):哲学家进餐 The Dining Philosophers(JUC)

2020.12.19 LeetCode 从零单刷个人笔记整理(持续更新) github:https://github.com/ChopinXBP/LeetCode-Babel 传送门:哲学家进餐 Five silent philosophers sit at a round table with bowls of spaghetti. Forks are placed between each pair of adjacent philosophers. Each philosopher must alt

2020-12-19 20:35:46 475 1

阿里技术年度精选合集

阿里技术年度精选合集,分上下两册《阿里技术年度精选(上)》、《阿里技术年度精选(下)》。

2018-07-31

2019程序员互联网公司最新面经(包含腾讯、百度、阿里等)

2019程序员互联网公司最新面经(包含腾讯、百度、阿里等)

2018-07-31

陈越、何钦铭-数据结构作业17:Huffman Codes哈夫曼编码

In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in the history of computer science. As a professor who gives the final exam problem on Huffman codes, I am encountering a big problem: the Huffman codes are NOT unique. For example, given a string "aaaxuaxz", we can observe that the frequencies of the characters 'a', 'x', 'u' and 'z' are 4, 2, 1 and 1, respectively. We may either encode the symbols as {'a'=0, 'x'=10, 'u'=110, 'z'=111}, or in another way as {'a'=1, 'x'=01, 'u'=001, 'z'=000}, both compress the string into 14 bits. Another set of code can be given as {'a'=0, 'x'=11, 'u'=100, 'z'=101}, but {'a'=0, 'x'=01, 'u'=011, 'z'=001} is NOT correct since "aaaxuaxz" and "aazuaxax" can both be decoded from the code 00001011001001. The students are submitting all kinds of codes, and I need a computer program to help me determine which ones are correct and which ones are not.

2018-05-17

陈越、何钦铭-数据结构作业16:Complete Binary Search Tree完全二叉搜索树

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys greater than or equal to the node's key. Both the left and right subtrees must also be binary search trees. A Complete Binary Tree (CBT) is a tree that is completely filled, with the possible exception of the bottom level, which is filled from left to right. Now given a sequence of distinct non-negative integer keys, a unique BST can be constructed if it is required that the tree must also be a CBT. You are supposed to output the level order traversal sequence of this BST.

2018-05-16

陈越、何钦铭-数据结构作业15:File Transfer并查集

We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to send a file from any computer on the network to any other?

2018-05-16

陈越、何钦铭-数据结构作业14:堆中的路径

将一系列给定数字插入一个初始为空的小顶堆H[]。随后对任意给定的下标i,打印从H[i]到根结点的路径。

2018-05-03

陈越、何钦铭-数据结构作业13:Root of AVL Tree平衡二叉树的根节点

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this property. Figures 1-4 illustrate the rotation rules.Now given a sequence of insertions, you are supposed to tell the root of the resulting AVL tree.

2018-05-03

陈越、何钦铭-数据结构作业12:是否同一棵二叉搜索树

给定一个插入序列就可以唯一确定一棵二叉搜索树。然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到。例如分别按照序列{2, 1, 3}和{2, 3, 1}插入初始为空的二叉搜索树,都得到一样的结果。于是对于输入的各种插入序列,你需要判断它们是否能生成一样的二叉搜索树。

2018-04-20

陈越、何钦铭-数据结构作业11:Tree Traversals Again二叉树非递归遍历/栈遍历

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 stack operations are: push(1); push(2); push(3); pop(); pop(); push(4); pop(); pop(); push(5); push(6); pop(); pop(). Then a unique binary tree (shown in Figure 1) can be generated from this sequence of operations. Your task is to give the postorder traversal sequence of this tree.

2018-04-18

陈越、何钦铭-数据结构作业10:List Leaves层次遍历叶节点

Given a tree, you are supposed to list all the leaves in the order of top down, and left to right.

2018-04-09

陈越、何钦铭-数据结构作业9:树的同构

给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。现给定两棵树,请你判断它们是否是同构的。

2018-04-04

陈越、何钦铭-数据结构作业8:二叉搜索树的操作集

函数Insert将X插入二叉搜索树BST并返回结果树的根结点指针; 函数Delete将X从二叉搜索树BST中删除,并返回结果树的根结点指针;如果X不在树中,则打印一行Not Found并返回原树的根结点指针; 函数Find在二叉搜索树BST中找到X,返回该结点的指针;如果找不到则返回空指针; 函数FindMin返回二叉搜索树BST中最小元结点的指针; 函数FindMax返回二叉搜索树BST中最大元结点的指针。

2018-03-28

陈越、何钦铭-数据结构作业7:Pop Sequence出栈序列检验

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 possible pop sequence of the stack. For example, if M is 5 and N is 7, we can obtain 1, 2, 3, 4, 5, 6, 7 from the stack, but not 3, 2, 1, 7, 5, 6, 4.

2018-03-27

陈越、何钦铭-数据结构作业6:Reversing Linked List链表翻转

Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K=3, then you must output 3→2→1→6→5→4; if K=4, you must output 4→3→2→1→5→6.

2018-03-26

陈越、何钦铭-数据结构作业5:一元多项式的乘法与加法运算

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

2018-03-20

陈越、何钦铭-数据结构作业4:在线查找算法求最大子列和,并返回最大子列和头尾元素

The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with the largest sum being 20. Now you are supposed to find the largest sum, together with the first and the last numbers of the maximum subsequence.

2018-03-18

陈越、何钦铭-数据结构作业3:分治算法求最大子列和

“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子列{ 11, -4, 13 }有最大的和20。现要求你编写程序,计算给定整数序列的最大子列和。

2018-03-18

陈越、何钦铭-数据结构作业3:在线查找算法求最大子列和

“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子列{ 11, -4, 13 }有最大的和20。现要求你编写程序,计算给定整数序列的最大子列和。

2018-03-17

陈越、何钦铭-数据结构作业2:顺序链表合并

本题要求实现一个函数,将两个链表表示的递增整数序列合并为一个非递减的整数序列。L1和L2是给定的带头结点的单链表,其结点存储的数据是递增有序的;函数Merge要将L1和L2合并为一个非递减的整数序列。应直接使用原序列中的结点,返回归并后的带头结点的链表头指针。

2018-03-15

陈越、何钦铭-数据结构作业1:二分查找算法

L是用户传入的一个线性表,其中ElementType元素可以通过>、==、<进行比较,并且题目保证传入的数据是递增有序的。函数BinarySearch要查找X在Data中的位置,即数组下标(注意:元素从下标1开始存储)。找到则返回下标,否则返回一个特殊的失败标记NotFound。

2018-03-15

《C程序设计语言(第二版)》(中文)

《C程序设计语言(第二版)》(中文) (美)Brain W.Kernighan,Dennis M.Ritchie著 徐宝文 等翻译 机械工业出版社

2015-07-19

20套大学计算机C语言期末考试复习试题及答案

2010年20套大学计算机C语言期末考试复习试题及答案

2015-07-19

空空如也

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

TA关注的人

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