jihoonerd / data_structures_and_algorithms_in_python Goto Github PK
View Code? Open in Web Editor NEW:book: Worked Solutions of "Data Structures & Algorithms in Python", written by Michael T. Goodrich, Roberto Tamassia and Michael H. Goldwasser. ✏️
:book: Worked Solutions of "Data Structures & Algorithms in Python", written by Michael T. Goodrich, Roberto Tamassia and Michael H. Goldwasser. ✏️
r = Range(-1, -7, -2) | r = range(-1, -7, -2)
out: [-1, -3, -5, -7] | out: list(r) [-1, -3, -5]
r = Range(-1, -7, -1) | r = range(-1, -7, -1)
out: list(r) -> [-1, -2, -3, -4, -5, -6, -7, -8] | out: list(r) -> [-1, -2, -3, -4, -5, -6]
Exercise, Chapter 02: OOP, In [14]:
def __contains__(self, item):
return True if (item - self._start) % 5 == 0 else False
I think the number 5
should be replaced by self._step
😄
Doing a pip search yielded no results for the actionlib package. Can the name of the package be updated in the requirements.txt file
Pip install seems to be failing with this output on python 3.8/3.9
ERROR: Could not find a version that satisfies the requirement actionlib==1.13.2 (from versions: none)
ERROR: No matching distribution found for actionlib==1.13.2
In the source code author provided in wiley, I find author did not write this class. Authors used from ..exceptions import Empty
but it did not work on my PC(Python 3.6, Win10). Also, there is no fold called exceptions in the source code on wiley.com.
If I did not get you wrong, the source code provided on wiley.com is incompelete and we must write our own class Empty(Exception):
to make the code usable? This is the reason you write class Empty(Exception):
?
Thanks a lot for providing notebooks and revised pure python code!
Hey @jihoonerd i noticed that chapter 6 had some missing solutions R 6.8 onwards. Are the solutions of those questions located elsewhere in the repository or do they not exist at all?
(Some of those questions are follow ups on previous questions but some are new as well)
I think there are something wrong in the solution of Chap3, R-3.27.
Firstly, the time complexity of example5
should be O(n^3).
Then, there are some problems when we collect data from example5
for plot. I think we can do it by changing the code a little bit. Like this:
def example5(A, B):
n = len(A)
count = 0
num_calc = 0
for i in range(n):
total = 0
for j in range(n):
for k in range(1+j):
total += A[k]
num_calc += 1
if B[i] == total:
count+=1
return count, num_calc
def get_time_complexity_2(n=100):
op_nums = []
for i in range(1, n):
A = np.random.randint(0, 100, size=(i, ))
B = np.random.randint(0, 100, size=(i, ))
_, num_calc = example5(A, B)
op_nums.append(num_calc)
plt.plot(op_nums)
plt.plot(range(n), [i**2 for i in range(n)])
plt.plot(range(n), [i**3 for i in range(n)])
plt.legend(['example5', '$n^2$', '$n^3$'])
plt.title('example5')
plt.show()
I see the solutions are present for chapters 1 through 8. Will solutions for remaining chapters be available in future?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.