liuzhch1

2022年9月10日 #

LeetCode_29. 两数相除Divide Two Integers|商的二进制表示与除数的关系

摘要: Original Link: 29. Divide Two Integers Problem description Given two integers: dividend and divisor, return dividend/divisor without using multiplicat 阅读全文

posted @ 2022-09-10 11:06 liuzhch1 阅读(21) 评论(0) 推荐(0) 编辑

2022年8月5日 #

LeetCode 899.有序队列|字符串最小表示法的使用|求循环字符串的最小值

摘要: 一个字符串可以循环移动,头部的字符不断移到尾部,什么时候这个字符串最小?使用最小表示法可以在O(N)的复杂度内迅速找到答案。 如果可以任选字符串头部中多个字符中的一个放在末尾呢?为什么答案总是按字母排序? 阅读全文

posted @ 2022-08-05 18:47 liuzhch1 阅读(31) 评论(0) 推荐(0) 编辑

2022年7月12日 #

更快的排序——归并排序!基于分而治之的对数复杂度的排序Merge Sort

摘要: 运用Divide and Conquer分而治之思想的归并排序,比插入排序更快,达到了n·lg(n)的时间复杂度。当需要排序的子列比较小时,采用插排来提高速度、减少递归层数。 阅读全文

posted @ 2022-07-12 17:15 liuzhch1 阅读(57) 评论(0) 推荐(0) 编辑

2022年7月7日 #

排序起步!Insertion Sort&Bubble Sort: 插排和冒牌排序、冒泡排序优化

摘要: 从Insertion Sort插入排序和Bubble Sort冒泡排序开始Sorting的旅程~ 插排的swap交换优化,冒泡排序的swap优化、有序终止、更新区间以及Bubbling Up和Sinking Down双发。即便冒泡这么多优化方法,并且时间复杂度也和插排一样,但在实际测速中还是远逊于插入排序的。 阅读全文

posted @ 2022-07-07 22:24 liuzhch1 阅读(65) 评论(0) 推荐(0) 编辑

2022年6月28日 #

LeetCode 907: 子数组的最小值之和-单调栈的运用 |Sum of Subarray Minimums-Fantasy use of Monotonic Stack

摘要: #单调栈 的运用。类似于LeetCode84. 柱状图中最大的矩形。使用单调递增栈找到左右两边第一个更小的元素。本题的转换步骤稍复杂。所有子序列形成的集合等于每个元素为做子序列的最小值的这样的子序列的集合的并集。 阅读全文

posted @ 2022-06-28 21:09 liuzhch1 阅读(36) 评论(0) 推荐(0) 编辑

2022年6月26日 #

LeetCode 726: 原子的数量-栈和Map的结合以及字符串处理 | Number of Atoms-Combination of stack, map and string processing

摘要: 力扣726-原子的数量,主要考察了对栈的熟练运用,将Map作为栈内元素,对化学式进行解析。并包含了对字符串的处理,是道好题。 阅读全文

posted @ 2022-06-26 17:14 liuzhch1 阅读(11) 评论(0) 推荐(0) 编辑

2022年6月22日 #

LeetCode 155最小栈: 无额外占用空间-储存差值 |Min Stack with No extra space-Store as Difference

摘要: In Min Stack problem, usually we need another stack to store each min value. But we can store the difference between min value and the pushing value. So one minValue var can construct the whole origin stack. 阅读全文

posted @ 2022-06-22 22:36 liuzhch1 阅读(41) 评论(0) 推荐(0) 编辑

2022年5月8日 #

Stack栈详解 图解 引入到LinkedList和Array实现、均摊时间分析| Stack ADT details, intro to implementation and amortized time analysis with figures.

摘要: Stack ADT(abstract data type) Introduction of Stack Normally, mathematics is written using what we call in-fix notation: \((3+4)\times 5-6\) Any opera 阅读全文

posted @ 2022-05-08 19:27 liuzhch1 阅读(37) 评论(0) 推荐(0) 编辑

2022年4月28日 #

并查集详解 图解引入到实现| Disjoint Sets details, intro to implementation with figures.

摘要: 并查集详解 图解引入到实现| Disjoint Sets details, intro to implementation with figures. 以“认亲戚、找祖先”作为并查集(Disjoint Sets)的引入。图解了 find 和 set_union 的操作。分析了复杂度,并使用路径压缩做优化。 阅读全文

posted @ 2022-04-28 14:17 liuzhch1 阅读(34) 评论(0) 推荐(0) 编辑

2022年4月26日 #

LeetCode 416.分割等和子集 | 类0-1背包问题 | 解题思路及代码

摘要: Partition Equal Subset Sum Problem Description Given a nonempty array nums, which only contains positive number. Find if the array can be divided into 阅读全文

posted @ 2022-04-26 22:48 liuzhch1 阅读(28) 评论(0) 推荐(0) 编辑

导航