Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Hands-On Data Structures and Algorithms with Kotlin

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

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781788994019
Length 220 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Chandra Sekhar Nayak Chandra Sekhar Nayak
Author Profile Icon Chandra Sekhar Nayak
Chandra Sekhar Nayak
Rivu Chakraborty Rivu Chakraborty
Author Profile Icon Rivu Chakraborty
Rivu Chakraborty
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Section 1: Getting Started with Data Structures FREE CHAPTER
2. A Walk Through - Data Structures and Algorithms 3. Arrays - First Step to Grouping Data 4. Section 2: Efficient Grouping of Data with Various Data Structures
5. Introducing Linked Lists 6. Understanding Stacks and Queues 7. Maps - Working with Key-Value Pairs 8. Section 3: Algorithms and Efficiency
9. Deep-Dive into Searching Algorithms 10. Understanding Sorting Algorithms 11. Section 4: Modern and Advanced Data Structures
12. Collections and Data Operations in Kotlin 13. Introduction to Functional Programming 14. Other Books You May Enjoy 15. Assessments

Summary

In this chapter, we learnt that a stack is a simple linear data structure abstracting all elements from the user except the very last one.

A queue is one of the widely used data structures. Using a queue, we can solve many problems, such as distributing time among processors in a round-robin mechanism, job scheduling, a print queue in a printer, messaging systems, asynchronous applications, and so on. A queue uses the FIFO method to operate on its data. In addition to FIFO, a queue can also be represented as a LIFO or FCFS data structure.

If we've a scenario where the buffer is of a fixed size, then we should always go for fixed queue implementation, for example, a queue in a cinema theatre. Here, the seat count is 200, so we can create a buffer size of 200 and, as the people come in, we serve them in the FCFS manner until all 200 seats are full.

Whereas if you can...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime