資專報告[0]

Square root algorithms

顧名思義:\(\Omicron(\sqrt n)\)

區間和及修改

  • \(BIT\)
  • \(Segment  Tree\)

Modify:\(\Omicron(logn)\)

Query:\(\Omicron(logn)\)

6 9 17 22 13 14 7 19 11
32 49 37

Modify:\(\Omicron(1)\)

Query:\(\Omicron(\sqrt n)\)

事實上

可以分成\(k\)塊,每塊\(\frac{n}{k}\)個數

為了平衡選擇\(k=\frac{n}{k}=\sqrt n\)

因此若每次查詢範圍較大,可考慮減少k

Combining Algorithm

Case Processing

Made with Slides.com