Hands-On Data Structures and Algorithms with Python: Store, manipulate, and access data effectively and boost the performance of your applications, 3rd Edition
- Length: 496 pages
- Edition: 3
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-07-29
- ISBN-10: 1801073449
- ISBN-13: 9781801073448
- Sales Rank: #789315 (See Top 100 Books)
Understand how implementing different data structures and algorithms intelligently can make your Python code and applications more maintainable and efficient
Key Features
- Explore functional and reactive implementations of traditional and advanced data structures
- Apply a diverse range of algorithms in your Python code
- Implement the skills you have learned to maximize the performance of your applications
Book Description
Choosing the right data structure is pivotal to optimizing the performance and scalability of applications. This new edition of Hands-On Data Structures and Algorithms with Python will expand your understanding of key structures, including stacks, queues, and lists, and also show you how to apply priority queues and heaps in applications. You’ll learn how to analyze and compare Python algorithms, and understand which algorithms should be used for a problem based on running time and computational complexity. You will also become confident organizing your code in a manageable, consistent, and scalable way, which will boost your productivity as a Python developer.
By the end of this Python book, you’ll be able to manipulate the most important data structures and algorithms to more efficiently store, organize, and access data in your applications.
What you will learn
- Understand common data structures and algorithms using examples, diagrams, and exercises
- Explore how more complex structures, such as priority queues and heaps, can benefit your code
- Implement searching, sorting, and selection algorithms on number and string sequences
- Become confident with key string-matching algorithms
- Understand algorithmic paradigms and apply dynamic programming techniques
- Use asymptotic notation to analyze algorithm performance with regard to time and space complexities
- Write powerful, robust code using the latest features of Python
Who this book is for
This book is for developers and programmers who are interested in learning about data structures and algorithms in Python to write complex, flexible programs. Basic Python programming knowledge is expected.
Preface Who this book is for What this book covers To get the most out of this book Get in touch Python Data Types and Structures Introducing Python 3.10 Installing Python Windows operating system Linux-based operating systems Mac operating system Setting up a Python development environment Setup via the command line Setup via Jupyter Notebook Overview of data types and objects Basic data types Numeric Boolean Sequences Strings Range Lists Membership, identity, and logical operations Membership operators Identity operators Logical operators Tuples Complex data types Dictionaries Sets Immutable sets Python’s collections module Named tuples Deque Ordered dictionaries Default dictionary ChainMap object Counter objects UserDict UserList UserString Summary Introduction to Algorithm Design Introducing algorithms Performance analysis of an algorithm Time complexity Space complexity Asymptotic notation Theta notation Big O notation Omega notation Amortized analysis Composing complexity classes Computing the running time complexity of an algorithm Summary Exercises Algorithm Design Techniques and Strategies Algorithm design techniques Recursion Divide and conquer Binary search Merge sort Dynamic programming Calculating the Fibonacci series Greedy algorithms Shortest path problem Summary Exercises Linked Lists Arrays Introducing linked lists Nodes and pointers Singly linked lists Creating and traversing Improving list creation and traversal Appending items Appending items to the end of a list Appending items at intermediate positions Querying a list Searching an element in a list Getting the size of the list Deleting items Deleting the node at the beginning of the singly linked list Deleting the node at the end in the singly linked list Deleting any intermediate node in a singly linked list Clearing a list Doubly linked lists Creating and traversing Appending items Inserting a node at beginning of the list Inserting a node at the end of the list Inserting a node at an intermediate position in the list Querying a list Deleting items Circular lists Creating and traversing Appending items Querying a list Deleting an element in a circular list Practical applications of linked lists Summary Exercise Stacks and Queues Stacks Stack implementation using arrays Stack implementation using linked lists Push operation Pop operation Peek operation Applications of stacks Queues Python’s list-based queues The enqueue operation The dequeue operation Linked list based queues The enqueue operation The dequeue operation Stack-based queues Approach 1: When the dequeue operation is costly Approach 2: When the enqueue operation is costly Enqueue operation Dequeue operation Applications of queues Summary Exercises Trees Terminology Binary trees Implementation of tree nodes Tree traversal In-order traversal Pre-order traversal Post-order traversal Level-order traversal Expression trees Parsing a reverse Polish expression Binary search trees Binary search tree operations Inserting nodes Searching the tree Deleting nodes Finding the minimum and maximum nodes Benefits of a binary search tree Summary Exercises Heaps and Priority Queues Heaps Insert operation Delete operation Deleting an element at a specific location from a heap Heap sort Priority queues Summary Exercises Hash Tables Introducing hash tables Hashing functions Perfect hashing functions Resolving collisions Open addressing Linear probing Implementing hash tables Storing elements in a hash table Growing a hash table Retrieving elements from the hash table Testing the hash table Implementing a hash table as a dictionary Quadratic probing Double hashing Separate chaining Symbol tables Summary Exercise Graphs and Algorithms Graphs Directed and undirected graphs Directed acyclic graphs Weighted graphs Bipartite graphs Graph representations Adjacency lists Adjacency matrix Graph traversals Breadth-first traversal Depth-first search Other useful graph methods Minimum Spanning Tree Kruskal’s Minimum Spanning Tree algorithm Prim’s Minimum Spanning Tree algorithm Summary Exercises Searching Introduction to searching Linear search Unordered linear search Ordered linear search Jump search Binary search Interpolation search Exponential search Choosing a search algorithm Summary Exercise Sorting Technical requirements Sorting algorithms Bubble sort algorithms Insertion sort algorithm Selection sort algorithm Quicksort algorithm Implementation of quicksort Timsort algorithm Summary Exercise Selection Algorithms Technical requirements Selection by sorting Randomized selection Quickselect Deterministic selection Implementation of the deterministic selection algorithm Summary Exercise String Matching Algorithms Technical requirements String notations and concepts Pattern matching algorithms The brute force algorithm The Rabin-Karp algorithm Implementing the Rabin-Karp algorithm The Knuth-Morris-Pratt algorithm The prefix function Understanding the KMP algorithm Implementing the KMP algorithm The Boyer-Moore algorithm Understanding the Boyer-Moore algorithm Bad character heuristic Good suffix heuristic Implementing the Boyer-Moore algorithm Summary Exercise Answers to the Questions Chapter 2: Introduction to Algorithm Design Chapter 3: Algorithm Design Techniques and Strategies Chapter 4: Linked Lists Chapter 5: Stacks and Queues Chapter 6: Trees Chapter 7: Heaps and Priority Queues Chapter 8: Hash Tables Chapter 9: Graphs and Algorithms Chapter 10: Searching Chapter 11: Sorting Chapter 12: Selection Algorithm Chapter 13: String Matching Algorithms Other Books You May Enjoy Index
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Hands-On Data Structures and Algorithms with Python: Store, manipulate, and access data effectively and boost the performance of your applications, 3rd Edition
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.