Muutke küpsiste eelistusi

Generic Data Structures and Algorithms in Go: An Applied Approach Using Concurrency, Genericity and Heuristics 1st ed. [Pehme köide]

  • Formaat: Paperback / softback, 579 pages, kõrgus x laius: 254x178 mm, kaal: 1141 g, 70 Illustrations, black and white; XXV, 579 p. 70 illus., 1 Paperback / softback
  • Ilmumisaeg: 13-Jul-2022
  • Kirjastus: APress
  • ISBN-10: 148428190X
  • ISBN-13: 9781484281901
  • Pehme köide
  • Hind: 62,59 €*
  • * hind on lõplik, st. muud allahindlused enam ei rakendu
  • Tavahind: 73,64 €
  • Säästad 15%
  • Raamatu kohalejõudmiseks kirjastusest kulub orienteeruvalt 2-4 nädalat
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Tellimisaeg 2-4 nädalat
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 579 pages, kõrgus x laius: 254x178 mm, kaal: 1141 g, 70 Illustrations, black and white; XXV, 579 p. 70 illus., 1 Paperback / softback
  • Ilmumisaeg: 13-Jul-2022
  • Kirjastus: APress
  • ISBN-10: 148428190X
  • ISBN-13: 9781484281901
Intermediate to Advanced

Advance your understanding of generic data structures and algorithms and their applications using Go and the effective use of concurrency. You are invited on a journey that aims to improve your programming and problem-solving skills. This book takes you to the next step by showing how to get your programs to work efficiently as well as correctly. 

As you explore many data structures and the algorithms and applications associated with them, you'll focus on the trade-offs between speed and storage and the benefits of deploying concurrency when appropriate. This book will demonstrate the huge increases in application performance that are possible. The presentation of classic data structures and techniques of algorithm design (greedy, divide and conquer, branch-and-bound to name a few) provides an essential foundation and toolkit for problem solving. But this book goes further by presenting heuristic algorithms and their implementations for solving computationally intractable combinatoric optimization problems such as the travelling salesperson problem. Simulated annealing and genetic algorithms are among the techniques used.

The consistent style of coding used throughout this book exploits Go’s ability to implement abstract, generic and constrained generic data types without the use of classes.  Although some familiarity with Go is assumed, this book should advance your ability to use Go to tackle server-side applications, games, machine learning, information retrieval and other application domains where speed and storage efficiency is essential.

What You'll Learn
  • Explore classical data structures and algorithms aimed at making your applications run faster or require less storage
  • Use the new generic features of Go to build reusable data structures
  • Utilize concurrency for maximizing application performance
  • See the power of heuristic algorithms for computationally intractable problems
  • Enhance and improve your Go programming skills
Who This Book Is For

Practicing Go software developers and students who wish to advance their programming and problem-solving skills and experience the excitement and see the benefits of using generic data structures and algorithms that utilize concurrency whenever possible.
About the Author xvii
About the Technical Reviewer xix
Acknowledgments xxi
Introduction xxiii
Chapter 1 A Tour of Generics and Concurrency in Go
1(54)
1.1 Brief History and Description of Go
1(1)
1.2 Introducing Generic Parameters
2(17)
Adding a New Student by Name
3(1)
Adding a New Student by ID Number
4(1)
Adding a New Student by Student Struct
5(1)
Introducing Generics
6(2)
Stringer Type
8(1)
Constrained Generic Type
8(1)
Implementing an Interface
9(1)
Instantiating a Generic Type
9(1)
Unconstrained Generic Type any
9(1)
Benefits of Generics
10(1)
Using Go's Sort Package
11(1)
Sort Type
12(3)
Map Functions
15(1)
Making MyMap Generic
16(1)
Filter Functions
16(1)
Making MyFilter Generic
17(2)
1.3 Concurrency
19(18)
Goroutine
19(2)
WaitGroup
21(3)
The Channel
24(2)
Select Statement
26(1)
Use a quit Channel to Avoid Using WaitGroup
26(2)
Channel Direction
28(2)
Race Condition
30(1)
Mutex
31(1)
Playing Chess Using Goroutines
32(3)
Fibonacci Numbers Using Goroutines
35(2)
1.4 Benchmarking Concurrent Applications
37(17)
Generating Prime Numbers Using Concurrency
42(1)
Sieve of Eratosthenes Algorithm
42(4)
Segmented Sieve Algorithm
46(4)
Concurrent Sieve Solution
50(4)
1.5 Summary
54(1)
Chapter 2 Algorithm Efficiency: Sorting and Searching
55(36)
2.1 Describing the Speed Efficiency of an Algorithm ;
55(9)
Working with Big 0
55(1)
Determining Whether a Slice of Numbers Is Sorted
56(4)
Using Concurrency
60(4)
2.2 Sorting Algorithms
64(18)
Bubblesort Algorithm
64(2)
Quicksort Algorithm
66(2)
Big 0 Analysis
68(1)
Worst Case for Quicksort
68(1)
Comparing Bubblesort to Quicksort
69(1)
Concurrent Quicksort
70(5)
Mergesort Algorithm
75(3)
Concurrent Mergesort
78(4)
Conclusions
82(1)
2.3 Searching Array Slices
82(7)
Linear Searches
83(1)
Concurrent Searches
84(3)
Binary Searches
87(2)
2.4 Summary
89(2)
Chapter 3 Abstract Data Types: OOP Without Classes in Go
91(32)
3.1 Abstract Data Type Using Classes
91(3)
3.2 Abstract Data Types in Go
94(12)
ADT Counter
94(4)
Creating a counter Package
98(1)
Mechanics of Creating a Package
98(3)
Another Example of Implementing an ADT
101(2)
Using Composition
103(3)
3.3 Polymorphism
106(3)
Using Interfaces to Achieve Polymorphism
107(2)
3.4 OOP Application: Simplified Game of Blackjack
109(8)
3.5 Another OOP Application: Permutation Group of Words
117(4)
Using the Standard map Data Structure
117(4)
3.6 Summary
121(2)
Chapter 4 ADT in Action: Game of Life
123(18)
4.1 Game
123(5)
Rules of Grid Cell Evolution
123(5)
4.2 ADT for Grid
128(1)
4.3 Console Implementation of the Game
128(7)
4.4 GUI Implementation of the Game of Life
135(5)
Creating go.mod file
138(1)
Program Output
138(2)
4.5 Summary
140(1)
Chapter 5 Stacks
141(46)
5.1 Stack ADT
141(1)
5.2 Slice Implementation of Generic Stack
142(7)
The Get Zero Function
145(1)
Why T Is Declared As Ordered
145(4)
5.3 Node Implementation of a Generic Stack
149(4)
5.4 Compare the Efficiency of Node and Slice Stacks
153(3)
5.5 Stack Application: Function Evaluation
156(8)
Postfix Evaluation
157(3)
We Walk Through Algorithm
160(2)
Evaluating Postfix Expression
162(2)
5.6 Converting Decimal Number to Binary
164(2)
5.7 Maze Application
166(19)
Efficient Strategy for Maze Path Using a Stack
166(1)
Building Infrastructure for Maze Application
167(9)
Completed Maze App
176(9)
5.8 Summary
185(2)
Chapter 6 Queues and Lists
187(50)
6.1 Queue ADT
188(1)
6.2 Implementation of Slice Queue
188(3)
Iterator
190(1)
6.3 Implementation of Node Queue
191(3)
6.4 Comparing the Performance of Slice and Node Queue
194(1)
6.5 Deque
195(3)
6.6 Deque Application
198(5)
6.7 Priority Queue
203(4)
6.8 Queue Application: Discrete Event Simulation of Waiting Line
207(8)
Poisson Process
207(1)
Simulation Logic
208(1)
Implementation of System
209(6)
6.9 Queue Application: Shuffling Cards
215(4)
Card Shuffling Model
216(3)
6.10 Linked Lists
219(1)
6.11 Singly Linked List
220(8)
6.12 Doubly Linked List
228(8)
Benefit of Double Linking
235(1)
6.13 Summary
236(1)
Chapter 7 Hash Tables
237(28)
7.1 Map
237(3)
Hash Encryption
239(1)
7.2 How Fast Is a Map?
240(4)
7.3 Building a Hash Table
244(6)
Create an Empty Hash Table
245(1)
Insertion into Hash Table
245(1)
Collisions and Collison Resolution
246(1)
Load Factor
246(1)
Determining Whether a Key Is Present
246(1)
Comparing the Performance of Hash Table with Standard Map
247(3)
7.4 Hash Application: String Search
250(6)
Rolling Hash Computation
251(1)
Rabin-Karp Algorithm
252(4)
7.5 Generic Set
256(7)
7.6 Summary
263(2)
Chapter 8 Binary Trees
265(22)
8.1 Binary Trees
265(1)
8.2 Tree Traversal
266(1)
Inorder Traversal
266(1)
Preorder Traversal
267(1)
Postorder Traversal
267(1)
8.3 Draw Tree
267(19)
Binary Tree Structure
269(1)
Infrastructure Used to Display Binary Tree
269(2)
Explanation of Code
271(2)
Implementation of ShowTreeGraph
273(10)
Creating go.mod Files in Subdirectories binarytree and main
283(3)
8.4 Summary
286(1)
Chapter 9 Binary Search Tree
287(28)
9.1 Overview
287(4)
Searching
288(1)
Insertion
289(1)
Ordered Output
289(1)
Deletion
290(1)
9.2 Generic Binary Search Tree
291(23)
Type Ordered Stringer
291(1)
Generic Types Needed for Binary Search Tree
291(2)
Methods for Binary Search Tree
293(1)
Discussion of Insert, Delete, and Inorder Traversal
294(1)
Support Functions
295(2)
Implementation of Tree Graphics
297(16)
Discussion of binarysearchtree Package and Main Driver
313(1)
9.3 Summary
314(1)
Chapter 10 AVL Trees
315(34)
10.1 Overview: Adelson Velsky and Landis
315(5)
Tree Rotations
316(1)
Insertion
317(1)
Deletion
318(1)
Facts About AVL Trees
319(1)
10.2 Implementation of a Generic AVL Tree
320(19)
Explanation of avl Package
332(6)
Discussion of Main Driver Results
338(1)
10.3 Set Using Map, AVL, and Concurrent AVL
339(8)
Implementation of Set Using Map, AVL Tree, and Concurrent AVL Tree
341(2)
Explanation of Concurrent AVL Set
343(1)
Comparing the Three Set Implementations
343(3)
Discussion of Results
346(1)
10.4 Summary
347(2)
Chapter 11 Heap Trees
349(14)
11.1 Heap Tree Construction
349(2)
11.2 Deletion from a Heap Tree
351(1)
11.3 Implementation of a Heap Tree
352(6)
Logic for Building a Heap Tree
352(1)
Package Heap
353(3)
Explanation of Package heap
356(2)
11.4 Heap Sort
358(2)
Discussion of heapsort Results
360(1)
11.5 Heap Application: Priority Queue
360(2)
11.6 Summary
362(1)
Chapter 12 Red-Black Trees
363(24)
12.1 Red-Black Trees
363(1)
Definition of Red-Black Tree
363(1)
Example of Red-Black Tree
364(1)
12.2 Insertion Process
364(9)
Detailed Walk-Through of Many Insertions
367(6)
12.3 Implementation of Red-Black Tree
373(12)
Comparing the Performance of Red-Black Tree to AVL Tree
384(1)
Benchmark Conclusion
384(1)
12.4 Summary
385(2)
Chapter 13 Expression Trees
387(14)
13.1 Expression Trees
387(2)
13.2 Construction of an Expression Tree
389(7)
Building a New Expression Tree
389(1)
Explanation of Function NewTree
390(1)
Function Evaluation Using Expression Tree
391(1)
Explanation of Method Evaluate
391(5)
13.3 Implementation of ShowTreeGraph
396(3)
13.4 Summary
399(2)
Chapter 14 Ecological Simulation with Concurrency
401(26)
14.1 Overview
401(1)
14.2 Specifications
402(4)
Mackerel
402(1)
Tuna
403(1)
Shark
403(1)
Output
404(2)
14.3 The Design
406(1)
14.4 The Implementation
406(19)
Data Model for Each Species
406(1)
Discussion of Code
407(1)
Support Functions
408(1)
Discussion of Code
409(1)
Required Methods for Mackerel to Be of Type MarineLife
409(2)
Discussion of Code
411(1)
Move Method for Shark
412(1)
Discussion of Code
413(1)
Move Method for Tuna
414(2)
Output Function for the Graphical Display of Critters
416(2)
Discussion of Code
418(1)
Full Implementation of Simulation
418(7)
14.5 Summary
425(2)
Chapter 15 Dynamic Programming
427(14)
15.1 Example of Dynamic Programming: nth Fibonacci Number
427(5)
Top-Down Dynamic Programming
428(1)
Bottom-Up Dynamic Programming
428(1)
Recursive Solution
429(2)
Discussion of Code
431(1)
15.2 Another Application: 0/1 Knapsack Problem
432(5)
Brute-Force Solution
432(1)
Discussion of Code
433(1)
Dynamic Programming Solution
433(1)
Discussion of Code
434(2)
Discussion of Code
436(1)
15.3 DNA Subsequences
437(3)
Discussion of Code
440(1)
15.4 Summary
440(1)
Chapter 16 Graph Structures
441(24)
16.1 Representing Graphs
441(1)
16.2 Traversing Graphs
442(1)
16.3 Depth- and Breadth-First Search
442(9)
Depth-First Search
444(1)
Breadth-First Search
445(6)
16.4 Single-Source Shortest Path in Graph
451(6)
Implementation
452(3)
Explanation of Solution
455(2)
16.5 Minimum Spanning Tree
457(1)
Kruskal Algorithm
457(1)
16.6 Implementation of Kruskal Algorithm
458(6)
Explanation of Kruskal Implementation
464(1)
16.7 Summary
464(1)
Chapter 17 Travelling Salesperson Problem
465(12)
17.1 Travelling Salesperson Problem and Its History
465(1)
17.2 An Exact Brute-Force Solution
466(7)
Finding Permutations
467(2)
Brute-Force Computation for TSP
469(3)
Discussion of Code
472(1)
Other Solutions
473(1)
17.3 Displaying a TSP Tour
473(3)
Discussion of Code
475(1)
17.4 Summary
476(1)
Chapter 18 Branch-and-Bound Solution to TSP
477(16)
18.1 Branch and Bound for TSP
477(4)
An Example
478(1)
Computation of Lower Bound
478(1)
Branch-and-Bound Algorithm
479(1)
The Priority Queue
480(1)
A Walk-Through Part of the Five-City Example Presented Earlier
480(1)
18.2 Branch-and-Bound Implementation
481(10)
Implementation of Priority Queue
483(2)
Generating Branch-and-Bound Solution
485(5)
Data for main
490(1)
Results
490(1)
18.3 Summary
491(2)
Chapter 19 Simulated Annealing Heuristic Solution to TSP
493(30)
19.1 Combinatorial Optimization
493(2)
Heuristic Solutions
494(1)
19.2 Simulated Annealing
495(2)
Simulated Annealing Steps
495(1)
Problem of Convergence to Local Minimum Rather Than Global Minimum
496(1)
19.3 Implementation of Simulated Annealing
497(24)
Discussion of Code
516(1)
Results
516(1)
Displaying Final Results
516(1)
Lines Crossing
517(4)
19.4 Summary
521(2)
Chapter 20 Genetic Algorithm for TSP
523(26)
20.1 Genetic Algorithm
523(2)
High-Level Description of Genetic Algorithm
523(1)
More Detailed Description of Genetic Algorithm
524(1)
20.2 Implementation of Genetic Algorithm
525(22)
Step 1 Form an Initial Population of Random Tours
525(1)
Step 2 Form an Elite Group of Best Tours
526(1)
Step 3 Tournament Selection
527(1)
Step 4 Mating of Parents
527(4)
Form Next Generation
531(3)
Putting the Pieces Together
534(13)
20.3 Summary
547(2)
Chapter 21 Neural Networks and Machine Learning
549(24)
21.1 Overview of Neural Networks and Machine Learning
549(4)
Training
550(1)
Neural Networks
550(1)
Perceptron
551(1)
Schematics of Neural Networks
552(1)
A Neuron
553(1)
21.2 A Concrete Example
553(1)
21.3 Constructing a Neural Network
554(1)
Matrices That Represent Network
554(1)
21.4 Neural Network Implementation
555(13)
Estimating the Partial Derivatives of Cost with Respect to Each Weight
560(8)
21.5 Output from Neural Network
568(4)
21.6 Summary
572(1)
Index 573
Richard Wiener, Ph.D. authored or co-authored 22 professional, software development and computer-science textbooks published by Wiley, Addison-Wesley, Prentice-Hall, Cambridge University Press and Thompson.  Served as founding Editor-in-Chief of the Journal of Object-Oriented Programming for 12 years and later, founding Editor-in-Chief of the Journal of Object Technology for 9 years.  Worked as Associate Professor of Computer Science at the University of Colorado, Colorado Springs (UCCS) from 1977-2012.  Served as Department Chair during last four years at UCCS. Served as consultant and software developer for IBM, HP, Boeing, Textronix, DEC and many other companies.  Presented industry short-courses all over the world from 1980 to 2006. Earned BS and MS in Electrical Engineering from City University of New York and Ph.D. from Polytechnic Institute of New York.