About the 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.
About the Authors
John Carey
A composer and pianist, John Carey's formal education is almost exclusively based within the musical realm. Having used computers and other forms of technology extensively in his artistic endeavors, he invested years of self-study in the subjects of programming and mathematics and now works professionally as a software engineer. He believes his unusual background provides him with a unique and relatively non-academic perspective on the topic of software development. He currently works for Hydratec Industries, a company that primarily develops CAD software for fire sprinkler system designers that is used to perform hydraulic calculations on proposed designs so as to determine their efficacy and legality.
Shreyans Doshi
Shreyans graduated with a Bachelor of Technology degree in Computer Engineering from Nirma University, Ahmedabad. After graduation, he joined the finance industry to work on ultra-low latency trading systems using cutting-edge C++ applications. For the past three years, he has been designing trading infrastructure in C++.
Payas Rajan
Payas graduated with a Bachelor of Technology degree in Computer Science from NIT Allahabad. Later, he joined Samsung Research India, where he helped develop the multimedia framework for Tizen devices. Currently working as a teaching and research assistant while pursuing a PhD specializing in geospatial databases and route planning algorithms at the University of California Riverside, he has been creating applications using C++ for a decade.
Learning Objectives
By the end of this book, you will be able to:
- Build applications using hash tables, dictionaries, and sets
- Implement a URL shortening service using a bloom filter
- Apply common algorithms such as heapsort and merge-sort for string data types
- Use C++ template metaprogramming to write code libraries
- Explore how modern hardware affects the actual runtime performance of programs
- Use appropriate modern C++ idioms such as
std::array
, instead of C-style arrays
Audience
This book is intended for developers or students who want to revisit basic data structures and algorithm design techniques. Although no mathematical background is required, some basic knowledge of complexity classes and Big O notation, along with a qualification in an algorithms course, will help you get the most out of this book. Familiarity with the C++ 14 standard is assumed.
Approach
This book uses a practical and hands-on approach to explain various concepts. Through exercises, the book shows that different data structures that theoretically should perform similarly actually perform quite differently on modern computers. The book does not delve into any theoretical analyses and instead focuses on benchmarking and practical results.
Hardware Requirements
For the optimal student experience, we recommend the following hardware configuration:
- Any entry-level PC/Mac with Windows, Linux, or macOS is sufficient
- Processor: Intel Core 2 Duo, Athlon X2, or better
- Memory: 4 GB RAM
- Storage: 10 GB available space
Software Requirements
You'll also need the following software installed in advance:
- Operating system: Windows 7 SP1 32/64-bit, Windows 8.1 32/64-bit, or Windows 10 32/64-bit, Ubuntu 14.04 or later, or macOS Sierra or later
- Browser: Google Chrome or Mozilla Firefox
- Any modern compiler and IDE (optional) that supports the C++ 14 standard.
Installation and Setup
Before you embark on this book, install the following libraries used in this book. You will find the steps to install these here:
Installing Boost libraries:
Some exercises and activities in the book require the Boost C++ libraries. You can find the libraries, as well as the installation instructions, on the following links:
Windows: https://www.boost.org/doc/libs/1_71_0/more/getting_started/windows.html
Linux/macOS: https://www.boost.org/doc/libs/1_71_0/more/getting_started/unix-variants.html
Installing the Code Bundle
Copy the code bundle for the class to the C:/Code
folder.
Additional Resources
The code bundle for this book is also hosted on GitHub at https://github.com/TrainingByPackt/CPP-Data-Structures-and-Algorithm-Design-Principles.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!