Description
1 Introduction 1Models of the world and formalising problems . . 4What is computational thinking? . . . . . . . . . 6Computational thinking in a broader context . . . 12What is to come . . . . . . . . . . . . . . . . . . 152 Introducing Python programming 19Obtaining Python . . . . . . . . . . . . . . . . . 20Running Python . . . . . . . . . . . . . . . . . . 22Expressions in Python . . . . . . . . . . . . . . . 22Logical (or boolean) expressions . . . . . . . . . . 26Variables . . . . . . . . . . . . . . . . . . . . . . 30Working with strings . . . . . . . . . . . . . . . . 32Lists . . . . . . . . . . . . . . . . . . . . . . . . 36Tuples . . . . . . . . . . . . . . . . . . . . . . . 41iiiSets and dictionaries . . . . . . . . . . . . . . . . 42Input and output . . . . . . . . . . . . . . . . . . 44Conditional statements (if statements) . . . . . . 47Loops (for and while) . . . . . . . . . . . . . . . 50Using modules . . . . . . . . . . . . . . . . . . . 543 Introduction to algorithms 57Designing algorithms . . . . . . . . . . . . . . . 62Exercises for sequential algorithms . . . . . . . . 81Exercises on lists . . . . . . . . . . . . . . . . . . 874 Algorithmic eciency 95The RAM model of a computer and its primitiveoperations . . . . . . . . . . . . . . . . . . 97Types of eciency . . . . . . . . . . . . . . . . . 107Asymptotic running time and big-Oh notation . . 116Empirically validating an algorithms running time 1355 Searching and sorting 141Searching . . . . . . . . . . . . . . . . . . . . . . 142Sorting . . . . . . . . . . . . . . . . . . . . . . . 147Generalising searching and sorting . . . . . . . . 182How computers represent numbers . . . . . . . . 1866 Functions 197Parameters and local and global variables . . . . . 203Side eects . . . . . . . . . . . . . . . . . . . . . 210Returning from a function . . . . . . . . . . . . . 215Higher order functions . . . . . . . . . . . . . . . 221Functions vs function instances . . . . . . . . . . 227Default parameters and keyword arguments . . . 230Generalising parameters . . . . . . . . . . . . . . 234Exceptions . . . . . . . . . . . . . . . . . . . . . 239Writing your own Python modules . . . . . . . . 2517 Inner functions 253A comparison function for a search algorithm . . 256Counter function . . . . . . . . . . . . . . . . . . 261Apply . . . . . . . . . . . . . . . . . . . . . . . . 265Currying functions . . . . . . . . . . . . . . . . . 269Function composition . . . . . . . . . . . . . . . 274Thunks and lazy evaluation . . . . . . . . . . . . 276Decorators . . . . . . . . . . . . . . . . . . . . . 281Eciency . . . . . . . . . . . . . . . . . . . . . . 2888 Recursion 291Denitions of recursion . . . . . . . . . . . . . . 291Recursive functions . . . . . . . . . . . . . . . . 293Recursion stacks . . . . . . . . . . . . . . . . . . 297Recursion and iteration . . . . . . . . . . . . . . 307Tail-calls . . . . . . . . . . . . . . . . . . . . . . 316Continuations . . . . . . . . . . . . . . . . . . . 324Continuations, thunks and trampolines . . . . . . 3359 Divide and conquer and dynamic programming 343Divide and conquer running times . . . . . . . . 355Dynamic programming . . . . . . . . . . . . . . 371Representing oating point numbers . . . . . . . 39210 Hidden Markov models 399Probabili
Author: Thomas Mailund
Publisher: Apress
Published: 07/17/2021
Pages: 657
Binding Type: Paperback
Weight: 2.53lbs
Size: 10.00h x 7.00w x 1.35d
ISBN13: 9781484270769
ISBN10: 1484270762
BISAC Categories:
- Computers | Computer Science
- Computers | Programming | Algorithms
- Computers | Languages | Python
Author: Thomas Mailund
Publisher: Apress
Published: 07/17/2021
Pages: 657
Binding Type: Paperback
Weight: 2.53lbs
Size: 10.00h x 7.00w x 1.35d
ISBN13: 9781484270769
ISBN10: 1484270762
BISAC Categories:
- Computers | Computer Science
- Computers | Programming | Algorithms
- Computers | Languages | Python
About the Author
Thomas Mailund, PhD is an associate professor in bioinformatics at Aarhus University, Denmark. He has a background in math and computer science, including experience programming and teaching in the C, Python and R programming languages. For the last decade, his main focus has been on genetics and evolutionary studies, particularly comparative genomics, speciation, and gene flow between emerging species.