Skip to content

GalHillel/C-Course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C Programming Course - University Assignments

This repository contains professionally refactored C programming assignments completed as part of a university course. The code has been enhanced with comprehensive documentation, improved naming conventions, and industry-standard practices while preserving all original functionality.

📋 Table of Contents

🎓 Project Overview

This repository showcases fundamental and advanced C programming concepts through four comprehensive assignments:

  • Data Structures: Graphs, linked lists, priority queues
  • Algorithms: Dijkstra's algorithm, TSP, Floyd-Warshall, insertion sort
  • Number Theory: Prime numbers, Armstrong numbers, palindromes, strong numbers
  • String Processing: Substring matching, similarity detection

All code has been professionally refactored with:

  • ✅ Clear, descriptive variable and function names using snake_case
  • ✅ Comprehensive documentation for all functions
  • ✅ Header guards and modular design
  • ✅ Optimized algorithms
  • ✅ Clean, readable code structure

🛠️ Tech Stack

  • Language: C (C99 standard)
  • Compiler: GCC
  • Build Tool: Make
  • Libraries: Standard C library (stdio.h, stdlib.h, string.h, math.h, limits.h)

📁 Assignment Structure

Assignment 1: Number Classification

Location: Assignment-1/

Description: Implements algorithms to identify special numbers (Armstrong, palindrome, prime, and strong numbers) within a given range.

Key Files:

How to Run:

cd Assignment-1
make
./mains < inputs/input1.txt

Features:

  • Armstrong number detection (narcissistic numbers)
  • Palindrome number identification
  • Prime number checking with optimized algorithm
  • Strong number verification (factorial sum equals number)

Assignment 2: Graph Shortest Paths

Location: Assignment-2/

Description: Implements Floyd-Warshall algorithm to find shortest paths between all pairs of nodes in a weighted graph.

Key Files:

  • my_mat.h - Graph operations interface
  • my_mat.c - Floyd-Warshall implementation
  • main.c - Interactive graph query system

How to Run:

cd Assignment-2
make
./prog

Commands:

  • A - Insert 10x10 adjacency matrix
  • B i j - Check if nodes i and j are linked
  • C i j - Find minimum distance between nodes i and j
  • D - Exit

Features:

  • All-pairs shortest path computation
  • Efficient Floyd-Warshall algorithm
  • Interactive query system

Assignment 3: Sorting & Text Processing

Location: Assignment-3/

Description: Implements insertion sort and advanced text processing functions for substring and word similarity detection.

Key Files:

How to Run:

cd Assignment-3
make

# Run sorting
./mainS < input_numbers.txt

# Run text finder
./mainT < input_text.txt

Features:

  • Insertion sort with element shifting
  • Substring detection
  • Word similarity check (one character difference)

Assignment 4: Advanced Graph Algorithms

Location: Assignment-4/

Description: Comprehensive graph library implementing Dijkstra's shortest path algorithm and Traveling Salesman Problem (TSP) solution.

Key Files:

How to Run:

cd Assignment-4
make
./graph

Commands:

  • A n v1 v2 ... - Build graph with n nodes
  • B src dest - Add edge from src to dest
  • D id - Delete node with ID id
  • S src dest - Find shortest path from src to dest
  • T n v1 v2 ... - Solve TSP for specified nodes

Features:

  • Dynamic graph construction
  • Dijkstra's shortest path algorithm with priority queue
  • TSP solution using permutation-based approach
  • Weighted directed graph support

🚀 How to Run

Prerequisites

  • GCC compiler
  • Make build tool

General Steps

  1. Clone the repository:

    git clone https://github.com/YOUR_USERNAME/C-Course.git
    cd C-Course
  2. Navigate to an assignment:

    cd Assignment-X
  3. Build the project:

    make
  4. Run the program:

    ./executable_name
  5. Clean build artifacts (optional):

    make clean

Example Workflow

cd Assignment-1
make clean && make
echo "1 1000" | ./mains

📝 Code Quality

This codebase follows professional standards:

  • Naming Conventions: Consistent snake_case for all C functions and variables
  • Documentation: Every function includes detailed doc comments explaining parameters, return values, and purpose
  • Header Guards: All header files use proper include guards
  • Memory Management: Proper allocation and deallocation of dynamic memory
  • Modularity: Clear separation of concerns across multiple files
  • Error Handling: Input validation and edge case handling

📄 License

This project is academic work completed for university coursework. Please respect academic integrity policies when referencing this code.


Author: University Student
Course: C Programming
Year: 2024

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published