Skip to content

📚 Comprehensive C++ interview prep repository featuring clean implementations of commonly asked data structures, template metaprogramming exercises, and algorithmic patterns. Designed to strengthen core C++ skills and deepen understanding of language internals.

Notifications You must be signed in to change notification settings

pysojic/InterviewPrepCpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InterviewPrepCpp

This repository is a modern C++ interview preparation toolkit, designed to deepen the understanding of core C++ concepts through clean, from-scratch implementations of data structures, concurrency primitives, smart pointers, metaprogramming techniques and more. It is organized to mirror the themes commonly explored in interviews, while encouraging a deeper grasp of language internals and performance considerations. In addition to the code, it includes a curated “References & Further Reading” section that maps out books, blogs, and documentation for going deeper into modern C++, systems programming, performance, networking, concurrency, and algorithms.

Structure Overview

include/

Header-only library code, organized by topic.

include/Containers/

Custom STL-like containers that exercise memory management, iterators, and algorithmic behavior:

  • Array, Vector, String
  • List, ForwardList
  • HashMap (chaining) and OpenAddressingHashMap
  • SPSCQueue for single-producer/single-consumer scenarios

include/Concurrency/

Basic synchronization primitives implemented manually to understand low-level threading:

  • Mutex (POSIX-based)
  • SpinLock (busy-wait locking)

include/SmartPointers/

Custom smart pointer implementations that mimic unique_ptr, shared_ptr, and related semantics:

  • UniquePtr
  • SharedPtr
  • WeakPtr

include/Sorting/

A collection of classical sorting algorithms (e.g., quicksort, mergesort, heapsort) implemented with a focus on clarity and performance trade-offs.

include/Utilities/

Miscellaneous utilities showcasing advanced language features:

  • Any.hpp: type-erasure container
  • CompileTimeFunctions.hpp: template metaprogramming and constexpr exploration
  • move_semantics.hpp: move/forward helpers and move-semantics experiments

src/

Small C++ programs that exercise and test some of the headers in include/. These files serve as usage examples and lightweight tests (for example, metafunctions_test.cpp for the metaprogramming utilities).

interview_questions/

A collection of PDF question-and-answer sets. The questions are a mix of those that were asked in real interviews (either to me personally or sourced online) and ones I created while studying specific topics. They are organized as themed sheets you can skim or drill through before an interview:

  • C++ language and modern C++ features
  • Operating systems and computer architecture (processes, scheduling, memory, synchronization, etc.)
  • Networking (sockets, TCP/UDP, protocols, latency, etc.)

I’ll keep adding new questions and answers as I read more resources on these topics.

CMakeLists.txt

CMake build configuration for generating project files and building the code.

Purpose

This project is not meant to replace the STL. Instead, it is a learning environment to:

  • Reinforce your understanding of core data structures by re-implementing them in a simple way.
  • Explore concurrency and memory models at a low level.
  • Practice template metaprogramming and compile-time techniques.
  • Build interview-ready intuition through hands-on coding rather than rote memorization.

Build Instructions

cmake -S . -B build
cmake --build build

You can include individual headers in your own C++ test files or use the provided tests.hpp for quick experimentation.

References & Further Reading

This section collects focused resources on modern C++, systems programming, performance, networking, concurrency, and algorithms. It’s meant as a concise “reading map” for going beyond syntax into how real machines behave, how production C++ is designed and optimized, and how to reason about trade-offs that matter both in interviews and in real-world systems.

Books

C++

Computer Architecture and Operating Systems

Networking

  • TCP/IP Illustrated, Volume 1: The Protocols (2nd Edition) — Packet-level exploration of the TCP/IP stack, illustrating how protocols like IP, TCP, and UDP really behave on the wire with detailed traces and examples.

  • Computer Networks: A Systems Approach — A systems-oriented networking textbook that explains the Internet stack from links and switching up through routing, congestion control, and applications, with a strong focus on design principles, trade-offs, and real-world protocol behavior.

Concurrency

Algorithms

  • Introduction to Algorithms (3rd Edition) — Comprehensive algorithms textbook (CLRS) covering data structures, graph algorithms, dynamic programming, and complexity analysis with mathematically rigorous treatments.

Linux

  • The Linux Command Line: A Complete Introduction (2nd Edition) — A hands-on introduction to the Unix shell that takes you from basic commands and pipelines to shell scripting, job control, and everyday CLI workflows, giving you the practical foundation needed to be productive and confident on Linux systems.

HFT/Trading Systems

  • Trading Systems Developer Interview Guide — A focused collection of real-world trading-systems interview questions and answers, with heavy emphasis on low-latency engineering, C++ performance fundamentals (memory/layout, concurrency), market microstructure basics, and the practical system-design tradeoffs you’re expected to reason about in HFT-style roles.

Blogs

  • Herb Sutter’s Blog — Language evolution and modern best practices.

  • Guru of the Week (GotW) — Guru of the Week (GotW) is a series of C++ programming problems created and written by Herb Sutter.

  • Agner Fog's Blog — A bit on the advanced side. Contains a plethora of tips/advices for low-level optimization.

  • rigtorp.se — A blog by Erik Rigtorp featuring deep dives into performance, benchmarking, data structures, and low-level C++ techniques.

  • Johnny’s SW Lab – Performance — Blog posts focused on software performance, profiling techniques, and low-level optimization in C++ and systems development.

  • Preshing – Blog — A blog by Jeff Preshing covering algorithms, lock-free data structures, concurrency, and systems-level programming insights.

  • Matt Godbolt’s Blog (xania.org) — Posts on C++ tooling and performance, plus practical insights from building Compiler Explorer and exploring code generation.

Articles and Papers

  • What Every Programmer Should Know About Memory — Ulrich Drepper’s classic deep dive into RAM, CPU caches, NUMA, and how modern memory hierarchies affect performance and correctness. A must-read if you care about writing cache-friendly, high-performance C/C++ and systems code.

  • Beej's Guide to Network Programming — A practical, conversational introduction to Unix/POSIX socket programming in C, covering TCP/UDP, IPv4/IPv6, and select/poll/epoll with lots of examples.

  • What Every Computer Scientist Should Know About Floating-Point Arithmetic — David Goldberg’s definitive tutorial on IEEE 754, rounding, cancellation, and numerical error. Essential to understand why floats “behave weirdly” and how to write numerically robust code.

  • IEEE754 — William Kahan’s lecture notes on the design and status of the IEEE 754 floating-point standard, with historical context, rationale, and many subtle corner cases from the person most associated with the standard.

  • C++ Design Patterns for Low-latency Applications Including High-frequency Trading — A research-driven overview of C++ design patterns and techniques for ultra-low-latency systems (e.g., HFT), covering cache-aware design, lock-free patterns, and practical performance tuning backed by benchmarks.

Documentation & Useful Websites

  • CppReference — Authoritative reference for the standard library and language features.

  • LINUX Man Pages — Official and comprehensive reference for Linux system calls, library functions, and interfaces.

  • ISO C++ Drafts — For exploring the language standard.

  • Compiler Explorer — Visualize template instantiations, optimizations, and generated assembly.

  • LearnCpp — Good place to start reviewing basic C++ concepts.

  • getcracked.io — Repository of technical interview questions spanning data structures, algorithms, system design, and more.

About

📚 Comprehensive C++ interview prep repository featuring clean implementations of commonly asked data structures, template metaprogramming exercises, and algorithmic patterns. Designed to strengthen core C++ skills and deepen understanding of language internals.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published