自定义博客皮肤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

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

原创 LeetCode(1277):统计全为 1 的正方形子矩阵 Count Square Submatrices with All Ones(Java)

2019.12.29 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel原地动态规划。遍历每一个位置ij时,将该位的数值置为从该位起左边的1的总个数,例如对于矩阵 [0,1,1,1], [1,1,1,1], [0,1,1,1]遍历结束后效果为: [0,1,2,3], ...

2019-12-29 12:34:41 635

原创 LeetCode(1179):重新格式化部门表 Reformat Department Table(SQL)

2019.12.27 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:重新格式化部门表部门表 Department:+---------------+---------+| Column Name | Type |+---------------+---------...

2019-12-27 21:51:15 562

原创 LeetCode(120):三角形最小路径和 Triangle(Java)

2019.12.22 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel自底向上的动态规划。建立dp数组,dp[j]代表当前层j位置的最小路径和,对于每一层i,自底向上有动态转移方程:dp[j] = triangle.get(i - 1).get(j) + Math.min(dp[j], d...

2019-12-22 15:16:11 234

原创 LeetCode(627):交换工资 Swap Salary(SQL)

2019.12.21 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:交换工资给定一个 salary 表,如下所示,有 m = 男性 和 f = 女性 的值。交换所有的 f 和 m 值(例如,将所有 f 值更改为 m,反之亦然)。要求只使用一个更新(Update)语句,并且没有中间...

2019-12-21 18:05:01 179

原创 LeetCode(60):第k个排列 Permutation Sequence(Java)

2019.12.19 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel之前有做过两道排列相关的题目:LeetCode(46):全排列 Permutations(Java)LeetCode(31):下一个排列 Next Permutation(Java)但是,单纯依靠之前的全排列方法做出...

2019-12-19 09:47:00 240

原创 LeetCode(1114):按序打印 Print in Order(JUC)

2019.12.17 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:按序打印Suppose we have a class:public class Foo { public void first() { print("first"); } public void se...

2019-12-17 19:55:44 250

原创 LeetCode(197):上升的温度 Rising Temperature(SQL)

2019.12.15 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:上升的温度给定一个 Weather 表,编写一个 SQL 查询,来查找与之前(昨天的)日期相比温度更高的所有日期的 Id。+---------+------------------+--------------...

2019-12-15 12:32:21 394

原创 LeetCode(196):删除重复的电子邮箱 Delete Duplicate Emails(SQL)

2019.12.11 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:删除重复的电子邮箱编写一个 SQL 查询,来删除 Person 表中所有重复的电子邮箱,重复的邮箱里只保留 Id 最小 的那个。+----+------------------+| Id | Email ...

2019-12-11 13:54:01 248

原创 LeetCode(183):从不订购的客户 Customers Who Never Order(SQL)

2019.12.10 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:从不订购的客户某网站包含两个表,Customers 表和 Orders 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。Customers 表:+----+-------+| Id | Name...

2019-12-10 14:15:18 137

原创 LeetCode(1268):搜索推荐系统 Search Suggestions System(Java)

2019.12.9 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel这是参加的第二场周赛。本题很直接可以想到前缀树+DFS的思路,不过要注意一点神坑:测试用例的字典中可能包含重复的单词。应对这点,只需要在字典树结点中加上条件count用于统计相同单词的出现次数即可。也可以不直接建树,先将...

2019-12-09 20:35:19 728

原创 LeetCode(182):查找重复的电子邮箱 Duplicate Emails(SQL)

2019.12.8 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:查找重复的电子邮箱编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱。示例:+----+---------+| Id | Email |+----+---------+| 1 | a...

2019-12-08 12:03:48 209

原创 LeetCode(93):复原IP地址 Restore IP Addresses(Java)

2019.12.6 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel递归方法在本题上比较高效,也很容易想到。还可以依靠动态规划的思路。建立dp数组,dp[i]代表截至第i位字符串能够组成的地址集合。对于第i位上的地址集合,可以遍历前三位j,状态转移方程为:dp[i] += dp[j] +...

2019-12-06 20:18:25 172

原创 LeetCode(176):第二高的薪水 Second Highest Salary(SQL)

2019.12.3 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel传送门:第二高的薪水编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Salary) 。+----+--------+| Id | Salary |+----+--------+| 1 | 100...

2019-12-03 19:59:03 145

原创 LeetCode(77):组合 Combinations(Java)

2019.12.1 LeetCode 从零单刷个人笔记整理(持续更新)github:https://github.com/ChopinXBP/LeetCode-Babel这题可以很容易想到用剪枝回溯法求解,不过还有一种字典序的思路:1.将数字序列nums初始化为[1…k, n+1],一共k+1个元素,最后一位n+1用于作为哨兵。2.循环将nums从最小排列[1…k, n+1]更新至最大排...

2019-12-01 12:22:20 218

阿里技术年度精选合集

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

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关注的人

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