Skip to content

Commit 50701bf

Browse files
committed
upgrade libs
1 parent 6b531fe commit 50701bf

File tree

3 files changed

+14
-17
lines changed

3 files changed

+14
-17
lines changed

build.gradle

+9-12
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
plugins {
22
id 'java'
3-
id 'org.jetbrains.kotlin.jvm' version '1.3.50'
3+
id "org.jetbrains.kotlin.jvm" version "1.6.21"
44
}
55

66
group 'com.jemshit'
77
version '1.0'
88

9-
sourceCompatibility = 1.8
10-
119
repositories {
1210
mavenCentral()
1311
}
1412

15-
dependencies {
16-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
17-
18-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
19-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
20-
}
21-
2213
compileKotlin {
2314
kotlinOptions.jvmTarget = "1.8"
2415
}
2516
compileTestKotlin {
2617
kotlinOptions.jvmTarget = "1.8"
2718
}
28-
2919
test {
3020
useJUnitPlatform()
31-
}
21+
}
22+
23+
dependencies {
24+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21"
25+
26+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
27+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
28+
}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package graph
22

33
fun GraphUsingAdjacencyList.shortestPathDAG(): Array<Int> {
4-
val shortestPaths = arrayOfNulls<Int>(nodeCount)
4+
val shortestPaths = Array<Int>(nodeCount) { 0 }
55
val topologicalOrdering = this.topologicalOrdering()
66
shortestPaths[0] = 0
77
for (node in topologicalOrdering) {
88
val edges = getEdges(node)
99
for (edge in edges) {
1010
val neighbour = edge.end
11-
val distanceToNeighbour = (shortestPaths[node] ?: 0) + (edge.weight ?: 0)
12-
if (shortestPaths[neighbour] == null || distanceToNeighbour < shortestPaths[neighbour]!!) {
11+
val distanceToNeighbour = shortestPaths[node] + (edge.weight ?: 0)
12+
if (distanceToNeighbour < shortestPaths[neighbour]) {
1313
shortestPaths[neighbour] = distanceToNeighbour
1414
}
1515
}
1616
}
17-
return shortestPaths as Array<Int>
17+
return shortestPaths
1818
}

0 commit comments

Comments
 (0)