- 博客(42)
- 收藏
- 关注
原创 二叉树的前序、中序、后序非递归遍历
二叉树的数据结构如下:typedef struct TreeNode { int val; TreeNode* left; //左孩子 TreeNode* right; //右孩子 TreeNode(int x) : val(x), left(NULL), right(NULL) {}}; 对于前序遍历,遍历访问节点处理规则如下...
2019-03-04 12:37:48 304
原创 系统分析与设计 Final Report
PSP2.1统计表PSP2.1 Personal Software Process Stages Time(h) Planning 计划 3 Estimate 估计任务时间 3 Development 开发 149 Analysis 需求分析 3 Design Spec 生成设计文档 3 Design Review 设计复审 2 Coding Standard 代码...
2018-06-30 20:17:37 286
原创 系统分析与设计 Homework9
使用ECB实现make reservation 用例的详细设计(包含用例简介,顺序图,类图)make reservation系统的用例图如下:顺序图如下:类图如下:逻辑设计类图到实际项目框架的映射图如下:...
2018-06-30 00:33:39 264
原创 系统分析与设计 Homework8
软件架构与框架之间的区别与联系软件框架:面向某领域(包括业务领域,如ERP,和计算领域)的、可复用的“半成品”软件,它实现了该领域的共性部分,并提供一系列定义良好的可变点以保证灵活性和可扩展性。软件框架至少包含以下组成部分:一系列完成计算的模块,在此称为构件。构件之间的关系与交互机制。一系列可变点(也称热点,Hot-spots,或调整点)可变点的行为调整机制。框架:某种应用的半成品,即一组组件,供...
2018-06-03 21:37:09 265
原创 Leetcode 343. Integer Break
题目链接问题描述Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given n = 2,...
2018-05-16 14:00:41 132
原创 Leetcode 357. Count Numbers with Unique Digits
题目链接问题描述Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n.Example:Given n = 2, return 91. (The answer should be the total numbers in the range of 0 ≤ x <...
2018-05-16 13:34:52 179
原创 Leetcode 47. Permutations II
题目链接问题描述Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]解题思路与Leetcode 46类似,求一个数组的...
2018-05-14 15:01:17 183
原创 Leetcode 46. Permutations
题目链接问题描述Given a collection of distinct integers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]解题思路这是求一个数组的全排列。使用D...
2018-05-12 12:56:14 143
原创 Leetcode 40. Combination Sum II
题目链接问题描述Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.Each number in candidat...
2018-05-11 13:55:49 155
原创 Leetcode 39. Combination Sum
题目链接问题描述Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the candidate numbers sums to target.The same ...
2018-05-10 21:18:08 144
原创 Leetcode 34. Search for a Range
题目链接问题描述Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the order of O(log n).If...
2018-05-08 16:31:56 216
原创 系统分析与设计 Homework 6
1)使用 UML State Model建模对象: 参考 Asg_RH 文档, 对 Reservation/Order 对象建模。建模要求: 参考练习不能提供足够信息帮助你对订单对象建模,请参考现在 定旅馆 的旅游网站,尽可能分析围绕订单发生的各种情况,直到订单通过销售事件(柜台销售)结束订单。2)研究淘宝退货流程活动图,对退货业务对象状态建模...
2018-05-04 16:23:34 156
原创 Leetcode 33. Search in Rotated Sorted Array
题目链接问题描述Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If fo...
2018-05-03 10:55:19 125
原创 系统分析与设计 Homework 5
1、 领域建模a. 阅读 Asg_RH 文档,按用例构建领域模型。按 Task2 要求,请使用工具 UMLet,截图格式务必是 png 并控制尺寸说明:请不要受 PCMEF 层次结构影响。你需要识别实体(E)和 中介实体(M,也称状态实体)在单页面应用(如 vue)中,E 一般与数据库构建有关, M 一般与 store 模式 有关在 java web 应用中,E 一般与数据库构建有关, M 一般与...
2018-04-27 23:55:17 197
原创 Leetcode 31. Next Permutation
题目链接问题描述Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possible, it must rearrange it as the lowest poss...
2018-04-26 14:52:26 155
原创 Leetcode 338. Counting Bits
题目链接问题描述Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.Example:For num = 5...
2018-04-25 15:42:42 233
原创 系统分析与设计 Homework 4
用例建模1. 按照Asg_RH文档绘制用例图2. 这里我选择qunar网,绘制用例图如下:3. 创新的思路与方法让用户自己根据自己的需求使用产品;简化界面和操作,尽量避免复杂的流程4. 旅馆开发需求backlog业务建模1. 寻找酒店流程图2. ATM取款流程图3. 淘宝退款流程图用例文本编写Brief:优点:描述直观简洁,较容易理解缺点:缺乏细节,易致误解Casual:优点:相对较为简洁,比Br...
2018-04-23 00:06:03 226
原创 Android Studio 初步学习与配置
首先,在AS官网下载Android Studio的安装包,选择安装插件时勾选SDK和虚拟机。 然后一直next到选择安装路径,这里注意不要将AS安装到系统盘。 之后即可等待安装完成。 首次打开AS时需要选择相关配置,这里是第一次安装,选择了第二项。 之后会出现这个界面,这里选择standard选项。这样安装程序会自动完成SDK的配置等工作。 需要注意的是在下载SDK时电脑应该要处于科学上...
2018-04-15 21:41:06 336
原创 系统分析与设计 Homework 2
1. 简述瀑布模型、增量模型、螺旋模型(含原型方法)的优缺点。瀑布模型 优点:降低软件开发的复杂程度,提高软件开发透明性和开发过程的可管理性;强调在软件实现前必须进行分析和设计工作;以项目的阶段评审和文档控制为手段有效地对整个开发过程进行指导,保证了阶段之间的正确衔接,及时纠错,使产品符合质量要求。缺点:强调开发过程的线性顺序;缺乏灵活性;风控能力较弱;规定过多文档时会极大地增加工作量;如果仅凭文...
2018-03-22 23:59:55 167
原创 系统分析与设计 Homework 1
软件工程定义:将系统化的、规范的、可度量的方法应用于软件的开发、运行和维护,将工程化的方法应用于软件。 Software crisis:软件危机,即在软件开发以及维护过程中所遇到的一系列严重问题,这些问题可能导致软件产品的寿命缩短。因此NATO在1968年举办了首次软件工程学术会议,并提出了“软件工程”概念来界定软件开发所需相关知识。 COCOMO模型:建设性成本模型。这种模型使用一种基本的回归分...
2018-03-14 23:10:40 234
原创 Leetcode 154. Find Minimum in Rotated Sorted Array II
题目链接问题描述Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-time complexity? How and why?Suppose an array sorted in ascending order is rotated...
2018-03-14 19:05:30 144
原创 《算法概论》习题8.9
题目如下:证明: 可将顶点覆盖问题归约到碰撞集问题,顶点覆盖问题的目标是找到一个大小不超过b的点集合H,使得图中所有的边都至少与集合中的一个点关联,它是一个NP-完全问题。 设无向图G=(V,E),对于图中每一条边(Vm,Vn),设集合Si={Vm,Vn},最终得到|E|个集合。 这样即可将顶点覆盖问题归约到碰撞集问题: ① 若存在满足要求的集合H,它与
2018-01-06 00:11:01 435
原创 算法分析与设计——LeetCode Problem.538 Convert BST to Greater Tree
题目链接问题描述Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the orig
2017-12-29 12:23:02 254
原创 算法分析与设计——LeetCode Problem.213 House Robber II
题目链接问题描述After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this pl
2017-12-29 12:06:51 270
原创 算法分析与设计——LeetCode Problem.198 House Robber
题目链接问题描述You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of the
2017-12-29 12:01:29 273
原创 算法分析与设计——LeetCode Problem.17 Letter Combinations of a Phone Number
题目链接问题描述Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given be
2017-12-29 11:33:46 221
原创 算法分析与设计——LeetCode Problem.99 Recover Binary Search Tree
题目链接问题描述Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is pretty straight
2017-12-29 11:22:08 200
原创 算法分析与设计——LeetCode Problem.670 Maximum Swap
题目链接问题描述Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you could get.Example 1:Input: 2
2017-12-29 10:39:33 244
原创 算法分析与设计——LeetCode Problem.258 Add Digits
题目链接问题描述Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.For example:Given num = 38, the process is like: 3 + 8 = 11, 1 +
2017-12-29 10:27:36 293
原创 算法分析与设计——LeetCode Problem.12 Integer to Roman
题目链接问题描述Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.解题思路将1000,900,500,400,100,90,50,40,10,9,5,4,1与对应的罗马数字用ma
2017-12-29 10:17:51 193
原创 算法分析与设计——LeetCode Problem.64 Minimum Path Sum
题目链接问题描述Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move
2017-12-29 10:09:08 235
原创 算法分析与设计——LeetCode Problem.98 Validate Binary Search Tree
题目链接问题描述Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys les
2017-12-28 23:58:15 213
原创 算法分析与设计——LeetCode Problem.63 Unique Paths II
题目链接问题描述Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space is marked as 1 and
2017-12-28 23:36:45 290
原创 算法分析与设计——LeetCode Problem.62 Unique Paths
题目链接问题描述A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot
2017-12-28 23:11:16 259
原创 算法分析与设计——LeetCode Problem.18 4Sum
题目链接问题描述Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of targe
2017-12-28 22:58:01 344
原创 算法分析与设计——LeetCode Problem.16 3Sum Closest
题目链接问题描述Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each
2017-12-28 22:49:28 253
原创 算法分析与设计——LeetCode Problem.15 3Sum
题目链接问题描述Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note: The solut
2017-12-28 22:34:52 295
原创 算法分析与设计——LeetCode Problem.653 Two Sum IV - Input is a BST
题目链接问题描述Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.Example 1:Input:
2017-10-19 16:49:18 264
原创 算法分析与设计——LeetCode Problem.23 Merge k Sorted Lists
题目链接问题描述Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.解题思路比较容易想到的是将链表逐个进行合并,但是这样会超时。最后用到分治法,顺利通过。class Solution {
2017-10-19 16:33:03 225
原创 算法分析与设计——LeetCode Problem.3 Longest Substring Without Repeating Characters
题目链接问题描述Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "b
2017-10-06 21:36:26 329
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人