I opened 1.8.1 because I thought it'd be the first section with code and the code was not PEP-8 compliant. Having a brief scan, the authors seem to have a pretty severe aversion to putting spaces after commas, which is a bummer because it really impacts code readability. It's inconsistent even from line to line, so it's not a style thing. They're also inconsistent about using single and double quotes for strings.<p>I skipped ahead to "implementing a stack in python", which is a little weird because the stack class they implement is just a thin wrapper around lists with append aliased to push and "self.items[len(self.items)-1]" aliased to peek (note: in python you can just use negative indexing to access items near the end of a list)<p>This might seem pedantic, but, like, if the book isn't leveraging Python and it's not particularly clean code then I don't really understand what's on offer here.
Is there an alike book that would provide functional implementations of the algorithms alongside or instead of imperative ones? In Python preferably but I don't mind any other language. I would like to learn implementing algorithms and solving problems the functional way.
Previous discussion (March 2017, with link dated 2015):<p><a href="https://news.ycombinator.com/item?id=13854087" rel="nofollow">https://news.ycombinator.com/item?id=13854087</a>
Ironically, the provided implementations for Queue and Deque are algorithmically terrible, giving O(n) performance for operations that should be O(1).<p>Queue and Deque could easily be developed from first principles by building on dictionaries or linked lists. It was a mistake to use list operations like s.pop(0) and s.insert(0, x).
Hey, here the some key points to know about algorithms, machine learning and python.
Just check it out <a href="https://www.easythings.xyz/2018/07/machine-learning-algorithms-develop-sounds.html" rel="nofollow">https://www.easythings.xyz/2018/07/machine-learning-algorith...</a>
and for beginners to programming and Python, the same site provides this excellent course: <a href="https://interactivepython.org/runestone/static/thinkcspy/index.html" rel="nofollow">https://interactivepython.org/runestone/static/thinkcspy/ind...</a>
In school I was quite confused about how merge sorts worked until I got a deck of cards and walked through the algorithm a few times. This site made it dead simple though. If only I'd had it instead of my textbook