-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from nikox94/FibonacciHeap
Implement Fibonacci heap
- Loading branch information
Showing
13 changed files
with
1,157 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
l = [-2901939070.965906, 4539462982.372177, -6222008480.049856, | ||
-1400427921.5968666, 9866088144.060883, | ||
-2943107648.529664, 8985474333.11443, | ||
9204710651.257133, 5354113876.8447075, | ||
8122228442.770859, -8121418938.303131, | ||
538431208.3261185, 9913821013.519611, | ||
-8722989752.449871, -3091279426.694975, | ||
7229910558.195713, -2908838839.99403, | ||
2835257231.305996, 3922059795.3656673, | ||
-9298869735.322557] | ||
|
||
print(l) | ||
|
||
l = sorted(l) | ||
print(l) | ||
a1 = l[19] | ||
a2 = -8722989752.449871 | ||
print(str(a1) + " -> " + str(a2)) | ||
l[19] = a2 | ||
|
||
b1 = l[18] | ||
b2 = -9698869735.322557 | ||
print(str(b1) + " -> " + str(b2)) | ||
l[18] = b2 | ||
|
||
c1 = l[17] | ||
c2 = -9804710651.257133 | ||
print(str(c1) + " -> " + str(c2)) | ||
l[17] = c2 | ||
|
||
print(sorted(l)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
l = [-2901939070.965906, 4539462982.372177, -6222008480.049856, | ||
-1400427921.5968666, 9866088144.060883, -2943107648.529664, 8985474333.11443, | ||
9204710651.257133, 5354113876.8447075, 8122228442.770859, -8121418938.303131, | ||
538431208.3261185, 9913821013.519611, -8722989752.449871, -3091279426.694975, | ||
7229910558.195713, -2908838839.99403, 2835257231.305996, 3922059795.3656673, | ||
-9298869735.322557] | ||
|
||
print(l) | ||
|
||
l = sorted(l) | ||
print(l) | ||
a1 = l[19] | ||
a2 = 0 | ||
print(str(a1) + " -> " + str(a2)) | ||
l[19] = a2 | ||
|
||
b1 = l[18] | ||
b2 = 0 | ||
print(str(b1) + " -> " + str(b2)) | ||
l[18] = b2 | ||
|
||
c1 = l[17] | ||
c2 = 0 | ||
print(str(c1) + " -> " + str(c2)) | ||
l[17] = c2 | ||
|
||
print(sorted(l)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/python3 | ||
|
||
import random | ||
|
||
l = [] | ||
for i in range(20): | ||
l.append(random.uniform(-1E10, 1E10)) | ||
|
||
print(l) | ||
l = sorted(l) | ||
print(l) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import random | ||
|
||
l1 = [] | ||
l2 = [] | ||
for i in range(20): | ||
l1.append(random.uniform(-1E10, 1E10)) | ||
l2.append(random.uniform(-1E10, 1E10)) | ||
|
||
|
||
print(l1) | ||
print(l2) | ||
|
||
l = [] | ||
l.extend(l1) | ||
l.extend(l2) | ||
|
||
print(sorted(l)) | ||
|
||
''' | ||
[6015943293.071386, -3878285748.0708866, 8674121166.062424, -1528465047.6118088, | ||
7584260716.494843, -373958476.80486107, -6367787695.054295, 6813992306.719868, | ||
5986097626.907181, 9011134545.052086, 7123644338.268343, 2646164210.08445, | ||
4407427446.995375, -888196668.2563229, 7973918726.985172, -6529216482.09644, | ||
6079069259.51853, -8415952427.784341, -6859960084.757652, -502409126.89040375] | ||
[9241165993.258648, -9423768405.578083, 3280085607.6687145, -5253703037.682413, | ||
3858507441.2785892, 9896256282.896187, -9439606732.236805, 3082628799.5320206, | ||
9453124863.59945, 9928066165.458393, 1135071669.4712334, 6380353457.986282, | ||
8329064041.853199, 2382910730.445751, -8478491750.445316, 9607469190.690144, | ||
5417691217.440792, -9698248424.421888, -3933774735.280322, -5984555343.381466] | ||
[-9698248424.421888, -9439606732.236805, -9423768405.578083, -8478491750.445316, | ||
-8415952427.784341, -6859960084.757652, -6529216482.09644, -6367787695.054295, | ||
-5984555343.381466, -5253703037.682413, -3933774735.280322, -3878285748.0708866, | ||
-1528465047.6118088, -888196668.2563229, -502409126.89040375, | ||
-373958476.80486107, 1135071669.4712334, 2382910730.445751, 2646164210.08445, | ||
3082628799.5320206, 3280085607.6687145, 3858507441.2785892, 4407427446.995375, | ||
5417691217.440792, 5986097626.907181, 6015943293.071386, 6079069259.51853, | ||
6380353457.986282, 6813992306.719868, 7123644338.268343, 7584260716.494843, | ||
7973918726.985172, 8329064041.853199, 8674121166.062424, 9011134545.052086, | ||
9241165993.258648, 9453124863.59945, 9607469190.690144, 9896256282.896187, | ||
9928066165.458393] | ||
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
These are some Python helper scripts to help generate sample test arrays. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
BenchmarkFibHeap_Enqueue-4 10000000 280 ns/op 64 B/op 1 allocs/op | ||
BenchmarkFibHeap_DequeueMin-4 100 16990302 ns/op 16007168 B/op 2 allocs/op | ||
BenchmarkFibHeap_DecreaseKey-4 20000000 900 ns/op 122 B/op 3 allocs/op | ||
BenchmarkFibHeap_Delete-4 100 19087592 ns/op 16007168 B/op 2 allocs/op | ||
BenchmarkFibHeap_Merge-4 3000000 482 ns/op 128 B/op 2 allocs/op | ||
PASS | ||
coverage: 96.2% of statements | ||
ok _/home/nikola/git/go-datastructures/fibheap 37.206s |
Oops, something went wrong.