Skip to content

Commit 3ce85c4

Browse files
committed
add dp
1 parent 75751ab commit 3ce85c4

File tree

12 files changed

+48
-4
lines changed

12 files changed

+48
-4
lines changed

algorithm/category.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@
1414
"bubble": "Bubble Sort",
1515
"quick": "Quicksort"
1616
}
17+
},
18+
"etc": {
19+
"name": "Uncategorized",
20+
"list": {
21+
"dp": "Dynamic Programming"
22+
}
1723
}
1824
}

algorithm/etc/dp/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"def": "Dynamic programming is both a mathematical optimization method and a computer programming method. In both contexts it refers to simplifying a complicated problem by breaking it down into simpler sub-problems in a recursive manner.",
3+
"apps": [],
4+
"cpx": {
5+
"time": "varies",
6+
"space": "varies"
7+
},
8+
"refs": [
9+
"https://en.wikipedia.org/wiki/Dynamic_programming"
10+
],
11+
"files": {
12+
"fibonacci": "Fibonacci Sequence"
13+
}
14+
}

algorithm/etc/dp/fibonacci/code.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
for (var i = 2; i < index; i++) {
2+
D[i] = D[i - 2] + D[i - 1];
3+
tracer._selectSet([i - 2, i - 1]);
4+
tracer._notify(i);
5+
tracer._deselectSet([i - 2, i - 1]);
6+
}

algorithm/etc/dp/fibonacci/data.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
var tracer = new Array1DTracer();
2+
var index = 15;
3+
var D = [1, 1];
4+
for (var i = 2; i < index; i++) {
5+
D.push(0);
6+
}
7+
tracer.setData(D);

algorithm/graph_search/bfs/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"https://en.wikipedia.org/wiki/Breadth-first_search"
1818
],
1919
"files": {
20-
"basic": "Searching a tree",
20+
"tree": "Searching a tree",
2121
"shortest_path": "Finding the shortest path"
2222
}
2323
}

algorithm/graph_search/dfs/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"https://en.wikipedia.org/wiki/Depth-first_search"
2222
],
2323
"files": {
24-
"basic": "Searching a tree",
24+
"tree": "Searching a tree",
2525
"all_paths": "Going through all possible paths without making any circuit",
2626
"weighted_graph": "DFS of Weighted Graph",
2727
"shortest_path": "Finding the shortest path"

0 commit comments

Comments
 (0)