Algorithms are the recipes for success that allow programs to accomplish difficult tasks quickly and correctly. In this series of liveProjects, you’ll play six roles in six diverse and interesting situations that spotlight algorithms in a wide range of applications using the Go programming language. You’ll learn by doing as you tackle tasks such as implementing classic sorting and searching algorithms, building an RSA encryption program, and solving the classic knapsack problem.
The course is great and sets the right tone for the intermediate Go programmer. Understanding data structures and algorithms is essential for a programmer.
There’s a lot of buzz about the Bug of the Month club you started, but the fly in the ointment is that a few customers aren’t paying their bills on time. You have no choice but to halt their monthly shipments of fine insect-based foods. But to do that, you must first identify the delinquent customers. Using three different Go sorting algorithms—bubble sort, quicksort, and counting sort—you’ll sort your list of customers by balance owed. Once your data is sorted, making it easier to search, you’ll implement a linear search as well as a binary search to locate the non-paying culprits. When you’re done, you’ll have firsthand experience implementing widely used Go sort algorithms and search methods and a firm grasp on their performance.
Play the role of chief guest engagement officer at an amusement park. You’ve decided to model the visitor experience by using a queue data structure to simulate guests waiting in line for a ride. The park’s sales and marketing department would also like you to study what might happen if VIP (very important pocketbook!) visitors are allowed to jump to the front of various park attraction lines using a special pass. As you carry out these tasks, you’ll experiment with different types of queues, write a function to detect loops in a linked list, build a queue using a doubly linked list, and create trees, fundamental data structures in many algorithms. When you’re done, you’ll have the experience and skills you need to build a complete waiting-customer model and other programs using linked data structures in Go.
You’re an avid chess player who’s asked by Alexis, a fellow chess club member, “How many queens can you place on a chessboard without any of them being able to attack any of the others?” To discover the answer, you’ll write a recursive program that will enable you to examine all of the possible queen arrangements. You’ll start with simpler functions, including calculating factorials and Fibonacci numbers, to warm up your recursive brain muscles. Then, you’ll advance to solving the knight’s tour problem, the Tower of Hanoi puzzle, and finally, the N-queens problem—the one that will satisfy Alexis’s curiosity. When you’re finished, you’ll have elevated your recursive function game by solving well-known problems and learning important techniques along the way.
As a summer intern at Ginormous Megadata Inc, you’ve been tasked with building a phone directory of the company’s 130,000 employees. The catch? Your boss won’t spring for an off-the-shelf database, the company’s firewall prevents you from searching for what you need online, and the summer isn’t long enough for you to build a full-fledged database from scratch. To complete your task, you decide to create a hash table, a data structure that enables you to use keys to store and retrieve items. You’ll experiment with different hash tables methods, including chaining, open addressing, and quadratic probing. When you’re finished, you’ll have hands-on experience creating a functional hash table you can use to build Ginormous Megadata’s phone directory, as well as a solid understanding of the trade-offs between different kinds of hash tables.
You’re the new head of IT at The Fright Stuff, a small Halloween store, and it’s up to you to prevent a scary security breach! To ensure your customers’ sensitive data is secure, you’ll build an RSA public key encryption program. Along the way, you’ll learn interesting mathematical techniques such as calculating greatest common divisors and least common multiples, performing fast exponentiation, building a sieve of Eratosthenes, testing for primality, and other vital encryption skills. When you’re done, your customers’ data will be safer than ever before, and you’ll have learned essential skills for RSA encryption.
Picture this: You’ve amassed a fortune selling Instagram filters and you’re cruising the Bermuda Triangle on one of your yachts when you strike a USO (unidentified submerged object). Now you’re sinking! Your life raft isn’t big enough to salvage all of your 200 valuable objects (of varying sizes, weights, and values). To help you decide which of your treasures—the Monet, the Degas, the bust by Canova—to take with you on the raft, you’ll write a Go program that uses different approaches, including exhaustive search, branch and bound, Rod’s technique, and dynamic programming to solve the knapsack problem, a classic in computer science for situations just like this. When you’re finished, you’ll learn what the tradeoffs are, and you’ll know which of your valuables you’ll be able to save and which will end up at the bottom of the ocean!
The data structures and algorithms used in this series are seriously useful and pervasive.
I like the fact that the liveProject is available for Golang. The author has plenty of experience with algorithms and presents each of them with a dash of humor.
These liveProjects are for Go programmers, from beginning level to advanced, who want to learn how to build algorithms in Go to solve real-world problems. To begin these liveProjects you’ll need to be familiar with the following:
In this liveProject series, you’ll learn how to solve everyday real-world problems using algorithms in Go:
geekle is based on a wordle clone.