diff --git a/370/.gitignore b/370/.gitignore index d9568ca..1d1bb81 100644 --- a/370/.gitignore +++ b/370/.gitignore @@ -1 +1,2 @@ *swp +*dat diff --git a/370/notes/a-star.md b/370/notes/a-star.md new file mode 100644 index 0000000..a6aa0ad --- /dev/null +++ b/370/notes/a-star.md @@ -0,0 +1,27 @@ +# A\* Pathfinding + +There are 3 main values usedd in reference to A\*: + +``` +f = how promisiing a new location is +g = distance from origin +h = estimate distance to goal +f = g + h +``` + +For a grid space our `h` is calculated by two straight shots to the goal from the current location(ignore barriers). +The grid space `g` value is basiccally the number of steps we've taken from the origin. +We maintain a list of potential nodes only, so if one of the seeking nodes gets us stuck we can freely remove that, because it succs. + +# Time & Space Commplexities + +## Best-First Search + +Time: O(VlogV + E) + +## Dijkstra's + +O(V) + +## A\* +O(V^2 = E) diff --git a/370/samples/trie.py b/370/samples/trie.py deleted file mode 100644 index c2135ad..0000000 --- a/370/samples/trie.py +++ /dev/null @@ -1,32 +0,0 @@ -# Syntax tree in disguise -class Node: - def __init__(self, symbol=None, leaf=False, children={}): - # root node doesn't need any actual data - self.symbol = None - self.leaf = leaf - # {key=char : value=Node} - self.children = children - -class Trie: - def __init__(self): - # root should contain every letter so that we can pick our thing - root = Node() - - #wrapper func - def traverse(self, func, phrase, _node): - # wew lad - def func(_phrase, _node): - - return func(phrase) - - @traverse - def insert(self, phrase, node): - pass - - @traverse - def remove(self, phrase, node): - pass - - @traverse - def checkPhrase(self, phrase): - pass