Skip to content

Commit 9ac5b49

Browse files
authored
Merge pull request kelvins#303 from kelvins/feature/translate-scala
Translate Scala algorithms
2 parents bac05e3 + 404217e commit 9ac5b49

File tree

9 files changed

+16
-16
lines changed

9 files changed

+16
-16
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ In order to achieve greater coverage and encourage more people to contribute to
866866
</a>
867867
</td>
868868
<td> <!-- Scala -->
869-
<a href="./src/scala/Fatorial.scala">
869+
<a href="./src/scala/Factorial.scala">
870870
<img align="center" height="25" src="./logos/scala.svg" />
871871
</a>
872872
</td>
@@ -924,7 +924,7 @@ In order to achieve greater coverage and encourage more people to contribute to
924924
</a>
925925
</td>
926926
<td> <!-- Scala -->
927-
<a href="./src/scala/FatorialRecursiva.scala">
927+
<a href="./src/scala/FactorialRecursive.scala">
928928
<img align="center" height="25" src="./logos/scala.svg" />
929929
</a>
930930
</td>
@@ -1156,7 +1156,7 @@ In order to achieve greater coverage and encourage more people to contribute to
11561156
</a>
11571157
</td>
11581158
<td> <!-- Scala -->
1159-
<a href="./src/scala/MaxRecursivo.scala">
1159+
<a href="./src/scala/MaxRecursive.scala">
11601160
<img align="center" height="25" src="./logos/scala.svg" />
11611161
</a>
11621162
</td>
@@ -1214,7 +1214,7 @@ In order to achieve greater coverage and encourage more people to contribute to
12141214
</a>
12151215
</td>
12161216
<td> <!-- Scala -->
1217-
<a href="./src/scala/MinMaxIterativo.scala">
1217+
<a href="./src/scala/MinMaxIterative.scala">
12181218
<img align="center" height="25" src="./logos/scala.svg" />
12191219
</a>
12201220
</td>
@@ -1272,7 +1272,7 @@ In order to achieve greater coverage and encourage more people to contribute to
12721272
</a>
12731273
</td>
12741274
<td> <!-- Scala -->
1275-
<a href="./src/scala/MinMaxRecursivo.scala">
1275+
<a href="./src/scala/MinMaxRecursive.scala">
12761276
<img align="center" height="25" src="./logos/scala.svg" />
12771277
</a>
12781278
</td>
@@ -1446,7 +1446,7 @@ In order to achieve greater coverage and encourage more people to contribute to
14461446
</a>
14471447
</td>
14481448
<td> <!-- Scala -->
1449-
<a href="./src/scala/TorreDeHanoi.scala">
1449+
<a href="./src/scala/TowerOfHanoi.scala">
14501450
<img align="center" height="25" src="./logos/scala.svg" />
14511451
</a>
14521452
</td>
@@ -1912,7 +1912,7 @@ In order to achieve greater coverage and encourage more people to contribute to
19121912
</a>
19131913
</td>
19141914
<td> <!-- Scala -->
1915-
<a href="./src/scala/Fila.scala">
1915+
<a href="./src/scala/Queue.scala">
19161916
<img align="center" height="25" src="./logos/scala.svg" />
19171917
</a>
19181918
</td>
@@ -2376,7 +2376,7 @@ In order to achieve greater coverage and encourage more people to contribute to
23762376
</a>
23772377
</td>
23782378
<td> <!-- Scala -->
2379-
<a href="./src/scala/Pilha.scala">
2379+
<a href="./src/scala/Stack.scala">
23802380
<img align="center" height="25" src="./logos/scala.svg" />
23812381
</a>
23822382
</td>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def fatorial(n: Long): Long = (1L to n).product
1+
def factorial(n: Long): Long = (1L to n).product
22

33
object Main extends App {
44
val data: Map[Long, Long] = Map(
@@ -8,8 +8,8 @@ object Main extends App {
88
20L -> 2432902008176640000L
99
)
1010
data.foreach { (key, value) =>
11-
val result: Long = fatorial(key)
11+
val result: Long = factorial(key)
1212
assert(result == value)
13-
println(s"Fatorial($key): $result")
13+
println(s"Factorial($key): $result")
1414
}
1515
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
def fatorial(n: Long): Long = {
1+
def factorial(n: Long): Long = {
22
n match {
33
case 0L | 1L => 1L
4-
case _ => n * fatorial(n - 1L)
4+
case _ => n * factorial(n - 1L)
55
}
66
}
77

@@ -13,8 +13,8 @@ object Main extends App {
1313
20L -> 2432902008176640000L
1414
)
1515
data.foreach { (key, value) =>
16-
val result: Long = fatorial(key)
16+
val result: Long = factorial(key)
1717
assert(result == value)
18-
println(s"Fatorial($key): $result")
18+
println(s"Factorial($key): $result")
1919
}
2020
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/scala/TorreDeHanoi.scala renamed to src/scala/TowerOfHanoi.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
def hanoi(pin0: Int, pin2: Int, pin1: Int, disks: Int): Unit = {
22
if (disks == 1) {
3-
println(s"Move de $pin0 para $pin2")
3+
println(s"Move from $pin0 to $pin2")
44
} else {
55
hanoi(pin0, pin1, pin2, disks - 1)
66
hanoi(pin0, pin2, pin1, 1)

0 commit comments

Comments
 (0)