Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Hands-On Data Structures and Algorithms with Kotlin
Hands-On Data Structures and Algorithms with Kotlin

Hands-On Data Structures and Algorithms with Kotlin: Level up your programming skills by understanding how Kotlin's data structure works

Arrow left icon
Profile Icon Nayak Profile Icon Rivu Chakraborty
Arrow right icon
€15.99 €23.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (2 Ratings)
eBook Feb 2019 220 pages 1st Edition
eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Nayak Profile Icon Rivu Chakraborty
Arrow right icon
€15.99 €23.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (2 Ratings)
eBook Feb 2019 220 pages 1st Edition
eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Hands-On Data Structures and Algorithms with Kotlin

A Walk Through - Data Structures and Algorithms

This book is written with the objective of making you understand what an algorithm is and the importance of it in computer science. Since an algorithm becomes more powerful when used with proper data structures, we'll also walk you through various commonly used data structures in programming.

In this chapter, we're going to focus on theoretical definitions of algorithms and data structures. As we move forward, we'll learn about this in detail.

As this book's title says, we're going to use the Kotlin programming language in all of the examples provided here. You may be asking why Kotlin? Why not any other programming language? The answer would be that it's just a language preference. But as far as algorithms are concerned, they can be understood and practiced with any programming language.

This chapter...

Technical requirements

Working with the command-line compiler

The Kotlin binary is released over GitHub. So you need to find the latest release and download the ZIP file if you want to install the Kotlin compiler manually. Currently, the latest release is 1.2.40, which can be found at this GitHub URL: https://github.com/JetBrains/kotlin...

Learning about algorithms

In computer programming, the sole purpose of building any software is to solve a problem existing in the real world and make the world a better place to live in. When we talk about a solution to a problem, it's obvious that we're talking about the procedure to be followed to solve the problem.

Let's consider a case where your teacher comes to you and gives you a bunch of candy, asking you to distribute it equally among your classmates. If you consider this as a problem and try to achieve it with ease, then you might do it as follows:

  1. Count the number of candies you have.
  2. Count the number of students present in your class.
  3. Calculate how many candies should be given to each student.
  4. Ask all of the students form a queue so that no student can take the required candies twice.
  5. Start distributing the candies to each student.
  6. Maintain a separate...

Introduction to data structures

We solved the previous example by taking a few steps, such as asking all students to stand in a queue and, once a student got candy, we moved them to a separate group. We could have also done the same task without asking them to maintain a queue or separating them into a separate group once they got the candy. But we did that to make the task go smoother. Of course, we could have done the task without these two sub-tasks, but that would have created a lot of confusion and made it tedious to finish the task on time.

If we consider that example, we can treat candies and students as data. And to solve the problem given by the teacher, we first structured the data and solved it with ease. This is what we call data structures in computer science.

In this book, we'll cover the most commonly used data structures such as an array, string, list, linked...

Complexity analysis

So far, we've gained a good understanding of what an algorithm is and how data structures can be used in an algorithm to make it work better. In our day-to-day life, any task can be completed in many ways. Similarly, in computer science, any computational problem can be solved using many solutions; in other words, they can be solved using many algorithms. Since we've a one-to-many relationship with respect to the problem versus solutions, we might easily get confused while choosing a solution for a particular problem. This is the time for us to understand how to analyze an algorithm and choose the one that suits our problem.

Whenever we're trying to fix a particular computational problem, it's obvious that we'll consider all possible algorithms that can solve it. But we can't use them all together while writing our solution. In...

Learning about notations

So far, we've understood why analyzing the complexity of an algorithm is really important. Now it's time to understand how to analyze the complexity. Before moving ahead with the how-to part, let's understand that, once the complexity of an algorithm is analyzed, there should be some way to represent it. For that, we usually use different notations.

As mentioned earlier, an algorithm can behave differently based on the size of the input given to it. And in the computer world, if you're building software, your algorithm should be prepared for any size of input. So, it's obvious that we need to analyze the complexity of every possible case.

The complexity of an algorithm can broadly fall into the following three categories:

  • Best case analysis: Best case defines the minimum time required by an algorithm to produce the output. It...

Summary

So far, we've understood what an algorithm is and how it can be used with any data structures to solve problems easily. We also understood how to analyze the complexity of an algorithm. But this is just the beginning. As the chapters go on, all of the examples we discuss will relate to complexity analysis and similar information.

We will discuss about many commonly used data structures in further chapters and will try to do the complexity analysis for all those data structures and algorithms.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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

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.

Who is this book 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.

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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 28, 2019
Length: 220 pages
Edition : 1st
Language : English
ISBN-13 : 9781788998819
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Feb 28, 2019
Length: 220 pages
Edition : 1st
Language : English
ISBN-13 : 9781788998819
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
Hands-On Object-Oriented Programming with Kotlin
€36.99
Hands-On Design Patterns with Kotlin
€36.99
Hands-On Data Structures and Algorithms with Kotlin
€29.99
Total 103.97 Stars icon
Banner background image

Table of Contents

15 Chapters
Section 1: Getting Started with Data Structures Chevron down icon Chevron up icon
A Walk Through - Data Structures and Algorithms Chevron down icon Chevron up icon
Arrays - First Step to Grouping Data Chevron down icon Chevron up icon
Section 2: Efficient Grouping of Data with Various Data Structures Chevron down icon Chevron up icon
Introducing Linked Lists Chevron down icon Chevron up icon
Understanding Stacks and Queues Chevron down icon Chevron up icon
Maps - Working with Key-Value Pairs Chevron down icon Chevron up icon
Section 3: Algorithms and Efficiency Chevron down icon Chevron up icon
Deep-Dive into Searching Algorithms Chevron down icon Chevron up icon
Understanding Sorting Algorithms Chevron down icon Chevron up icon
Section 4: Modern and Advanced Data Structures Chevron down icon Chevron up icon
Collections and Data Operations in Kotlin Chevron down icon Chevron up icon
Introduction to Functional Programming Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(2 Ratings)
5 star 50%
4 star 0%
3 star 0%
2 star 0%
1 star 50%
Amazon Customer Apr 18, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Awesome book. Covers the basics pretty good. Recommended for Kotlin enthusiasts.
Amazon Verified review Amazon
David A Medina Feb 14, 2020
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
Very simple lacks Depth.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.