Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
C++ Data Structures and Algorithm Design Principles

You're reading from   C++ Data Structures and Algorithm Design Principles Leverage the power of modern C++ to build robust and scalable applications

Arrow left icon
Product type Paperback
Published in Oct 2019
Publisher
ISBN-13 9781838828844
Length 626 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (4):
Arrow left icon
Anil Achary Anil Achary
Author Profile Icon Anil Achary
Anil Achary
John Carey John Carey
Author Profile Icon John Carey
John Carey
Payas Rajan Payas Rajan
Author Profile Icon Payas Rajan
Payas Rajan
Shreyans Doshi Shreyans Doshi
Author Profile Icon Shreyans Doshi
Shreyans Doshi
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

About the Book 1. Lists, Stacks, and Queues FREE CHAPTER 2. Trees, Heaps, and Graphs 3. Hash Tables and Bloom Filters 4. Divide and Conquer 5. Greedy Algorithms 6. Graph Algorithms I 7. Graph Algorithms II 8. Dynamic Programming I 9. Dynamic Programming II 1. Appendix

An Overview of P versus NP

In Chapter 8, Dynamic Programming I, we demonstrated the significant gains in efficiency that dynamic programming can offer over other approaches, but it may not yet be clear how dramatic the difference can be. It is important to appreciate the extent to which the complexity of certain problems will scale as the input bounds increase because then we can understand the situations in which DP is not just preferable, but necessary.

Consider the following problem:

"Given the terms and operators of a Boolean formula, determine whether or not it evaluates to TRUE."

Take a look at the following example:

(0 OR 1)  —> TRUE

(1 AND 0) —> FALSE

(1 NOT 1) —> FALSE

(1 NOT 0) AND (0 NOT 1) —> TRUE

This problem is conceptually very simple to solve. All that is required to get the correct result is a linear evaluation of the given formula. However, imagine that, instead, the problem was stated this way:

"Given the variables...

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime
Banner background image