Skip to content

Commit 3325f0d

Browse files
author
Afnizar Nur Ghifari
committed
Remove spaces
1 parent 6f56925 commit 3325f0d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

dijkstras.coffee

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
PriorityQueue = () ->
1+
PriorityQueue = ->
22
@_nodes = []
33
@enqueue = (priority, key) ->
44
@_nodes.push
55
key : key
66
priority : priority
77
@sort()
88
return
9-
@dequeue = () ->
9+
@dequeue = ->
1010
@_nodes.shift().key
11-
@sort = () ->
11+
@sort = ->
1212
@_nodes.sort = (a, b) ->
1313
a.priority - b.priority
1414
return
15-
@isEmpty = () ->
15+
@isEmpty = ->
1616
!@_nodes.length
1717
return
1818

1919
Graph = ->
2020
INFINITY = 1 / 0
2121
@vertices = {}
22-
2322
@addVertex = (name, edges) ->
2423
@vertices[name] = edges
2524
return
26-
2725
@shortestPath = (start, finish) ->
2826
nodes = new PriorityQueue
2927
distances = {}
@@ -91,4 +89,4 @@ g.addVertex 'H',
9189
E: 1
9290
F: 3
9391

94-
console.log g.shortestPath('A', 'H').concat([ 'A' ]).reverse()
92+
console.log g.shortestPath('A', 'H').concat(['A']).reverse()

0 commit comments

Comments
 (0)