Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions Week 01/id_451/LeetCode_26_451.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
func removeDuplicates(nums []int) int {
var pre, j int
for i, n := range nums {
if i == 0 {
pre = n
j = 1
continue
}
if n == pre {
continue
}

pre = n
nums[j] = n
j++
}
return j
}

23 changes: 23 additions & 0 deletions Week 01/id_451/LeetCode_88_451.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
func merge(nums1 []int, m int, nums2 []int, n int) {
var i, j, k int
nums3 := make([]int, n+m)
if m == 0 || n == 0 {
copy(nums1, nums2)
return
}
for {
if k == n+m {
break
}
if j >= n || (nums1[i] < nums2[j] && i < m) {
nums3[k] = nums1[i]
k++
i++
continue
}
nums3[k] = nums2[j]
k++
j++
}
copy(nums1, nums3)
}
12 changes: 11 additions & 1 deletion Week 01/id_451/NOTE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# NOTE
# 学习笔记
# LRU 缓存
通过hash表+链表实现
通过hash表进行查找,通过双链表实现有序。
# 跳跃表
查询复杂度log(n) 插入删除复杂度log(n)
通过插入时随机选择level
# 优先队列
抽象的数据结构,复杂度跟实现有关。(二叉堆)
# 代码点评
通过学习256 同学的代码,学习到了合并有序数组此题的优化方法,(从尾端向前遍历,减少空间复杂度)



9 changes: 8 additions & 1 deletion Week 预习周/id_451/NOTE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# NOTE


# 学习方法
用脑图整理知识点
五遍刷题法
leetcode 上通过国际战查看国际讨论

# 时间复杂度分析
主定理
根据n的值推断执行次数

1 change: 1 addition & 0 deletions Week 预习周/id_451/算法和数据结构1.km
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":{"data":{"id":"bxo1ako3r8g0","created":1570933059491,"text":"算法和数据结构"},"children":[{"data":{"id":"bxo1b5lr11k0","created":1570933105061,"text":"算法"},"children":[{"data":{"id":"bxo1gijx2fs0","created":1570933525070,"text":"动态规划"},"children":[]},{"data":{"id":"bxo1gmlukoo0","created":1570933533893,"text":"贪心"},"children":[]},{"data":{"id":"bxo1gphn8mw0","created":1570933540170,"text":"图论"},"children":[{"data":{"id":"bxo1h4oru000","created":1570933573252,"text":"最短路"},"children":[]},{"data":{"id":"bxo1h80z4sw0","created":1570933580521,"text":"最小生成树"},"children":[]},{"data":{"id":"bxo1hdsy1xc0","created":1570933593097,"text":"拓扑排序"},"children":[]}]},{"data":{"id":"bxo1huwflv40","created":1570933630312,"text":"遍历"},"children":[{"data":{"id":"bxo1i0epcs00","created":1570933642301,"text":"深度优先"},"children":[]},{"data":{"id":"bxo1i7utco00","created":1570933658512,"text":"广度优先"},"children":[]}]},{"data":{"id":"bxo1idg69ps0","created":1570933670688,"text":"排序"},"children":[{"data":{"id":"bxo1ikaxwr40","created":1570933685609,"text":"快速排序"},"children":[]},{"data":{"id":"bxo1inm3huo0","created":1570933692814,"text":"归并排序"},"children":[]},{"data":{"id":"bxo1it3sebs0","created":1570933704767,"text":"堆排序"},"children":[]}]}]},{"data":{"id":"bxo1b9bwr600","created":1570933113174,"text":"数据结构"},"children":[{"data":{"id":"bxo1bkrnl6w0","created":1570933138070,"text":"数组"},"children":[]},{"data":{"id":"bxo1br4v7l40","created":1570933151930,"text":"哈希表"},"children":[]},{"data":{"id":"bxo1bum0m7k0","created":1570933159497,"text":"链表"},"children":[]},{"data":{"id":"bxo1car68iw0","created":1570933194637,"text":"栈"},"children":[]},{"data":{"id":"bxo1chc8qlc0","created":1570933208972,"text":"二叉树"},"children":[{"data":{"id":"bxo1ctcly000","created":1570933235116,"text":"堆"},"children":[]},{"data":{"id":"bxo1g4n1uq80","created":1570933494785,"text":"avl树"},"children":[]},{"data":{"id":"bxo1g9yslyw0","created":1570933506378,"text":"红黑树"},"children":[]}]},{"data":{"id":"bxo1d4mozg80","created":1570933259670,"text":"图"},"children":[]}]}]},"template":"default","theme":"fresh-blue","version":"1.4.43"}