@mitsuharu/vivliostyle-theme-iosdc-pamphlet 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/default.md +55 -7
- package/example/images/bubble-sort.png +0 -0
- package/package.json +2 -2
- package/theme.css +4 -1
- package/vivliostyle.config.js +5 -1
package/example/default.md
CHANGED
|
@@ -1,16 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# バブルソートの説明
|
|
2
2
|
|
|
3
3
|
<div class="author-info">
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
サンプルたろう(株式会社????)<BR />
|
|
5
|
+
𝕏: @????<BR />
|
|
6
|
+
Bluesky: @????.bsky.social
|
|
6
7
|
</div>
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
バブルソートは、隣接する要素を比較して並べ替える簡単なソートアルゴリズムです。初学者にも分かりやすいように、Swift のコードと一緒にイラストと表を使って説明します。[^ChatGPT]
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
[^ChatGPT]: この文章と画像は ChatGPT で書きました
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## バブルソートのイラスト
|
|
14
|
+
|
|
15
|
+
次のイラストは、バブルソートの過程を示しています。
|
|
16
|
+
|
|
17
|
+
{width=300}
|
|
18
|
+
|
|
19
|
+
1. **初期状態**: ソートされていない配列が並んでいる
|
|
20
|
+
2. **比較と交換**: 隣接する要素を比較し、必要に応じて交換する
|
|
21
|
+
3. **最終状態**: 配列がソートされた状態になる
|
|
22
|
+
|
|
23
|
+
## Swiftでのバブルソートのコード
|
|
13
24
|
|
|
14
25
|
```swift
|
|
15
|
-
|
|
26
|
+
func bubbleSort(_ array: inout [Int]) {
|
|
27
|
+
let n = array.count
|
|
28
|
+
for i in 0..<n {
|
|
29
|
+
for j in 0..<n-i-1 {
|
|
30
|
+
if array[j] > array[j+1] {
|
|
31
|
+
let temp = array[j]
|
|
32
|
+
array[j] = array[j+1]
|
|
33
|
+
array[j+1] = temp
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var numbers = [64, 34, 25, 12, 22, 11, 90]
|
|
40
|
+
bubbleSort(&numbers)
|
|
41
|
+
print("Sorted array: \(numbers)")
|
|
16
42
|
```
|
|
43
|
+
|
|
44
|
+
### コードの説明
|
|
45
|
+
|
|
46
|
+
1. **関数宣言**: `bubbleSort`関数は、整数の配列を受け取り、インデックスでアクセスして要素を並べ替える
|
|
47
|
+
2. **外側のループ**: 配列全体を繰り返し処理する
|
|
48
|
+
3. **内側のループ**: 隣接する要素を比較し、順番が逆であれば交換する
|
|
49
|
+
4. **交換処理**: 要素を一時変数に保存し、隣接する要素と入れ替る
|
|
50
|
+
|
|
51
|
+
## バブルソートの過程を示す表
|
|
52
|
+
|
|
53
|
+
| イテレーション | 配列の状態 | 比較された要素 | 交換された要素 |
|
|
54
|
+
|--------------|--------------------|-------------------|-------------|
|
|
55
|
+
| 初期状態 | [64, 34, 25, 12, 22, 11, 90] | - | - |
|
|
56
|
+
| 1 | [34, 25, 12, 22, 11, 64, 90] | 64と34, 34と25, ... | 64と34 |
|
|
57
|
+
| 2 | [25, 12, 22, 11, 34, 64, 90] | 34と25, 25と12, ... | 34と25 |
|
|
58
|
+
| 3 | [12, 22, 11, 25, 34, 64, 90] | 25と12, 22と11, ... | 25と12 |
|
|
59
|
+
| ... | ... | ... | ... |
|
|
60
|
+
| 最終状態 | [11, 12, 22, 25, 34, 64, 90] | - | - |
|
|
61
|
+
|
|
62
|
+
この表は、各イテレーションごとに配列の状態がどのように変化するかを示しています。各ステップで、隣接する要素を比較し、必要に応じて交換することで、配列が徐々にソートされていきます。
|
|
63
|
+
|
|
64
|
+
バブルソートは、シンプルなアルゴリズムですが、大規模なデータセットには効率的ではないため、学習目的や小規模なデータセットでの使用に適しています。
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mitsuharu/vivliostyle-theme-iosdc-pamphlet",
|
|
3
|
-
"description": "It is vivliostyle
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"description": "It is vivliostyle theme for iOSDC Japan pamphlet",
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"author": "Mitsuharu Emoto <mthr1982@gmail.com>",
|
|
6
6
|
"main": "theme.css",
|
|
7
7
|
"scripts": {
|
package/theme.css
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
@
|
|
1
|
+
@import url(../@vivliostyle/theme-base/theme-all.css);
|
|
2
|
+
@import url(../@vivliostyle/theme-base/css/lib/prism/base.css);
|
|
3
|
+
@import url(../@vivliostyle/theme-base/css/lib/prism/theme-okaidia.css);
|
|
4
|
+
@import url(../@vivliostyle/theme-techbook/theme.css);
|
|
2
5
|
|
|
3
6
|
code[class*=language-],
|
|
4
7
|
pre[class*=language-] {
|
package/vivliostyle.config.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
language: 'ja',
|
|
3
|
-
theme: [
|
|
3
|
+
theme: [
|
|
4
|
+
'node_modules/@vivliostyle/theme-base',
|
|
5
|
+
'node_modules/@vivliostyle/theme-techbook',
|
|
6
|
+
'.',
|
|
7
|
+
],
|
|
4
8
|
entry: ['example/default.md'],
|
|
5
9
|
workspaceDir: '.vivliostyle',
|
|
6
10
|
output: [
|