Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Learn Data Structures and Algorithms with Golang

You're reading from  Learn Data Structures and Algorithms with Golang

Product type Book
Published in Mar 2019
Publisher Packt
ISBN-13 9781789618501
Pages 336 pages
Edition 1st Edition
Languages
Author (1):
Bhagvan Kommadi Bhagvan Kommadi
Profile icon Bhagvan Kommadi

Table of Contents (16) Chapters

Preface 1. Section 1: Introduction to Data Structures and Algorithms and the Go Language
2. Data Structures and Algorithms 3. Getting Started with Go for Data Structures and Algorithms 4. Section 2: Basic Data Structures and Algorithms using Go
5. Linear Data Structures 6. Non-Linear Data Structures 7. Homogeneous Data Structures 8. Heterogeneous Data Structures 9. Dynamic Data Structures 10. Classic Algorithms 11. Section 3: Advanced Data Structures and Algorithms using Go
12. Network and Sparse Matrix Representation 13. Memory Management 14. Next Steps 15. Other Books You May Enjoy

Preface

Learn Data Structures and Algorithms with Go covers topics related to simple and advanced concepts in computer programming. The primary objective is to choose the correct algorithm and data structures for a problem. This book explains the concepts for comparing algorithm complexity and data structures in terms of code performance and efficiency.

Golang has been the buzzword for the last two years, with tremendous improvements being seen in this area. Many developers and organizations are slowly migrating to Golang, adopting its fast, lightweight, and inbuilt concurrency features. This means we need to have a solid foundation in data structures and algorithms with this growing language.

Who this book is for

This comprehensive book is for developers who want to understand how to select the best data structures and algorithms that will help to solve specific problems. Some basic knowledge of Go programming would be an added advantage.

This book is for anyone who wants to learn how to write efficient programs and use the proper data structures and algorithms.

What this book covers

Chapter 1, Data Structures and Algorithms, focuses on the definition of abstract data types, classifying data structures into linear, non-linear, homogeneous, heterogeneous, and dynamic types. Abstract data types, such as container, list, set, map, graph, stack, and queue, are presented in this chapter. This chapter also covers the performance analysis of data structures, as well as the correct choice of data structures and structural design patterns.

Chapter 2, Getting Started with Go for Data Structures and Algorithms, covers Go-specific data structures, such as arrays, slices, two-dimensional slices, maps, structs, and channels. Variadic functions, deferred function calls, and panic and recover operations are introduced. Slicing operations, such as enlarging using append and copy, assigning parts, appending a slice, and appending part of a slice, are also presented in this chapter.

Chapter 3, Linear Data Structures, covers linear data structures such as lists, sets, tuples, stacks, and heaps. The operations related to these types, including insertion, deletion, updating, reversing, and merging are shown with various code samples. In this chapter, we present the complexity analysis of various data structure operations that display accessing, search, insertion, and deletion times.

Chapter 4, Non-Linear Data Structures, covers non-linear data structures, such as trees, tables, containers, and hash functions. Tree types, including binary tree, binary search tree, T-tree, treap, symbol table, B- tree, and B+ tree, are explained with code examples and complexity analysis. Hash function data structures are presented, along with examples in cryptography for a variety of scenarios, such as open addressing, linear probing, universal hashing, and double hashing.

Chapter 5, Homogeneous Data Structures, covers homogeneous data structures such as two-dimensional and multi-dimensional arrays. Array shapes, types, literals, printing, construction, indexing, modification, transformation, and views are presented together with code examples and performance analysis. Matrix representation, multiplication, addition, subtraction, inversion, and transpose scenarios are shown to demonstrate the usage of multi-dimensional arrays.

Chapter 6, Heterogeneous Data Structures, covers heterogeneous data structures, such as linked lists, ordered, and unordered lists. We present the singly linked list, doubly linked list, and circular linked list, along with code samples and efficiency analysis. Ordered and unordered lists from HTML 3.0 are shown to demonstrate the usage of lists and storage management.

Chapter 7, Dynamic Data Structures, covers dynamic data structures, such as dictionaries, TreeSets, and sequences. Synchronized TreeSets and mutable TreeSets are covered in this chapter along with Go code exhibits. Sequence types including Farey, Fibonacci, look-and-say, and Thue-Morse, are discussed with Go programs. This chapter also explains the usage anti-patterns of dictionaries, TreeSets, and sequences.

Chapter 8, Classic Algorithms, covers pre-order, post-order, in-order, level-order tree traversals and linked list traversals. Sorting algorithms, such as bubble, selection, insertion, shell, merge, and quick are explained with code exhibits. Search algorithms, as well as linear, sequential, binary, and interpolation methods, are also covered in this chapter. Recursion and hashing are shown by means of code samples.

Chapter 9, Network and Sparse Matrix Representation, covers data structures such as graphs and lists of lists. Different use cases from real-life applications, such as social network representation, map layouts, and knowledge catalogs, are shown with code examples and efficiency analysis.

Chapter 10, Memory Management, covers dynamic data structures, such as AVL trees and stack frames. Garbage collection, cache management, and space allocation algorithms are presented with code samples and efficiency analysis. Garbage collection algorithms, such as simple/deferred/one-bit/weighted reference counting, mark and sweep, and generational collection, are explained with an analysis of their advantages and disadvantages.

Appendix, Next Steps, shares the learning outcomes for the reader arising from the book. The code repository links and key takeaways are presented. References are included for the latest data structures and algorithms. Tips and techniques are provided to keep yourself updated with the latest on data structures and algorithms.

To get the most out of this book

The knowledge we assume is basic programming in a language and mathematical skills related to topics including matrices, set operations, and statistical concepts. The reader should have the ability to write pseudo code based on a flowchart or a specified algorithm. Writing functional code, testing, following guidelines, and building a complex project in the Go language are the prerequisites that we assume in terms of reader skills.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at www.packt.com.
  2. Select the SUPPORT tab.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR/7-Zip for Windows
  • Zipeg/iZip/UnRarX for Mac
  • 7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Learn-Data-Structures-and-Algorithms-with-Golang. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Let's take a look at the len function in the next section."

A block of code is set as follows:

//main package has examples shown
// in Hands-On Data Structures and algorithms with Go book
package main

// importing fmt package
import (
"fmt"
)
// main method
func main() {
fmt.Println("Hello World")
}

Any command-line input or output is written as follows:

go build
./hello_world

Bold: Indicates a new term, an important word, or words that you see on screen.

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at customercare@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

lock icon The rest of the chapter is locked
Next Chapter arrow right
You have been reading a chapter from
Learn Data Structures and Algorithms with Golang
Published in: Mar 2019 Publisher: Packt ISBN-13: 9781789618501
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 $15.99/month. Cancel anytime}