# bansal-yash/col106-data-structures-and-algorithms architecture

> Architecture diagram of the GitHub repository bansal-yash/col106-data-structures-and-algorithms, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bansal-yash/col106-data-structures-and-algorithms
- Repository: https://github.com/bansal-yash/col106-data-structures-and-algorithms

## Overview

This repository is a collection of seven independent COL106 assignment products, not one application. Users submit operations, expressions, banking queries, or corpus questions; each assignment processes them with its own data structures and returns results. The README documents set operations, stack-based postfix calculation, hash-based banking, two expression tools, document search, and corpus Q&A with BM25-ranked context and model APIs. The graph preserves those separate workflows. Several implementations were not sampled, so links for those are based only on README descriptions; the part1 Q&A search excerpt is a stub, while part2 contains the sampled Q&A implementation.

Main entry points: [`Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp`](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp) (Q&A workflow), [`Assignment_3_Banking_Database_Hashing`](https://github.com/bansal-yash/col106-data-structures-and-algorithms/tree/main/Assignment_3_Banking_Database_Hashing) (Banking operations), [`Assignment_2_Stack`](https://github.com/bansal-yash/col106-data-structures-and-algorithms/tree/main/Assignment_2_Stack) (Postfix calculator), [`Assignment_4_Expression_Evaluator/evaluator.cpp`](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/evaluator.cpp) (Expression evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sets_stacks["Sets and stacks"]
  node_sets["Set operations<br/>[main.cpp]"]
  node_postfix["Postfix calculator"]
  node_stack_a["Stack A<br/>[stack_a.cpp]"]
  node_stack_b["Stack B<br/>[stack_b.cpp]"]
  node_stack_c["Stack C<br/>[stack_c.cpp]"]
end

subgraph group_banking["Banking database"]
  node_bank["Banking operations"]
  node_chaining["Chaining hash<br/>[Chaining.cpp]"]
  node_linear["Linear probing<br/>[LinearProbing.cpp]"]
  node_quadratic["Quadratic probing"]
  node_cubic["Cubic probing<br/>[CubicProbing.cpp]"]
end

subgraph group_expression["Expression tools"]
  node_expr_eval["Expression evaluator<br/>[evaluator.cpp]"]
  node_eval_entry["Evaluator entry<br/>[entry.cpp]"]
  node_eval_tree["Parse tree<br/>[exprtreenode.cpp]"]
  node_symbols4["Symbol table<br/>[symtable.cpp]"]
  node_bigint["Unlimited integers<br/>[ulimitedint.cpp]"]
  node_rational["Unlimited rationals"]
  node_compiler["Expression compiler<br/>[eppcompiler.cpp]"]
  node_parser["Expression parser<br/>[parser.cpp]"]
  node_compile_tree["Expression tree<br/>[exprtreenode.cpp]"]
  node_symbols5["Compiler symbols<br/>[symtable.cpp]"]
  node_heap["Memory heap<br/>[minheap.cpp]"]
end

subgraph group_documents["Document processing"]
  node_dictionary["Document dictionary<br/>[dict.cpp]"]
  node_doc_search["Sentence search<br/>[search.cpp]"]
end

subgraph group_qna["Corpus Q&amp;A"]
  node_qna["Q&amp;A workflow<br/>[qna_tool.cpp]"]
  node_paragraph_index["Paragraph index<br/>[dict.cpp]"]
  node_ranker["BM25 ranking<br/>[qna_tool.cpp]"]
  node_chatgpt["ChatGPT API<br/>[api_call.py]"]
  node_huggingface["Hugging Face API<br/>[api_hugchat.py]"]
end

node_user(("User"))
node_model_service(("Model service"))

node_user -->|"requests set operations"| node_sets
node_user -->|"enters postfix expression"| node_postfix
node_postfix -->|"uses stack variant"| node_stack_a
node_postfix -->|"uses stack variant"| node_stack_b
node_postfix -->|"uses stack variant"| node_stack_c
node_user -->|"submits banking operations"| node_bank
node_bank -->|"selects hash strategy"| node_chaining
node_bank -->|"selects hash strategy"| node_linear
node_bank -->|"selects hash strategy"| node_quadratic
node_bank -->|"selects hash strategy"| node_cubic
node_user -->|"submits expression"| node_eval_entry
node_eval_entry -->|"dispatches evaluation"| node_expr_eval
node_expr_eval -->|"uses parse tree"| node_eval_tree
node_expr_eval -->|"consults symbols"| node_symbols4
node_expr_eval -->|"evaluates rational operations"| node_rational
node_rational -->|"uses integer arithmetic"| node_bigint
node_user -->|"submits program"| node_compiler
node_compiler -->|"parses statements"| node_parser
node_parser -->|"builds expression tree"| node_compile_tree
node_parser -->|"updates symbols"| node_symbols5
node_compiler -->|"uses memory allocation"| node_heap
node_user -->|"provides document words"| node_dictionary
node_user -->|"submits search pattern"| node_doc_search
node_user -->|"asks corpus question"| node_qna
node_qna -->|"indexes paragraph terms"| node_paragraph_index
node_qna -->|"ranks relevant paragraphs"| node_ranker
node_ranker -->|"returns ranked context"| node_qna
node_qna -.->|"dispatches answer request"| node_chatgpt
node_qna -.->|"dispatches answer request"| node_huggingface
node_chatgpt -.->|"calls model API"| node_model_service
node_huggingface -.->|"calls model API"| node_model_service

click node_sets "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_1_Sets/main.cpp"
click node_postfix "https://github.com/bansal-yash/col106-data-structures-and-algorithms/tree/main/Assignment_2_Stack"
click node_stack_a "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_2_Stack/stack_a.cpp"
click node_stack_b "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_2_Stack/stack_b.cpp"
click node_stack_c "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_2_Stack/stack_c.cpp"
click node_bank "https://github.com/bansal-yash/col106-data-structures-and-algorithms/tree/main/Assignment_3_Banking_Database_Hashing"
click node_chaining "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/Chaining.cpp"
click node_linear "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/LinearProbing.cpp"
click node_quadratic "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/QuadraticProbing.cpp"
click node_cubic "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/CubicProbing.cpp"
click node_expr_eval "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/evaluator.cpp"
click node_eval_entry "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/entry.cpp"
click node_eval_tree "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/exprtreenode.cpp"
click node_symbols4 "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/symtable.cpp"
click node_bigint "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/ulimitedint.cpp"
click node_rational "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/ulimitedrational.cpp"
click node_compiler "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/eppcompiler.cpp"
click node_parser "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/parser.cpp"
click node_compile_tree "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/exprtreenode.cpp"
click node_symbols5 "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/symtable.cpp"
click node_heap "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/minheap.cpp"
click node_dictionary "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_6_Document_Processor_Dictionary/dict.cpp"
click node_doc_search "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_6_Document_Processor_Dictionary/search.cpp"
click node_qna "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp"
click node_paragraph_index "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/dict.cpp"
click node_ranker "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp"
click node_chatgpt "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/api_call.py"
click node_huggingface "https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/api_hugchat.py"

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_sets,node_postfix,node_stack_a,node_stack_b,node_stack_c,node_user toneBlue
class node_bank,node_chaining,node_linear,node_quadratic,node_cubic toneAmber
class node_expr_eval,node_eval_entry,node_eval_tree,node_symbols4,node_bigint,node_rational,node_compiler,node_parser,node_compile_tree,node_symbols5,node_heap toneMint
class node_dictionary,node_doc_search toneRose
class node_qna,node_paragraph_index,node_ranker,node_chatgpt,node_huggingface,node_model_service toneIndigo
```

## Components

### Sets and stacks

- [Set operations](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_1_Sets/main.cpp): `Assignment_1_Sets/main.cpp`
- [Postfix calculator](https://github.com/bansal-yash/col106-data-structures-and-algorithms/tree/main/Assignment_2_Stack): `Assignment_2_Stack`
- [Stack A](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_2_Stack/stack_a.cpp): `Assignment_2_Stack/stack_a.cpp`
- [Stack B](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_2_Stack/stack_b.cpp): `Assignment_2_Stack/stack_b.cpp`
- [Stack C](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_2_Stack/stack_c.cpp): `Assignment_2_Stack/stack_c.cpp`

### Banking database

- [Banking operations](https://github.com/bansal-yash/col106-data-structures-and-algorithms/tree/main/Assignment_3_Banking_Database_Hashing): `Assignment_3_Banking_Database_Hashing`
- [Chaining hash](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/Chaining.cpp): `Assignment_3_Banking_Database_Hashing/Chaining.cpp`
- [Linear probing](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/LinearProbing.cpp): `Assignment_3_Banking_Database_Hashing/LinearProbing.cpp`
- [Quadratic probing](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/QuadraticProbing.cpp): `Assignment_3_Banking_Database_Hashing/QuadraticProbing.cpp`
- [Cubic probing](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_3_Banking_Database_Hashing/CubicProbing.cpp): `Assignment_3_Banking_Database_Hashing/CubicProbing.cpp`

### Expression tools

- [Expression evaluator](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/evaluator.cpp): `Assignment_4_Expression_Evaluator/evaluator.cpp`
- [Evaluator entry](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/entry.cpp): `Assignment_4_Expression_Evaluator/entry.cpp`
- [Parse tree](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/exprtreenode.cpp): `Assignment_4_Expression_Evaluator/exprtreenode.cpp`
- [Symbol table](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/symtable.cpp): `Assignment_4_Expression_Evaluator/symtable.cpp`
- [Unlimited integers](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/ulimitedint.cpp): `Assignment_4_Expression_Evaluator/ulimitedint.cpp`
- [Unlimited rationals](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_4_Expression_Evaluator/ulimitedrational.cpp): `Assignment_4_Expression_Evaluator/ulimitedrational.cpp`
- [Expression compiler](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/eppcompiler.cpp): `Assignment_5_Expression_Compiler/eppcompiler.cpp`
- [Expression parser](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/parser.cpp): `Assignment_5_Expression_Compiler/parser.cpp`
- [Expression tree](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/exprtreenode.cpp): `Assignment_5_Expression_Compiler/exprtreenode.cpp`
- [Compiler symbols](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/symtable.cpp): `Assignment_5_Expression_Compiler/symtable.cpp`
- [Memory heap](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_5_Expression_Compiler/minheap.cpp): `Assignment_5_Expression_Compiler/minheap.cpp`

### Document processing

- [Document dictionary](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_6_Document_Processor_Dictionary/dict.cpp): `Assignment_6_Document_Processor_Dictionary/dict.cpp`
- [Sentence search](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_6_Document_Processor_Dictionary/search.cpp): `Assignment_6_Document_Processor_Dictionary/search.cpp`

### Corpus Q&A

- [Q&A workflow](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp): `Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp`
- [Paragraph index](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/dict.cpp): `Assignment_7_Corpus_QnA_Tool/part2_final/dict.cpp`
- [BM25 ranking](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp): `Assignment_7_Corpus_QnA_Tool/part2_final/qna_tool.cpp`
- [ChatGPT API](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/api_call.py): `Assignment_7_Corpus_QnA_Tool/part2_final/api_call.py`
- [Hugging Face API](https://github.com/bansal-yash/col106-data-structures-and-algorithms/blob/main/Assignment_7_Corpus_QnA_Tool/part2_final/api_hugchat.py): `Assignment_7_Corpus_QnA_Tool/part2_final/api_hugchat.py`

### Other components

- **User**
- **Model service**

## Connections

- User → Set operations: requests set operations
- User → Postfix calculator: enters postfix expression
- Postfix calculator → Stack A: uses stack variant
- Postfix calculator → Stack B: uses stack variant
- Postfix calculator → Stack C: uses stack variant
- User → Banking operations: submits banking operations
- Banking operations → Chaining hash: selects hash strategy
- Banking operations → Linear probing: selects hash strategy
- Banking operations → Quadratic probing: selects hash strategy
- Banking operations → Cubic probing: selects hash strategy
- User → Evaluator entry: submits expression
- Evaluator entry → Expression evaluator: dispatches evaluation
- Expression evaluator → Parse tree: uses parse tree
- Expression evaluator → Symbol table: consults symbols
- Expression evaluator → Unlimited rationals: evaluates rational operations
- Unlimited rationals → Unlimited integers: uses integer arithmetic
- User → Expression compiler: submits program
- Expression compiler → Expression parser: parses statements
- Expression parser → Expression tree: builds expression tree
- Expression parser → Compiler symbols: updates symbols
- Expression compiler → Memory heap: uses memory allocation
- User → Document dictionary: provides document words
- User → Sentence search: submits search pattern
- User → Q&A workflow: asks corpus question
- Q&A workflow → Paragraph index: indexes paragraph terms
- Q&A workflow → BM25 ranking: ranks relevant paragraphs
- BM25 ranking → Q&A workflow: returns ranked context
- Q&A workflow → ChatGPT API: dispatches answer request
- Q&A workflow → Hugging Face API: dispatches answer request
- ChatGPT API → Model service: calls model API
- Hugging Face API → Model service: calls model API
