Hands-On Data Structures and Algorithms with Kotlin
图书信息
| 作者 | Chandra Sekhar Nayak |
| 出版社 | Packt Publishing |
| ISBN | 9781788998819 |
| 出版时间 | 2019-02-28 |
| 字数 | 22.9万 |
| 分类 | 进口书,外文原版书,电脑,网络 |
读书简介
Understand and solve complex computational problems and write efficient code with Kotlin Key Features * Learn about important data structures such as lists, arrays, queues, and stacks * Design custom algorithms for real-life implementations * Identify suitable tools for different scenarios and deliver immediate results Book Description Data structures and algorithms are more than just theoretical concepts. They help you become familiar with computational methods for solving problems and writing logical code. Equipped with this knowledge, you can write efficient programs that run faster and use less memory. Hands-On Data Structures and Algorithms with Kotlin book starts with the basics of algorithms and data structures, helping you get to grips with the fundamentals and measure complexity. You'll then move on to exploring the basics of functional programming while getting used to thinking recursively. Packed with plenty of examples along the way, this book will help you grasp each concept easily. In addition to this, you'll get a clear understanding of how the data structures in Kotlin's collection framework work internally. By the end of this book, you will be able to apply the theory of data structures and algorithms to work out real-world problems. What you will learn * Understand the basic principles of algorithms and data structures * Explore general-purpose data structures with arrays and linked lists * Get to grips with the basics of stacks, queues, and double-ended queues * Understand functional programming and related data structures * Use performant searching and efficient sorting * Uncover how Kotlin's collection framework functions * Become adept at implementing different types of maps Who this book is for If you're a Kotlin developer who wants to learn the intricacies of implementing data structures and algorithms for scalable application development, this book is for you.
目录
Title Page
Copyright and Credits
Hands-On Data Structures and Algorithms with Kotlin
Packt Upsell
Why subscribe?
Packt.com
Contributors
About the authors
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Section 1: Getting Started with Data Structures
A Walk Through - Data Structures and Algorithms
Technical requirements
Working with the command-line compiler
Working with IntelliJ IDEA
Working with Eclipse
Learning about algorithms
A few examples of algorithms
Introduction to data structures
Complexity analysis
Analyzing with time complexity
Analyzing with space complexity
Time complexity versus space complexity
Learning about notations
Counting instructions
Asymptotic behavior
Examples of complexity analysis
Summary
Further reading
Arrays - First Step to Grouping Data
Technical requirements
Introduction to arrays
Operations with arrays
Creating an array
Creating an array using library functions
Creating an array using the constructor
Accessing elements from an array
Accessing an element using the Array Access Operator []
Accessing an element using the get function
Accessing an element using the extension functions
Iterating over an array
Updating elements in an array
Vectors (dynamic arrays)
Adding an element to a Vector class
Updating and fetching an element
Removing an element from Vector
The beauty of immutable arrays
Multidimensional array
Operations in multidimensional arrays
Accessing an element
Updating an element
Iterating over the array
Working with a matrix
Adding two matrices
Multiplying two matrices
A short introduction to strings
Summary
Questions
Section 2: Efficient Grouping of Data with Various Data Structures
Introducing Linked Lists
Technical requirements
Getting started with LinkedList
Understanding a Singly Linked List
Operations on a Singly Linked List
Inserting a node in a Singly Linked List
Inserting a node at the 0th index
Inserting a node at the last index
Inserting a node at a given index
Fetching a node value from a Singly Linked List
Fetching a value from the first or last node
Fetching the value of a node at a given index
Updating a node from a Singly Linked List
Deleting a node from a Singly Linked List
Removing the first and last node of a LinkedList
Removing the node based on its value
Removing the node at a particular index
Clearing the LinkedList
Searching for an element in a Singly Linked List
Understanding the Doubly Linked List
Adding a node
Deleting a node
Fetching a node
Understanding a Circular Linked List
Summary
Questions
Understanding Stacks and Queues
Technical requirements
Understanding stacks
Operations on a stack
Implementing stacks
Stacks with a fixed size
Stacks with a dynamic size
Stack implementation using a LinkedList
Pushing an element into the stack
Popping an element from the stack
Understanding a queue
Operations on queues
Implementing a queue
Queues with a fixed size
Queues with a dynamic size
Queue implementation using LinkedList
Performance of a queue
Introducing circular queues
Primary operations in a circular queue
Secondary operations in a circular queue
Understanding deque – double-ended queue
Primary operations – deque
Summary
Questions
Further reading
Questions
Maps - Working with Key-Value Pairs
Technical requirements
Introducing Map
Operations in Map
Introducing hashing
Benefits of hashing
The hash function
Hash collision
Fixing collisions with chaining
Implementing HashMap
A template of the HashMap class
The Node class of HashMap
The hash function of HashMap
Operations on HashMap
Determining the bucket from the key
Putting a key-value pair into the HashMap
Getting a value from HashMap
Removing a key-value pair from HashMap
Implementing ArrayMap
Internal data structure of ArrayMap
A template of the ArrayMap class
Operations on ArrayMap
Putting a key-value pair into ArrayMap
Getting a value from ArrayMap
Removing a key-value pair from ArrayMap
Summary
Questions
Section 3: Algorithms and Efficiency
Deep-Dive into Searching Algorithms
Technical requirements
Understanding the searching algorithm
Linear search
Linear search in an unordered collection
Linear search in an ordered collection
Binary search
Working with binary search
Jump search
Choosing indexes to be skipped
Exponential search
Pattern search
Naive pattern search
How Naive pattern search works
The Rabin-Karp algorithm
Hash functions for Rabin-Karp
Rolled-hash functions for Rabin-Karp
Searching using hash values
Performance
The Knuth-Morris-Pratt algorithm
The prefix function
Searching using a prefix array
Summary
Questions
Understanding Sorting Algorithms
Technical requirements
Understanding the bubble sort algorithm
How the bubble sort algorithm works
Implementing bubble sort
Understanding selection sort
How the selection sort algorithm works
Implementing selection sort
Understanding insertion sort
How the insertion sort algorithm works
Implementing insertion sort
Understanding merge sort
How the merge sort algorithm works
Implementing merge sort
Understanding quick sort
How the quick sort algorithm works
Choosing the pivot element
Example based on quick sort
Implementing quick sort
Understanding heap sort
A basic introduction to heap
Binary heap
How the heap sort algorithm works
Implementing heap sort
Summary
Questions
Section 4: Modern and Advanced Data Structures
Collections and Data Operations in Kotlin
Technical requirements
Introduction to collections
Benefits of a collections framework
The collection framework hierarchy
Understanding a group of ordered elements – List, MutableList
Various operations (sorting, searching) on List
Sorting a list with custom class / data types
Searching collections
Mutable lists
Group of unique elements – Set, MutableSet
Maps – working with key-value pairs
Understanding data operations in collections
The map function
The filter function
The flatMap function
The drop functions
The take functions
The zip function
Summary
Questions
Introduction to Functional Programming
Introducing functional programming
Immutability
Implementing immutability in Kotlin
Immutable collections
Exploring pure functions
Lambda and higher-order functions
Higher-order functions
Functional data structures
Understanding the Arrow framework and typed FP
The Option type constructor
The Either type constructor
Introducing category theory
Functors
Applicatives
Monads
Summary
Further reading
Other Books You May Enjoy
Leave a review - let other readers know what you think
Assessments
- 医疗美容法律法规与风险管理(美容医学系列数字化创新教材)(曹伟,石悦)
- 数据库原理与应用实训教程:SQL Server版(鲁艳霞)
- 菌糠饲料生产及使用技术(李济宸,等)
- 东亚新闻事业论([新加坡]卓南生)
- 学前儿童感觉统合训练(南姣鹏主编)
- 青春肆虐的河谷(晓剑)
- 本心诗话 : 中国百年新诗的原理与实践微观察(王瑛)
- 国研专家展望中国改革下一步(包月阳)
