Skip to product information
Data Structures and Algorithms for Coding Tests with C++
Data Structures and Algorithms for Coding Tests with C++
Description
Book Introduction
Learn C++ data structures and algorithms with 67 problem-solving exercises!
Prepare for coding tests and learn algorithms with the latest C++ syntax!


Explains various algorithms such as C++ data structures, greedy algorithms, divide-and-conquer algorithms, graph algorithms, and dynamic programming.
It also explains the relationship between traditional data structures and C++ STL class implementations, helping you choose the most appropriate data structure for a given problem.
After learning the theory, it is structured so that you can systematically learn by directly coding with 44 practice problems and 23 practical problems.
Recommended for job seekers preparing for coding tests and those who want to learn algorithms using the latest C++ syntax.
  • You can preview some of the book's contents.
    Preview

index
Chapter 1 Lists, Stacks, and Queues
1.1 Introduction
1.2 Contiguous and linked data structures
__1.2.1 Contiguous data structures
__1.2.2 Linked data structures
__1.2.3 comparison
__1.2.4 Constraints on C-style arrays
1.3 std::array
__1.3.1 Exercise 1: Implementing a Dynamically Sized Array
__1.3.2 Exercise 2: Creating a Fast and General-Purpose Data Storage Container
1.4 std::vector
__1.4.1 std::vector - Variable-size array
__1.4.2 std::vector allocator
1.5 std::forward_list
__1.5.1 Inserting and deleting elements in std::forward_list
__1.5.2 Other member functions of std::forward_list
__1.5.3 Exercise 3: Conditional element deletion using the remove_if() function in a linked list
1.6 Iterators
__1.6.1 Exercise 4: Moving through various iterators
__1.6.2 Exercise 5: Creating a Basic Custom Container
__1.6.3 Practice Problem 1: Implementing a Music Playlist
1.7 std::list
__1.7.1 std::list member functions
__1.7.2 Exercise 6: Using the insert or delete functions of std::list
__1.7.3 Bidirectional Iterator
__1.7.4 Iterator Invalidation
__1.7.5 Practice Problem 2: Card Game Simulation
1.8 std::deque
__1.8.1 Deck Structure
1.9 Container Adapter
__1.9.1 std::stack
__1.9.2 std::queue
__1.9.3 std::priority_queue
__1.9.4 Adapter Iterator
1.10 Benchmarking
__1.10.1 Practice Problem 3: Simulating the Print Queue List for a Shared Office Printer
1.11 Going out

Chapter 2 Trees, Heaps, and Graphs
2.1 Introduction
2.2 Nonlinear problems
__2.2.1 Hierarchical Problems
__2.2.2 Circular Dependencies
2.3 Tree: Upside-down form
__2.3.1 Exercise 7: Creating an Organizational Chart Structure
__2.3.2 Tree Traversal
__2.3.3 Exercise 8: Implementing Level-Ordered Traversal
2.4 Various tree structures
__2.4.1 Binary Search Tree
__2.4.2 Time complexity of tree operations
__2.4.3 Exercise 9: Implementing a BST
__2.4.4 Balanced Tree
__2.4.5 N-ary tree
__2.4.6 Practice Problem 4: Creating File System Data Structures
2.5 hips
__2.5.1 Heap Operations
__2.5.2 Exercise 10: Finding the Median
__2.5.3 Practice Problem 5: Merging Data Lists Using Heaps
2.6 Graph
__2.6.1 Representing a graph using an adjacency matrix
__2.6.2 Exercise 11: Constructing a Graph and Representing It as an Adjacency Matrix
__2.6.3 Representing a graph as an adjacency list
__2.6.4 Exercise 12: Constructing a Graph and Representing It as an Adjacency List
2.7 Going out

Chapter 3 Hash Tables and Bloom Filters
3.1 Introduction
3.2 Hash Table
__3.2.1 Hashing
__3.2.2 Exercise 13: A Simple Dictionary for Storing Integer Values
3.3 Collisions in the hash table
__3.3.1 Chaining
__3.3.2 Exercise 14: Hash Tables Using Chaining
__3.3.3 Open Addressing
__3.3.4 Cuckoo Hashing
__3.3.5 Exercise 15: Cuckoo Hashing
3.4 C++ Hash Tables
__3.4.1 Exercise 16: Hash Tables Provided by STL
__3.4.2 Practice Problem 6: Mapping Long URLs to Short URLs
3.5 Bloom Filter
__3.5.1 Exercise 17: Creating a Bloom Filter
__3.5.2 Practice Problem 7: Checking for Duplicate Email Addresses
3.6 Going out

Chapter 4 Divide and Conquer
4.1 Introduction
4.2 Binary Search
__4.2.1 Exercise 18: Implementing Binary Search and Evaluating Its Performance
__4.2.2 Practice Problem 8: Vaccination
4.3 Understanding Divide and Conquer
4.4 Sorting algorithm using divide-and-conquer
__4.4.1 Merge Sort
__4.4.2 Exercise 19: Merge Sort
__4.4.3 Quick sort
__4.4.4 Exercise 20: Quicksort
__4.4.5 Practice Problem 9: Partial Sort
__4.4.6 Linear Time Selection
__4.4.7 Exercise 21: Linear-Time Selection
4.5 Divide-and-conquer techniques and C++ standard library functions
4.6 MapReduce: A Divide-and-Conquer Technique at a Higher Level of Abstraction
__4.6.1 Map and Reduce Abstractions
__4.6.2 Exercise 22: Implementing Map and Reduce Using the C++ Standard Library
__4.6.3 Partial integration using the MapReduce framework
__4.6.4 Exercise 23: Checking for Prime Numbers Using MapReduce
__4.6.5 Practice Problem 10: Implementing Word Count Using MapReduce
4.7 Going out

Chapter 5 Greedy Algorithms
5.1 Introduction
5.2 Basic Greedy Algorithm
__5.2.1 Shortest Job First Scheduling
__5.2.2 Exercise 24: Shortest Job First Scheduling
5.3 Knapsack Problem
__5.3.1 0-1 Knapsack Problem
__5.3.2 Divisible knapsack problem
__5.3.3 Exercise 25: Divisible Knapsack Problem
__5.3.4 Practice Problem 11: Job Scheduling Problem
__5.3.5 Requirements for Greedy Algorithms
__5.3.6 Minimum spanning tree problem

__5.3.7 Disjoint-Set Data Structure
__5.3.8 Exercise 26: Kruskal's MST Algorithm
5.4 Graph Coloring
__5.4.1 Exercise 27: Greedy Graph Coloring
__5.4.2 Practice Problem 12: Welsh-Powell Algorithm
5.5 Going out

Chapter 6 Graph Algorithms I
6.1 Introduction
6.2 Graph Traversal Problem
__6.2.1 Breadth-first search
__6.2.2 Exercise 28: Implementing BFS
__6.2.3 Depth-first search
__6.2.4 Exercise 29: Implementing DFS
__6.2.5 Practice Problem 13: Identifying Bipartite Graphs
6.3 Prim's minimum spanning tree algorithm
__6.3.1 Exercise 30: Implementing Prim's Algorithm
6.4 Dijkstra's shortest path algorithm
__6.4.1 Exercise 31: Implementing Dijkstra's Algorithm
__6.4.2 Practice Problem 14: Finding the Shortest Path in New York
6.5 Going out

Chapter 7 Graph Algorithms II
7.1 Introduction
7.2 Revisiting the Shortest Path Problem
7.3 Bellman-Ford Algorithm
__7.3.1 Exercise 32: Implementing the Bellman-Ford Algorithm
7.4 Bellman-Ford Algorithm and Negative Weight Cycles
__7.4.1 Exercise 33: Finding Negative-Weight Cycles
__7.4.2 Practice Problem 15: The Greedy Robot
7.5 Johnson's Algorithm
__7.5.1 Exercise 34: Implementing Johnson's Algorithm
__7.5.2 Practice Problem 16: Random Graph Statistics
7.6 Strong connection elements
__7.6.1 Connectivity in Directed and Undirected Graphs
7.7 Kosaraju's Algorithm
__7.7.1 Exercise 35: Implementing Kosaraju's Algorithm
__7.7.2 Practice Problem 17: Maze-Teleportation Game
7.8 Choosing the right method
7.9 Going out

Chapter 8 Dynamic Programming I
8.1 Introduction
8.2 What is dynamic programming?
8.3 Memoization: A Top-Down Approach
8.4 Tabulation: A Bottom-Up Approach
8.5 Sum of Subsets Problem
__8.5.1 Step 1: Analyzing the Dynamic Programming Necessity Conditions
__8.5.2 Step 2: Defining Base Conditions and States
__8.5.3 Step 2-(a): Full Survey
__8.5.4 Exercise 36: Solving the sum of subsets problem using the exhaustive search method
__8.5.5 Step 2-(b): Applying Optimization - Backtracking
__8.5.6 Exercise 37: Solving the Sum of Subsets Problem Using Backtracking
__8.5.7 Step 3: Memoization
__8.5.8 Exercise 38: Solving the Sum of Subsets Problem Using Memoization
__8.5.9 Step 4: Tabulation
__8.5.10 Exercise 39: Solving the Sum of Subsets Problem Using Tabulation
__8.5.11 Practice Problem 18: Travel Route
8.6 Dynamic Programming for Strings and Sequences
__8.6.1 Longest Common Subsequence Problem
__8.6.2 Exercise 40: Solving the Longest Common Subsequence Problem Using the Exhaustive Search Method
__8.6.3 The First Step in Optimization: Finding the Optimal Substructure
__8.6.4 Practice Problem 19: Finding the Longest Common Subsequence Using Memoization
__8.6.5? From Top-Down to Bottom-Up: Replacing Memoization with Tabulation
__8.6.6 Practice Problem 20: Finding the Longest Common Subsequence Using Tabulation
8.7 Practice Problem 21: Melody Permutations
8.8 Going out

Chapter 9 Dynamic Programming II
9.1 Introduction
9.2 P and NP
9.3 Revisiting the Sum of Subsets Problem
9.4 Backpack Problem
__9.4.1 0-1 Knapsack Problem - Extending the Sum of Subsets Problem
__9.4.2 Practice Problem 41: 0-1 Knapsack Problem
__9.4.3 Infinite knapsack problem
__9.4.4 State Space Reduction
__9.4.5 Exercise 42: Infinite Knapsack Problem
__9.4.6 Practice Problem 22: Maximum Profit
9.5 Graphs and Dynamic Programming
__9.5.1 Revisiting the Bellman-Ford Algorithm
__9.5.2 Tackling the Shortest Path Problem with Dynamic Programming
__9.5.3 Exercise 43: Single-Start Shortest Path (Memoization)
__9.5.4 All-pair shortest path
__9.5.5 Floyd-Warshall Algorithm
__9.5.6 Exercise 44: Implementing the Floyd-Warshall Algorithm
__9.5.7 Practice Problem 23: Road Construction
9.6 Going out

Appendix Practice Problem Solutions

Detailed image
Detailed Image 1

Into the book
As always, the world changes and technology evolves. New technologies are constantly emerging in the IT field, and what were once unfamiliar concepts are now becoming fundamental concepts everyone must understand.
The C++ language is also adding new syntax with names such as C++11, C++14, and C++17, and in the fields of data structures and algorithms, more efficient and extensible theories are becoming popular.
As someone who studies all their life, it feels overwhelming.

Coding tests, which were once only conducted by famous foreign IT companies, are now being implemented by many domestic companies as well.
Rather than simple questions like implementing a linked list, the reality is that we are testing whether we can solve high-dimensional problems by utilizing already implemented C++ STL data structure containers and algorithm functions.
This book helps you choose the most appropriate data structure for a given problem by explaining the relationship between traditional data structures and C++ STL class implementations.
It also presents efficient solutions to problems frequently appearing in recent coding tests, such as divide-and-conquer, graph search, shortest path, and dynamic programming, using the C++ language.
This book will be an ideal textbook for job seekers preparing for coding tests in C++ and for those who are new to learning algorithms using the latest C++ syntax.


---From the Translator's Note

Publisher's Review
Theory and problem solving all in one!
From C++ data structures to graph algorithms and dynamic programming!

Let's learn various algorithm theories and implement them in the latest C++.

Explains various algorithms such as C++ data structures, greedy algorithms, divide-and-conquer algorithms, graph algorithms, and dynamic programming.
Explains the relationship between traditional data structures and C++ STL class implementations, helping you choose the most appropriate data structure for a given problem.
All code in the book is implemented in C++14.

Learn with 44 practice problems and 23 practical exercises.
To explain various algorithms, we have provided step-by-step problem solving so that you can learn them practically by coding them yourself.
This exercise demonstrates that although different data structures should theoretically perform similarly, they can differ significantly when run on real computers.
Additionally, the learned content can be summarized once more through practice problems.
Recommended for job seekers preparing for coding tests and those who want to learn algorithms using the latest C++ syntax.

Let's learn about the major algorithms that are frequently tested.
Coding tests also require strategy.
There are various algorithms, but this is composed of the main algorithms that are frequently tested on coding tests.
Let's focus on frequently tested algorithms such as divide-and-conquer, graph search, shortest path, and dynamic programming.
GOODS SPECIFICS
- Publication date: December 8, 2020
- Page count, weight, size: 552 pages | 1,049g | 183*235*22mm
- ISBN13: 9791165213794
- ISBN10: 1165213796

You may also like

카테고리