Skip to Content
Python Algorithms: Mastering Basic Algorithms in the Python Language, Second Edition
book

Python Algorithms: Mastering Basic Algorithms in the Python Language, Second Edition

by Magnus Lie Hetland
September 2015
Intermediate to advanced
320 pages
12h 30m
English
Apress
Content preview from Python Algorithms: Mastering Basic Algorithms in the Python Language, Second Edition

APPENDIX D

image

Hints for Exercises

To solve any problem, here are three questions to ask yourself: First, what could I do? Second, what could I read? And third, who could I ask?

— Jim Rohn

Chapter 1

1-1. As machines get faster and get more memory, they can handle larger inputs. For poor algorithms, this will eventually lead to disaster.

1-2. A simple and quite scalable solution would be to sort the characters in each string and compare the results. (In theory, counting the character frequencies, possibly using collections.Counter, would scale even better.) A really poor solution would be to compare all possible orderings of one string with the other. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python 3: Project-based Python, Algorithms, Data Structures

Python 3: Project-based Python, Algorithms, Data Structures

Mashrur Hossain

Publisher Resources

ISBN: 9781484200551Purchase book