Skip to content

Commit 58edcdd

Browse files
committed
Alphabetically and pruning of algorithms
1 parent 466a79c commit 58edcdd

15 files changed

+10
-162
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
main_mod.tex
22
build/*
3-
main.pdf
4-
*.pdf

algorithms/KruskalMST.py

-95
This file was deleted.

algorithms/Newton_R_1dim.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#Newton-Raphson
2-
## \note Algorithm to find zeros
1+
# Newton-Raphson
2+
## \note Algorithm to find zeros of an arbitrary function
33
def derivative(f, x, h):
44
return (f(x+h) - f(x-h)) / (2.0*h) # might want to return a small non-zero if ==0
55

@@ -17,4 +17,3 @@ def solve(f, x0, h):
1717
return nextX
1818

1919
xFound = solve(quadratic, 5, 0.01) # call the solver
20-
print "solution: x = ", xFound # print the result

algorithms/SCC.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Kosaraju's algorithm
2-
## \note Algorithm that finds all stringly connected components
2+
## \note Algorithm that finds all strongly connected components
33
from collections import defaultdict
44
# This class represents a directed graph using adjacency list representation
55
class Graph:

algorithms/coin_sum.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Coin sum
2+
## \note Expects a list with the coin values, and repetitions if there are more coins with this value.
23
def recMC(coinValueList,change):
34
minCoins = change
45
if change in coinValueList:

algorithms/dijkstra.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dijkstra's algorithm
2-
## \note Replacing heapq with a priorityqueue from the \ms{queue}-package might be necessary
2+
## \note \ms{nodes} is a list with node $i$ at index $i$ and then this node contains a list of tuples that indicate the length of the edge and whereto.
33
def dijkstra(a, b, nodes):
44
import heapq
55
visited = {}

algorithms/fenwick.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Fenwick Tree
2-
## \note Efficiently calculate sums and update elements
2+
## \note Efficiently calculate sums and update elements. The sum is taken from $0$ up to index \ms{r}. Updates happen with deltas and not with setting.
33
class FenwickSum:
44
def __init__(self, items):
55
self.items = [0 for _ in range(len(items))]

algorithms/intersection_line_segments.cpp

-32
This file was deleted.

algorithms/partition.py

-25
This file was deleted.

algorithms/topological_sort.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Topological sort
2+
## \note \ms{graph} is an adjacency matrix with directed edges
23
def topological_sort(graph):
34
from collections import deque
45
indeg = [0] * len(graph)

algorithms/union_find.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Union Find
2+
## \note Union find as used in Kruskal's minimum spanning tree.
23
class UnionFind:
34

45
def __init__(self, nodes):

logo-eps-converted-to.pdf

5.25 KB
Binary file not shown.

logo_rgb-eps-converted-to.pdf

10.1 KB
Binary file not shown.

main.pdf

222 KB
Binary file not shown.

substitute.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/env python
22
import sys
33
from os import listdir
4-
from os.path import isfile, join, getsize
4+
from os.path import isfile, join, getsize, basename
55

66
# Get files in directory
77
algorithm_dir = sys.argv[1]
88
filelist = [join(algorithm_dir, f) for f in listdir(algorithm_dir) if isfile(join(algorithm_dir, f))]
9-
filelist.sort(key=lambda x: getsize(x))
9+
filelist.sort(key=lambda x: basename(x))
1010

1111
def get_lang(f):
1212
if f[-3:] == ".py": return "Python"

0 commit comments

Comments
 (0)