# huihut/interview architecture

> Architecture diagram of the GitHub repository huihut/interview, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/huihut/interview
- Repository: https://github.com/huihut/interview

## Overview

This repository is an educational C/C++ reference collection, not a single application: it provides standalone algorithm and data-structure examples, worked problem solutions, and runnable design-pattern demonstrations. The clearest user-to-result flow is the design-pattern demo entry point invoking each pattern example; algorithms, structures, and problem solutions are independent learning branches. Edges are limited to calls or references visible in the excerpts or SOURCE INDEX; unsampled examples are represented by their exact file paths without inferred internal wiring.

Main entry points: [`DesignPattern/main.cpp`](https://github.com/huihut/interview/blob/master/DesignPattern/main.cpp) (Pattern demo), [`DesignPattern/BridgePattern/BridgeMain.h`](https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/BridgeMain.h) (Bridge example), [`DesignPattern/ObserverPattern/ObserverMain.cpp`](https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/ObserverMain.cpp) (Observer example), [`DesignPattern/AbstractFactoryPattern/FactoryMain.cpp`](https://github.com/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern/FactoryMain.cpp) (Abstract factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patterns["Design patterns"]
  node_demo["Pattern demo<br/>[main.cpp]"]
  node_singleton["Singleton example<br/>[SingletonMain.h]"]
  node_factory["Abstract factory<br/>[FactoryMain.cpp]"]
  node_factory_types["Factory and products<br/>[concrete_factory.h]"]
  node_adapter["Adapter example<br/>[AdapterMain.h]"]
  node_adapter_impl["Power adapter<br/>[adapter.h]"]
  node_bridge["Bridge example<br/>[BridgeMain.h]"]
  node_bridge_abstraction["Switch abstractions"]
  node_bridge_equipment["Electrical equipment"]
  node_observer["Observer example<br/>[ObserverMain.cpp]"]
  node_observer_subject["Concrete subject<br/>[concrete_subject.h]"]
  node_observer_observer["Concrete observer"]
end

subgraph group_algorithms["Algorithms"]
  node_search["Search algorithms"]
  node_sort["Sorting algorithms"]
end

subgraph group_structures["Data structures"]
  node_data_structures["Data structures"]
end

subgraph group_problems["Problem solutions"]
  node_chess["Chessboard coverage"]
  node_knapsack["Knapsack<br/>[pack.cpp]"]
  node_neumann["Neumann neighbors"]
  node_round_robin["Round robin<br/>[MatchTable.cpp]"]
  node_tubing["Tubing problem<br/>[Tubing.cpp]"]
end

node_reader(("Learner"))

node_reader -->|"runs examples"| node_demo
node_demo -->|"calls"| node_singleton
node_demo -->|"calls"| node_factory
node_demo -->|"calls"| node_adapter
node_demo -->|"calls"| node_bridge
node_demo -->|"calls"| node_observer
node_factory -->|"creates products"| node_factory_types
node_adapter -->|"instantiates"| node_adapter_impl
node_bridge -->|"uses"| node_bridge_abstraction
node_bridge -->|"uses"| node_bridge_equipment
node_bridge_abstraction -->|"powers equipment"| node_bridge_equipment
node_observer -->|"uses"| node_observer_subject
node_observer -->|"uses"| node_observer_observer
node_observer_subject -->|"notifies"| node_observer_observer

click node_demo "https://github.com/huihut/interview/blob/master/DesignPattern/main.cpp"
click node_singleton "https://github.com/huihut/interview/blob/master/DesignPattern/SingletonPattern/SingletonMain.h"
click node_factory "https://github.com/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern/FactoryMain.cpp"
click node_factory_types "https://github.com/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern/concrete_factory.h"
click node_adapter "https://github.com/huihut/interview/blob/master/DesignPattern/AdapterPattern/AdapterMain.h"
click node_adapter_impl "https://github.com/huihut/interview/blob/master/DesignPattern/AdapterPattern/adapter.h"
click node_bridge "https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/BridgeMain.h"
click node_bridge_abstraction "https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/refined_abstraction.h"
click node_bridge_equipment "https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/concrete_implementor.h"
click node_observer "https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/ObserverMain.cpp"
click node_observer_subject "https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/concrete_subject.h"
click node_observer_observer "https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/concrete_observer.h"
click node_search "https://github.com/huihut/interview/tree/master/Algorithm"
click node_sort "https://github.com/huihut/interview/tree/master/Algorithm"
click node_data_structures "https://github.com/huihut/interview/tree/master/DataStructure"
click node_chess "https://github.com/huihut/interview/blob/master/Problems/ChessboardCoverageProblem/ChessboardCoverage.cpp"
click node_knapsack "https://github.com/huihut/interview/blob/master/Problems/KnapsackProblem/pack.cpp"
click node_neumann "https://github.com/huihut/interview/tree/master/Problems/NeumannNeighborProblem"
click node_round_robin "https://github.com/huihut/interview/blob/master/Problems/RoundRobinProblem/MatchTable.cpp"
click node_tubing "https://github.com/huihut/interview/blob/master/Problems/TubingProblem/Tubing.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_demo,node_singleton,node_factory,node_factory_types,node_adapter,node_adapter_impl,node_bridge,node_bridge_abstraction,node_bridge_equipment,node_observer,node_observer_subject,node_observer_observer toneBlue
class node_search,node_sort toneAmber
class node_data_structures toneMint
class node_chess,node_knapsack,node_neumann,node_round_robin,node_tubing toneRose
class node_reader toneIndigo
```

## Components

### Design patterns

- [Pattern demo](https://github.com/huihut/interview/blob/master/DesignPattern/main.cpp): `DesignPattern/main.cpp`
- [Singleton example](https://github.com/huihut/interview/blob/master/DesignPattern/SingletonPattern/SingletonMain.h): `DesignPattern/SingletonPattern/SingletonMain.h`
- [Abstract factory](https://github.com/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern/FactoryMain.cpp): `DesignPattern/AbstractFactoryPattern/FactoryMain.cpp`
- [Factory and products](https://github.com/huihut/interview/blob/master/DesignPattern/AbstractFactoryPattern/concrete_factory.h): `DesignPattern/AbstractFactoryPattern/concrete_factory.h`
- [Adapter example](https://github.com/huihut/interview/blob/master/DesignPattern/AdapterPattern/AdapterMain.h): `DesignPattern/AdapterPattern/AdapterMain.h`
- [Power adapter](https://github.com/huihut/interview/blob/master/DesignPattern/AdapterPattern/adapter.h): `DesignPattern/AdapterPattern/adapter.h`
- [Bridge example](https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/BridgeMain.h): `DesignPattern/BridgePattern/BridgeMain.h`
- [Switch abstractions](https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/refined_abstraction.h): `DesignPattern/BridgePattern/refined_abstraction.h`
- [Electrical equipment](https://github.com/huihut/interview/blob/master/DesignPattern/BridgePattern/concrete_implementor.h): `DesignPattern/BridgePattern/concrete_implementor.h`
- [Observer example](https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/ObserverMain.cpp): `DesignPattern/ObserverPattern/ObserverMain.cpp`
- [Concrete subject](https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/concrete_subject.h): `DesignPattern/ObserverPattern/concrete_subject.h`
- [Concrete observer](https://github.com/huihut/interview/blob/master/DesignPattern/ObserverPattern/concrete_observer.h): `DesignPattern/ObserverPattern/concrete_observer.h`

### Algorithms

- [Search algorithms](https://github.com/huihut/interview/tree/master/Algorithm): `Algorithm`
- [Sorting algorithms](https://github.com/huihut/interview/tree/master/Algorithm): `Algorithm`

### Data structures

- [Data structures](https://github.com/huihut/interview/tree/master/DataStructure): `DataStructure`

### Problem solutions

- [Chessboard coverage](https://github.com/huihut/interview/blob/master/Problems/ChessboardCoverageProblem/ChessboardCoverage.cpp): `Problems/ChessboardCoverageProblem/ChessboardCoverage.cpp`
- [Knapsack](https://github.com/huihut/interview/blob/master/Problems/KnapsackProblem/pack.cpp): `Problems/KnapsackProblem/pack.cpp`
- [Neumann neighbors](https://github.com/huihut/interview/tree/master/Problems/NeumannNeighborProblem): `Problems/NeumannNeighborProblem`
- [Round robin](https://github.com/huihut/interview/blob/master/Problems/RoundRobinProblem/MatchTable.cpp): `Problems/RoundRobinProblem/MatchTable.cpp`
- [Tubing problem](https://github.com/huihut/interview/blob/master/Problems/TubingProblem/Tubing.cpp): `Problems/TubingProblem/Tubing.cpp`

### Other components

- **Learner**

## Connections

- Learner → Pattern demo: runs examples (evidence: `DesignPattern/main.cpp`)
- Pattern demo → Singleton example: calls (evidence: `DesignPattern/main.cpp`)
- Pattern demo → Abstract factory: calls (evidence: `DesignPattern/main.cpp`)
- Pattern demo → Adapter example: calls (evidence: `DesignPattern/main.cpp`)
- Pattern demo → Bridge example: calls (evidence: `DesignPattern/main.cpp`)
- Pattern demo → Observer example: calls (evidence: `DesignPattern/main.cpp`)
- Abstract factory → Factory and products: creates products (evidence: `DesignPattern/AbstractFactoryPattern/FactoryMain.cpp`)
- Adapter example → Power adapter: instantiates (evidence: `DesignPattern/AdapterPattern/AdapterMain.h`)
- Bridge example → Switch abstractions: uses (evidence: `DesignPattern/BridgePattern/BridgeMain.h`)
- Bridge example → Electrical equipment: uses (evidence: `DesignPattern/BridgePattern/BridgeMain.h`)
- Switch abstractions → Electrical equipment: powers equipment (evidence: `DesignPattern/BridgePattern/refined_abstraction.h`)
- Observer example → Concrete subject: uses
- Observer example → Concrete observer: uses
- Concrete subject → Concrete observer: notifies (evidence: `DesignPattern/ObserverPattern/concrete_subject.h`)
