Algorithms-1 โ Course Assignments & Lab Tests
Project Overview:
- Purpose: Collection of C solutions for Algorithms course assignments and lab tests.
- Language: Primarily C source files (.c).
- Structure: Each assignment (A0..A7) and lab test has its own folder containing problem files.
Directory Structure
A0 - PDS-Brushup/: brush-up problems and small practice exercises.A1 - Algorithm-Runtimes/: runtime/complexity problems and implementations.A2 - Recursion-DnC/: recursion and divide-and-conquer problems.A3 - Greedy-Algorithms/: greedy algorithm problems.A4 - Dynamic-Programming/: dynamic programming problems.A5 - Binary-Trees/: binary tree related exercises.A6 - Heap-Implementation/: heap data structure implementation.A7 - Graph-Algorithms/: graph algorithms and related problems.Lab-Test-1/: lab test 1 solutions.Lab-Test-2/: lab test 2 solutions.Slides/: course slides and supporting materials.
Files by Folder (present in repository)
-
A0 - PDS-Brushup/:A0-Q1.cA0-Q2-v1.cA0-Q2-v2.cinput.txt
-
A1 - Algorithm-Runtimes/:A1-Q1-P1.cA1-Q1-P2.cA1-Q2-P1.cA1-Q2-P2.c
-
A2 - Recursion-DnC/:A2-Q1.cA2-Q2.c
-
A3 - Greedy-Algorithms/:A3-Q1.cA3-Q2.c
-
A4 - Dynamic-Programming/:A4-Q1.cA4-Q2.c
-
A5 - Binary-Trees/:A5-Q1.cA5-Q2.c
-
A6 - Heap-Implementation/:A6-Q1.c
-
A7 - Graph-Algorithms/:A7-Q1.cA7-Q2.c
-
Lab-Test-1/:LT1-Q1.cLT1-Q2.cLT1-Q3.c
-
Lab-Test-2/:LT2-Q1.cLT2-Q2.cLT2-Q3.c
What you'll find in each assignment folder
- C source files: Implementations of the assigned problems. Filenames indicate assignment and question numbers.
- Multiple versions: Some problems include multiple solution versions (e.g.,
A0-Q2-v1.candA0-Q2-v2.c) โ these are alternative approaches or iterative attempts. - Input files: Where present (e.g.,
input.txtin A0), they provide sample input for testing.
How to compile and run (macOS / zsh)
-
Compile a single C file:
gcc -o <output_name> <source_file.c>Example:
gcc -o A0-Q1 A0\ -\ PDS-Brushup/A0-Q1.c -
Run an executable (optionally with redirected input):
./A0-Q1 < "A0 - PDS-Brushup/input.txt" -
Compile all .c files in a folder:
gcc -std=c11 -O2 -Wall -Wextra -o program *.c