
Python Data Structures Pocket Primer
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
- Begins with an introduction to Python, and covers recursion, strings, search and sort, linked lists, stacks, and more
- Features numerous code samples throughout
- Includes companion files with source code available for downloading.
More details
Other editions
Additional editions


Content
- Cover
- Title Page
- Copyright
- Dedication
- Contents
- Preface
- Chapter 1: Introduction to Python
- Some Standard Modules in Python
- Simple Data Types in Python
- Working With Numbers
- Working With Other Bases
- The chr() Function
- The round() Function in Python
- Unicode and UTF-8
- Working With Unicode
- Working With Strings
- Comparing Strings
- Uninitialized Variables and the Value None in Python
- Slicing and Splicing Strings
- Testing for Digits and Alphabetic Characters
- Search and Replace a String in Other Strings
- Precedence of Operators in Python
- Python Reserved Words
- Working With Loops in Python
- Python for Loops
- Numeric Exponents in Python
- Nested Loops
- The split() Function With for Loops
- Using the split() Function to Compare Words
- Python while Loops
- Conditional Logic in Python
- The break/continue/pass Statements
- Comparison and Boolean Operators
- The in/not in/is/is not Comparison Operators
- The and, or, and not Boolean Operators
- Local and Global Variables
- Scope of Variables
- Pass by Reference Versus Value
- Arguments and Parameters
- User-Defined Functions in Python
- Specifying Default Values in a Function
- Returning Multiple Values From a Function
- Lambda Expressions
- Working With Lists
- Lists and Basic Operations
- Lists and Arithmetic Operations
- Lists and Filter-Related Operations
- The join(), range(), and split() Functions
- Arrays and the append() Function
- Other List-Related Functions
- Working With List Comprehensions
- Working With Vectors
- Working With Matrices
- Queues
- Tuples (Immutable Lists)
- Sets
- Dictionaries
- Creating a Dictionary
- Displaying the Contents of a Dictionary
- Checking for Keys in a Dictionary
- Deleting Keys From a Dictionary
- Iterating Through a Dictionary
- Interpolating Data From a Dictionary
- Dictionary Functions and Methods
- Other Sequence Types in Python
- Mutable and Immutable Types in Python
- Summary
- Chapter 2: Recursion and Combinatorics
- What Is Recursion?
- Arithmetic Series
- Calculating Arithmetic Series (Iterative)
- Calculating Arithmetic Series (Recursive)
- Calculating Partial Arithmetic Series
- Geometric Series
- Calculating a Geometric Series (Iterative)
- Calculating Arithmetic Series (Recursive)
- Factorial Values
- Calculating Factorial Values (Iterative)
- Calculating Factorial Values (Recursive)
- Calculating Factorial Values (Tail Recursion)
- Fibonacci Numbers
- Calculating Fibonacci Numbers (Recursive)
- Calculating Fibonacci Numbers (Iterative)
- Task: Reverse a String via Recursion
- Task: Check for Balanced Parentheses
- Task: Calculate the Number of Digits
- Task: Determine if a Positive Integer Is Prime
- Task: Find the Prime Factorization of a Positive Integer
- Task: Goldbach's Conjecture
- Task: Calculate the GCD (Greatest Common Divisor)
- Task: Calculate the LCM (Lowest Common Multiple)
- What Is Combinatorics?
- Working With Permutations
- Working With Combinations
- Task: Calculate the Sum of Binomial Coefficients
- The Number of Subsets of a Finite Set
- Task: Subsets Containing a Value Larger Than k
- Summary
- Chapter 3: Strings and Arrays
- Time and Space Complexity
- Task: Maximum and Minimum Powers of an Integer
- Task: Binary Substrings of a Number
- Task: Common Substring of Two Binary Numbers
- Task: Multiply and Divide via Recursion
- Task: Sum of Prime and Composite Numbers
- Task: Count Word Frequencies
- Task: Check if a String Contains Unique Characters
- Task: Insert Characters in a String
- Task: String Permutations
- Task: Find All Subsets of a Set
- Task: Check for Palindromes
- Task: Check for the Longest Palindrome
- Working With Sequences of Strings
- The Maximum Length of a Repeated Character in a String
- Find a Given Sequence of Characters in a String
- Task: Longest Sequences of Substrings
- The Longest Sequence of Unique Characters
- The Longest Repeated Substring
- Task: Match a String With a Word List (Simple Case)
- The Harder Case
- Working With 1D Arrays
- Rotate an Array
- Task: Shift Non-Zero Elements Leftward
- Task: Sort Array In-Place in O(n) Without a Sort Function
- Task: Invert Adjacent Array Elements
- Task: Generate 0 That Is Three Times More Likely Than a 1
- Task: Invert Bits in Even and Odd Positions
- Task: Invert Pairs of Adjacent Bits
- Task: Find Common Bits in Two Binary Numbers
- Task: Check for Adjacent Set Bits in a Binary Number
- Task: Count Bits in a Range of Numbers
- Task: Find the Right-Most Set Bit in a Number
- Task: The Number of Operations to Make All Characters Equal
- Task: Compute XOR Without XOR for Two Binary Numbers
- Working With 2D Arrays
- The Transpose of a Matrix
- Summary
- Chapter 4: Search and Sort Algorithms
- Search Algorithms
- Linear Search
- Binary Search Walk-Through
- Binary Search (Iterative Solution)
- Binary Search (Recursive Solution)
- Well-Known Sorting Algorithms
- Bubble Sort
- Find Anagrams in a List of Words
- Selection Sort
- Insertion Sort
- Comparison of Sort Algorithms
- Merge Sort
- Merge Sort With a Third Array
- Merge Sort Without a Third Array
- Merge Sort: Shift Elements From End of Lists
- How Does Quick Sort Work?
- Quick Sort Code Sample
- Shellsort
- Summary
- Chapter 5: Linked Lists
- Types of Data Structures
- Linear Data Structures
- Nonlinear Data Structures
- Data Structures and Operations
- Operations on Data Structures
- What Are Singly Linked Lists?
- Trade-Offs for Linked Lists
- Singly Linked Lists: Create and Append Operations
- A Node Class for Singly Linked Lists
- Appending a Node in a Linked List
- Python Code for Appending a Node
- Singly Linked Lists: Finding a Node
- Singly Linked Lists: Update and Delete Operations
- Updating a Node in a Singly Linked List
- Python Code to Update a Node
- Deleting a Node in a Linked List: Method #1
- Python Code for Deleting a Node: Method #2
- Circular Linked Lists
- Python Code for Updating a Circular Linked List
- Working With Doubly Linked Lists (DLL)
- A Node Class for Doubly Linked Lists
- Appending a Node in a Doubly Linked List
- Python Code for Appending a Node
- Python Code for Inserting an Intermediate Node
- Searching and Updating a Node in a Doubly Linked List
- Updating a Node in a Doubly Linked List
- Python Code to Update a Node
- Deleting a Node in a Doubly Linked List
- Python Code to Delete a Node
- Summary
- Chapter 6: Linked Lists and Common Tasks
- Task: Adding Numbers in a Linked List (1)
- Task: Reconstructing Numbers in a Linked List (1)
- Task: Reconstructing Numbers in a Linked List (2)
- Task: Display the First k Nodes
- Task: Display the Last k Nodes
- Display a Singly Linked List in Reverse Order via Recursion
- Task: Remove Duplicate Nodes
- Task: Concatenate Two Lists
- Task: Merge Two Lists
- Task: Split a Single List into Two Lists
- Task: Find the Middle Element in a List
- Task: Reversing a Linked List
- Task: Check for Palindromes in a Linked List
- Summary
- Chapter 7: Queues and Stacks
- What Is a Queue?
- Types of Queues
- Creating a Queue Using a Python List
- Creating a Rolling Queue
- Creating a Queue Using an Array
- What Is a Stack?
- Use Cases for Stacks
- Operations With Stacks
- Working With Stacks
- Task: Reverse and Print Stack Values
- Task: Display the Min and Max Stack Values (1)
- Creating Two Stacks Using an Array
- Task: Reverse a String Using a Stack
- Task: Balanced Parentheses
- Task: Tokenize Arithmetic Expressions
- Task: Evaluate Arithmetic Expressions
- Infix, Prefix, and Postfix Notations
- Summary
- Index
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.