Skip to content

Commit 4b22e06

Browse files
authored
Upd Readmes (#145)
1 parent 72ded41 commit 4b22e06

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

src/test/kotlin/com/igorwojda/list/chunk/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Given a list and chunk size, divide the list into multiple sub lists where each
99
## Examples
1010

1111
```kotlin
12-
chunk([1, 2, 3, 4], 2) --> [[ 1, 2], [3, 4]]
12+
chunk([1, 2, 3, 4], 2) // [[ 1, 2], [3, 4]]
1313

14-
chunk([1, 2, 3, 4, 5], 2) --> [[ 1, 2], [3, 4], [5]]
14+
chunk([1, 2, 3, 4, 5], 2) // [[ 1, 2], [3, 4], [5]]
1515

16-
chunk([1, 2, 3, 4, 5, 6, 7, 8], 3) --> [[ 1, 2, 3], [4, 5, 6], [7, 8]]
16+
chunk([1, 2, 3, 4, 5, 6, 7, 8], 3) // [[ 1, 2, 3], [4, 5, 6], [7, 8]]
1717

18-
chunk([1, 2, 3, 4, 5], 4) --> [[ 1, 2, 3, 4], [5]]
18+
chunk([1, 2, 3, 4, 5], 4) // [[ 1, 2, 3, 4], [5]]
1919

20-
chunk([1, 2, 3, 4, 5], 10) --> [[ 1, 2, 3, 4, 5]]
20+
chunk([1, 2, 3, 4, 5], 10) // [[ 1, 2, 3, 4, 5]]
2121
```
2222

src/test/kotlin/com/igorwojda/list/sort/bubblesort/README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ Sort `[5, 1, 4, 2, 8]`
1919

2020
**First Pass**
2121
```kotlin
22-
[5, 1, 4, 2, 8] -> [1, 5, 4, 2, 8] Compares the first two elements, and swap since 5 > 1
23-
[1, 5, 4, 2, 8] -> [1, 4, 5, 2, 8] Swap since 5 > 4
24-
[1, 4, 5, 2, 8] -> [1, 4, 2, 5, 8] Swap since 5 > 2
25-
[1, 4, 2, 5, 8] -> [1, 4, 2, 5, 8] Now, since these elements are already in order (8 > 5), algorithm does not swap them
22+
[5, 1, 4, 2, 8] // [1, 5, 4, 2, 8] Compares the first two elements, and swap since 5 > 1
23+
[1, 5, 4, 2, 8] // [1, 4, 5, 2, 8] Swap since 5 > 4
24+
[1, 4, 5, 2, 8] // [1, 4, 2, 5, 8] Swap since 5 > 2
25+
[1, 4, 2, 5, 8] // [1, 4, 2, 5, 8] Now, since these elements are already in order (8 > 5), algorithm does not swap them
2626
```
2727

2828
**Second Pass**
2929
```kotlin
30-
[1, 4, 2, 5, 8] -> [1, 4, 2, 5, 8]
31-
[1, 4, 2, 5, 8] -> [1, 2, 4, 5, 8] Swap since 4 > 2
32-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8]
33-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8]
30+
[1, 4, 2, 5, 8] // [1, 4, 2, 5, 8]
31+
[1, 4, 2, 5, 8] // [1, 2, 4, 5, 8] Swap since 4 > 2
32+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8]
33+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8]
3434
```
3535

3636
Now, the list is already sorted, but the algorithm does not know if it is completed. The algorithm needs one whole pass
3737
without any swap to know it is sorted
3838

3939
**Third Pass**
4040
```kotlin
41-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8]
42-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8]
43-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8]
44-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8]
41+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8]
42+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8]
43+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8]
44+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8]
4545
```
4646

src/test/kotlin/com/igorwojda/list/sort/selectionsort/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Sort `[5, 1, 4, 2, 8]`
1616

1717
Find the minimum element in sub-list indexes 1...4 and place it at index 0
1818
```kotlin
19-
[5, 1, 4, 2, 8] -> [1, 5, 4, 2, 8] Swap since 1 < 5
19+
[5, 1, 4, 2, 8] // [1, 5, 4, 2, 8] Swap since 1 < 5
2020
```
2121

2222
Find the minimum element in sub-list indexes 2...4 and place it at index 1
2323
```kotlin
24-
[1, 5, 4, 2, 8] -> [1, 2, 4, 5, 8] Swap since 2 < 4
24+
[1, 5, 4, 2, 8] // [1, 2, 4, 5, 8] Swap since 2 < 4
2525
```
2626

2727
Find the minimum element in sub-list indexes 3...4 and place it at index 2
2828
```kotlin
29-
[1, 2, 4, 5, 8] -> [1, 2, 4, 5, 8] No swap since 5 < 8
29+
[1, 2, 4, 5, 8] // [1, 2, 4, 5, 8] No swap since 5 < 8
3030
```

0 commit comments

Comments
 (0)