ADA 4.3
Closest Pair of Points
經典問題: 最近點對
Learn More →
兩個以上的點 座標範圍皆定義於第一象限(+,+)
輸出為最距離最接近的兩個點 aka smallest d(Pi,Pj)
Learn More →
簡化問題 降維思考
如上面的Case 如果目前L-min = 10 R-min = 13
我們其實只要從中線往左右去找10的距離去檢查點就可以了
Learn More →
已經限縮了X軸在2δ 範圍
從Y軸來考慮 我們要找的答案如果希望<δ 那他們必定在同一個δ的範圍內
Learn More →
由前面的δ去定義 一個block內不可能會出現第二個點
複雜度由n/2*n/2下降到8
Learn More →
Learn More →
定義BaseCase
先sort X 才能切開
找出左右兩側最靠近的Pair
開始解析Cross-Regions Case
將不在範圍內的點去除
依照Y軸排序
計算每一個點對於自身距離與其他8個block的距離
Learn More →
Learn More →
Learn More →
具備能夠將問題簡化然後解決的性質
能夠重新利用已經回傳的答案並Combined
要去檢視複雜度的重要性 -> 真的比暴力解省時間嗎
階段一:閱讀官方文件
May 2, 2024260. Single Number III Question Given an integer array <mark>nums</mark>, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. You can return the answer in any order. You must write an algorithm that runs in linear runtime complexity and uses only constant extra space. Hand in homework before Saturday. :::success Roger的作業 xander的作業
Jun 14, 2023Why we care? 算力不是免費的。 本課程作業速度不到標準,也會被退件。 名詞定義 Definition 1. Problem 問題 會有明確的Input與Output Ex. 冠軍問題
Jun 2, 2023使用markdown 協作筆記
May 31, 2023or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up