Codeless Data Structures and AlgorithmsLearn DSA Without Writing a Single Line of Code
Basse Terre, Moruga, Trinidad and Tobago
ISBN 978-1-4842-5724-1e-ISBN 978-1-4842-5725-8
© Armstrong Subero 2020
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, New York, NY 100043. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail email@example.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
To all those who tinker to keep the world running.
There is one question beginners and even good self-taught developers ask me all the time: “How do I learn data structures and algorithms?” I have had to answer this question so often that I thought I would write it down in a book so that anyone interested in this topic could follow along and understand the process.
The thing is, anyone can learn the basics of data structures and algorithms. There really isn’t much to them. The hardest part of teaching someone this topic is that they are likely to be using any language from the current “zoo” of languages. They may be using Python, Java, C++, or even C or Rust. Whatever the language they are using, it is important to be able to understand data structures and algorithms at the fundamental level. As such, I decided to make my book “codeless.” This is a book on algorithms and data structures that doesn’t use a single line of code from any programming language.
As someone who must regularly change between different programing languages, take it from me, once you understand the concepts behind these algorithms in a codeless way, then you will be able to apply them to whatever language you are using.
There are also some people “devout” in their programming language who are unwilling to look at any material that isn’t in their language of choice. As such, I have written this book without offending anyone’s “beliefs.” I think there are enough books on “data structures and algorithms in X language” that are thousands of pages detailing programs and all their nuances for the language you are using. I think such books would be fine complements to this one, as this book will give you the “big picture,” and then you can look at whatever book you want for the rest. You can learn about a concept here and then go to that book to learn the programming details.
Everything is explained in plain English, and each chapter is short and to the point. You will learn a lot without burning your brain out.
Who Is This Book For?
This book is for people who want to understand data structures and algorithms but don’t want unnecessary details about quirks of a language and don’t have time to sit and read a massive tome on the subject. This book is for people who want to understand the concepts of algorithms and data structures in plain English. I assume, though, that you have knowledge of at least one programming language, preferably a C-based one such as C, C++, Java, C#, or Python. The types and terminology used in this book are biased toward people who have used one of these languages.
I assume you are good at thinking abstractly and at least have basic knowledge of a programming language and of the basics of computer science (what a bit is, what a byte is, etc.). I also assume you know basic mathematics, at least algebra, though this book is by no means a “math-heavy” book. I use math concepts only where they are necessary and explain them clearly.
What Will I Need for This Book?
You won’t need anything except an open mind and time to read and understand the concepts being presented. I wrote this book as if we were having a coffee and I was explaining these concepts to you from the top of my head. For that reason, you won’t need any compiler or text editor, just a listening ear.
What Will I Learn in This Book?
You will learn quite a lot in a short space of time about data structures and algorithms. You will learn the concepts of data structures and algorithms with a focus on the most relevant ones in simple, plain language. After completing this book, you’ll understand which data structures and algorithms can be used to solve which problems and will be able to confidently follow along with discussions involving algorithms and data structures.
PART I – Data Structures
Chapter 1 goes into what algorithms and data structures are, and we discuss primitive types and Big O notation.
Chapter 2 looks at the linear data structures of arrays and linked lists; we also discuss stacks and queues.
Chapter 3 delves into trees and tree-based data structures.
Chapter 4 introduces you to hash-type data structures.
Chapter 5 briefly covers the basics of graphs.
PART II – Algorithms
Chapter 6 introduces two common algorithms, that of linear search and binary search.
Chapter 7 explores sorting algorithms, including bubble sort, selection sort, insertion sort, merge sort, and quick sort.
Chapter 8 presents some search algorithms; we look at breath-first search, Dijkstra’s algorithm, and the A∗ algorithm.
Chapter 9 introduces clustering algorithms, specifically the K-means algorithm and K-nearest neighbor and get a taste of machine learning and neural networks.
Chapter 10 teaches some basics about the concept of randomness.
Appendix A provides resources for going further.
Upon finishing this book, you will have a solid foundation in algorithms and data structures and will be able to use this knowledge when writing and designing your own programs.
Errata and Suggestions
If you find any errors in this text, have suggestions, or want to ask a question about your own project, you can contact me firstname.lastname@example.org ; please, no spam.
I want to thank my family.
I want to thankeveryone who ever said anything positive to me or taught me something. I heard it all, and it meant something.
I want to thank God most of all, because without God I wouldn’t be able to do any of this.
Part I: Data Structures1
Part II: Algorithms61
About the Author
started learning electronics at the age of 8. From then on he got into programming and embedded systems development. Within the realm of programming, he has a special interest in algorithms and data structures and enjoys implementing them in different programming languages and on different processor architectures, particularly resource-constrained systems. He currently works at the Ministry of National Security in his country, and he has degrees in computer science and liberal arts and sciences from Thomas Edison State University. He is the author ofProgramming PIC Microcontrollers with XC8 (Apress, 2018).