Skip to content

Commit a8fcf41

Browse files
committed
Update readme
1 parent 3ac8e54 commit a8fcf41

36 files changed

Lines changed: 89 additions & 2853 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
tree_link.py
55
__pycache__/**
66
!.gitignore
7+
todo

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Algorithm and data structures
1+
# Algorithm and Data Structures
22
>Notes and codes for learning algorithm and data structures :smiley:
33
44
Some pictures and idead are from `<<Introduction to Algotithm>>
@@ -11,40 +11,36 @@ Some scripts may have bugs or not be finished yet.
1111

1212
# Notice
1313
Currently, Github can't render latex math formulas.
14-
So,if you wannt to view the notes which contains latex math formulas and are in markdown format, you can visit [my blog](https://mbinary.coding.me)
14+
So,if you wannt to view the notes which contain latex math formulas and are in markdown format, you can visit [my blog](https://mbinary.coding.me)
1515

16-
# index
16+
# Index
1717
* [.](.)
1818
* [notes](./notes)
1919
* [alg-general.md](./notes/alg-general.md)
2020
* [hashTable.md](./notes/hashTable.md)
21-
* [README.md](./notes/README.md)
21+
* [red-black-tree.md](./notes/red-black-tree.md)
2222
* [sort.md](./notes/sort.md)
2323
* [tree.md](./notes/tree.md)
24-
* [red-black-tree.md](./notes/red-black-tree.md)
2524
* [algorithm](./algorithm)
2625
* [8Astar.py](./algorithm/8Astar.py)
2726
* [cantor.cc](./algorithm/cantor.cc)
28-
* [EIGHT.py](./algorithm/EIGHT.py)
2927
* [manacher.py](./algorithm/manacher.py)
3028
* [markov.py](./algorithm/markov.py)
31-
* [README.md](./algorithm/README.md)
3229
* [sort](./algorithm/sort)
3330
* [sunday.py](./algorithm/sunday.py)
3431
* [dataStructure](./dataStructure)
32+
* [redBlackTree.py](./dataStructure/redBlackTree.py)
33+
* [hashTable.py](./dataStructure/hashTable.py)
34+
* [splayTree.py](./dataStructure/splayTree.py)
3535
* [allOone](./dataStructure/allOone)
36-
* [redblack tree.py](./dataStructure/redBlackTree.py)
3736
* [binaryHeap.py](./dataStructure/binaryHeap.py)
38-
* [binaryIndexedTree.cc](./dataStructure/binaryIndexedTree.cc)
3937
* [binaryTree.py](./dataStructure/binaryTree.py)
40-
* [hashTable.py](./dataStructure/hashTable.py)
41-
* [huffman.cc](./dataStructure/huffman.cc)
38+
* [graph](./dataStructure/graph)
39+
* [huffman](./dataStructure/huffman)
4240
* [leftHeap.py](./dataStructure/leftHeap.py)
4341
* [loserTree.py](./dataStructure/loserTree.py)
44-
* [map](./dataStructure/map)
45-
* [README.md](./dataStructure/README.md)
46-
* [segTree.cc](./dataStructure/segTree.cc)
47-
* [splayTree.py](./dataStructure/splayTree.py)
48-
* [stack](./dataStructure/stack)
42+
* [map.cc](./dataStructure/map.cc)
43+
* [polynomial.cpp](./dataStructure/polynomial.cpp)
44+
* [polynomial.py](./dataStructure/polynomial.py)
4945
* [trie.py](./dataStructure/trie.py)
5046
* [winnerTree.py](./dataStructure/winnerTree.py)

algorithm/8Astar.py

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,52 @@ def getPath(s,index):
102102
if ct is 0:
103103
return cur.path
104104
cur.move()
105+
def info():
106+
print('input a 3x3 matrix in one line')
107+
print('from left to right,from up to down')
108+
print('such as 56831247x represent matrix as follow')
109+
print('5 6 8\n3 1 2\n4 7 x')
110+
print('then, if it has, I will print the path of moving x to reach state as follows')
111+
print('1 2 3\n4 5 6\n7 8 x')
112+
print('print q to quit')
113+
114+
from random import shuffle
115+
case = list('12345678x')
116+
def genCase():
117+
tmp = case.copy()
118+
shuffle(tmp)
119+
print(f'Using random data: {tmp}')
120+
index = -1
121+
for i,j in enumerate(tmp):
122+
if j=='x':
123+
index = i
124+
break
125+
tmp[index] = '9'
126+
return tmp,index
127+
def isValid(li):
128+
for i in '123456789':
129+
if not i in li:
130+
print('Invalid Input')
131+
return False
132+
return True
133+
134+
def run():
135+
while 1:
136+
print('\n\n'+'-'*10+'Game Begins'+ '-'*10)
137+
info()
138+
s=input('input: ')
139+
if s=='q' or s=='Q' or s=='quit':
140+
break
141+
index = s.find('x')
142+
li = list(s)
143+
if index != -1:
144+
li[index] = '9'
145+
if not isValid(li):
146+
li, index = genCase()
147+
if solvable(li):
148+
print(''.join(getPath(li,index)))
149+
else:print('unsolvable')
150+
105151

106152
if __name__ == '__main__':
107-
s=input()
108-
index = s.find('x')
109-
s =list(s)
110-
s[index] = '9'
111-
if solvable(s):print(''.join(getPath(s,index)))
112-
else:print('unsolvable')
153+
run()

algorithm/EIGHT.py

Lines changed: 0 additions & 73 deletions
This file was deleted.

algorithm/README.md

Lines changed: 0 additions & 18 deletions
This file was deleted.

algorithm/steganography_to_do.py

Lines changed: 0 additions & 81 deletions
This file was deleted.

dataStructure/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.
-6.81 KB
Binary file not shown.

dataStructure/binaryIndexedTree.cc

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)