Skip to content
This repository was archived by the owner on May 22, 2026. It is now read-only.

Commit f229dbe

Browse files
chore
1 parent 67b0788 commit f229dbe

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

search/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
- [x] C
2424
- [x] Python
25-
- [x] Haskell
25+
- [x] Haskell(特にメリットはない)
2626

2727
---
2828

@@ -34,10 +34,22 @@
3434
- 配列を半分にわけて,ピボットを基準にターゲットとなる値が左右のどちらにあるか探索する。
3535
- 計算効率は、1 ステップごとに探索対象が半分になっていく。これは 2 進数においては 1 桁減ることを表しているので計算量は O(log2 n)と表せる。
3636

37+
#### 実装例
38+
39+
- [x] C
40+
- [x] Python
41+
- [x] Haskell
42+
3743
### 関数を満たす最大/最小の値を二分探索で探す
3844

3945
- 二分探索を使い、関数f(x)がピボットに対してTrueかFalseかを判定することで、関数f(x)を満たす最大/最小のxの範囲を探索できる。
4046

47+
#### 実装例
48+
49+
- [ ] C
50+
- [ ] Python
51+
- [x] Haskell
52+
4153
---
4254

4355
## BST(Binary Search Tree)

search/bst/bst.hs

Whitespace-only changes.

search/linear_search/linearSearchSentinelLoop.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-- 高級言語の場合はやっても分岐の数は減らないので意味がない。
12
linearSearch :: [Int] -> Int -> Int
23
linearSearch xs target =
34
let xs' = xs ++ [target] -- 番兵を追加

0 commit comments

Comments
 (0)