Book Image

C++ Data Structures and Algorithm Design Principles

By : John Carey, Anil Achary, Shreyans Doshi, Payas Rajan
Book Image

C++ Data Structures and Algorithm Design Principles

By: John Carey, Anil Achary, Shreyans Doshi, Payas Rajan

Overview of this book

C++ is a mature multi-paradigm programming language that enables you to write high-level code with a high degree of control over the hardware. Today, significant parts of software infrastructure, including databases, browsers, multimedia frameworks, and GUI toolkits, are written in C++. This book starts by introducing C++ data structures and how to store data using linked lists, arrays, stacks, and queues. In later chapters, the book explains the basic algorithm design paradigms, such as the greedy approach and the divide-and-conquer approach, which are used to solve a large variety of computational problems. Finally, you will learn the advanced technique of dynamic programming to develop optimized implementations of several algorithms discussed in the book. By the end of this book, you will have learned how to implement standard data structures and algorithms in efficient and scalable C++ 14 code.
Table of Contents (11 chapters)

Summary

In this chapter, we discussed divide and conquer in two different ways: first as an algorithm design paradigm, and then its use in designing other tools that help us in scaling our software. We covered some standard divide-and-conquer algorithms (merge sort and quicksort). We also saw how simple operations such as partition underlie the solutions to different problems such as partial sorting and linear time selection.

An important idea to keep in mind while implementing these algorithms in practice is the separation of data structures that hold data from the implementation of the algorithm itself. Using C++ templates is often a good way to achieve this separation. We saw that the C++ Standard Library comes with a large set of primitives that can be used for implementing divide-and-conquer algorithms.

The simplicity of the underlying idea behind divide and conquer makes it an incredibly useful tool in solving problems and allows for the creation of parallelization frameworks such as...