A collection of three algorithmic problems solved as part of the Algorithm Analysis and Synthesis (ASA) course at Instituto Superior TΓ©cnico. Each project implements efficient solutions to complex computational problems with emphasis on time complexity, space optimization, and competitive programming techniques.
Institution: Instituto Superior TΓ©cnico
Course: AnΓ‘lise e SΓntese de Algoritmos (Algorithm Analysis and Synthesis)
Academic Year: 2024/2025
Language: C++ (primary), Python (Project 3)
Evaluation: Mooshak automated testing system
Deadline: December 6, 2024
Archaeologist JoΓ£o Caracol discovered ancient tables defining binary operators and sequences of operations without parentheses. The challenge is to determine if it's possible to parenthesize a sequence of integers using a custom binary operator to achieve a desired result, and if so, output the leftmost valid parenthesization.
- Dynamic Programming: Matrix chain multiplication variant
- Custom Binary Operators: Operator tables defining non-standard operations
- Optimal Substructure: Finding leftmost parenthesization
- Complexity: O(nΒ³) time, O(nΒ²) space
- Operator table (nΓn matrix)
- Sequence of m integers
- Target result value
1followed by leftmost parenthesization if possible0if no valid parenthesization exists
Input:
2 4
1 2
2 1
1 2 2 1
1
Output:
1
(((1 2) 2) 1)
Deadline: December 20, 2024
The municipality of CaracolΓ’ndia commissioned a study to assess their metro network efficiency inspired by the 15-minute city concept. Calculate the metro connectivity (mc) index, which represents the maximum number of line changes needed to travel between any two stations in the network.
- Graph Theory: Multi-graph representation of metro networks
- Modified BFS: Tracking line changes instead of distance
- Connectivity Analysis: Finding maximum minimum line changes
- Special Cases: Disconnected networks, single-line networks
- n stations, m connections, l lines
- List of connections: station x, station y, line l
- Metro connectivity index (maximum minimum line changes)
0if no line changes needed-1if network is disconnected
Input:
7 8 3
3 2 1
2 7 1
7 5 1
2 6 2
6 4 2
4 1 2
4 1 3
1 5 3
Output:
1
Deadline: January 9, 2025
Professor Natalino Caracol was hired by UbiquityInc (Santa's company) to optimize toy distribution worldwide. Factories produce specific toys with stock limits, countries have minimum delivery requirements and export limits, and children request toys. Maximize the number of satisfied children while respecting all constraints.
- Linear Programming: Optimization with constraints
- PuLP Library: Python LP solver integration
- Network Flow: Resource allocation problem
- Constraint Satisfaction: Multiple constraint types
- n factories, m countries, t children
- Factory specifications (location, stock)
- Country constraints (min deliveries, max exports)
- Children's toy requests
- Maximum number of children that can be satisfied
-1if constraints cannot be met
- Required: Python with PuLP library
- Solvers: GLPK or LP_solve
C++ Projects (1 & 2)
g++ -std=c++11 -O3 -Wall project.cpp -lm
./a.out < input.txtPython Project (3)
python3 project.py < input.txt- Time Complexity: Optimized for large inputs
- Memory: Limited by Mooshak system
- I/O: Standard input/output only
- Implementation Time: ~15 hours per project
python -m pip install pulp
sudo apt-get install glpk-utils # Ubuntuasa-projects-2024/
βββ project1-parenthesization/
β βββ project1.cpp
β βββ report.pdf
β βββ test-cases/
βββ project2-metro-connectivity/
β βββ project2.cpp
β βββ report.pdf
β βββ test-cases/
βββ project3-toy-distribution/
βββ project3.py
βββ report.pdf
βββ test-cases/
Each project is evaluated in two phases:
- Correctness verification via
diffcommand - Time and memory constraints
- Score range: 0-170 points
- Multiple test cases of increasing difficulty
- Solution description and algorithm analysis
- Theoretical complexity analysis
- Experimental results and performance evaluation
- References and bibliography
- Format: PDF only
- Length: Maximum 2 pages
- Font: 12pt
- Margins: 3cm
- Submission: FΓ©nix platform
- Dynamic Programming
- Graph Algorithms (BFS, DFS)
- Linear Programming
- Greedy Algorithms
- Optimization Techniques
- Problem decomposition
- Complexity analysis (time and space)
- Edge case handling
- Efficient data structure selection
- Competitive programming standards
- Input/output optimization
- Memory-efficient implementations
- Code correctness and robustness
These projects were developed as coursework for academic purposes at Instituto Superior TΓ©cnico.
Developed for the Algorithm Analysis and Synthesis course (2024/2025) at IST.
Note: Test cases and detailed solutions are available after project deadlines. This repository showcases algorithmic problem-solving skills and optimization techniques learned throughout the course.