Skip to content

Commit

Permalink
add some docs
Browse files Browse the repository at this point in the history
close #9
  • Loading branch information
idat50me committed May 5, 2024
1 parent a835d7c commit c8f47da
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 7 deletions.
21 changes: 21 additions & 0 deletions graph/docs/dijkstra.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

---
title: Dijkstra(経路復元付ダイクストラ)
documentation_of: ../dijkstra.cpp
---

## なにこれ
始点 $s$ から各頂点までの最短距離および最短経路を求める.

## コンストラクタ
- `dijkstra(path, cost, s)`:隣接リスト `path`,各辺の重み `cost`,始点 `s` の無向グラフに対しダイクストラ法を適用する.

## メンバ関数
- `operator[](idx)`:始点 $s$ から頂点 $\mathrm{idx}$ までの最短距離を返す.
- `get_path(t)`:始点 $s$ から頂点 $t$ までの最短経路を返す.

## 計算量
頂点数を $n$,辺数を $m$ とする.
- コンストラクタ:$O((n+m)\log n)$
- `operator[](idx)`:$O(1)$
- `get_path(t)`:$O(n)$
3 changes: 0 additions & 3 deletions math/binpow.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#pragma once
/*
* @brief Binary-Power(繰り返し二乗法)
*/

#ifndef call_include
#define call_include
Expand Down
4 changes: 0 additions & 4 deletions math/divisor.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
#pragma once
/*
* @brief Divisor(約数列挙)
*/

#ifndef call_include
#define call_include
#include <bits/stdc++.h>
using namespace std;
#endif


vector<long long> divisor(long long x) {
vector<long long> res = {1};
long long i = 2, id = 0, sz;
Expand Down
5 changes: 5 additions & 0 deletions math/docs/binpow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Binary-Power(繰り返し二乗法)
documentation_of: ../binpow.cpp
---

5 changes: 5 additions & 0 deletions math/docs/divisor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Divisor(約数列挙)
documentation_of: ../divisor.cpp
---

14 changes: 14 additions & 0 deletions math/docs/inversion_number.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Inversion-Number(転倒数)
documentation_of: ../inversion_number.cpp
---

## なにこれ
配列 $v$ の転倒数を求める.

## 関数
- inv_count(v):配列 `v` の転倒数を返す.

## 計算量
配列 $v$ の要素数を $n$ とする.
- $O(n \log n)$
16 changes: 16 additions & 0 deletions math/docs/primefact.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Prime-Factorization(素因数分解)
documentation_of: ../primefact.cpp
---

## なにこれ
素因数分解をする.

## 関数
- `primefact(x)`
`x` を素因数分解した結果を `vector<pair>` で返す.
各要素について,`first` に素因数,`second` に冪指数を格納する.
`x` が $1$ 以下の場合,空の配列を返す.

## 計算量
- $O(\sqrt x)$

0 comments on commit c8f47da

Please sign in to comment.