Skip to content

vicegd/algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

267 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Algorithms: A Comprehensive Educational Repository

A collection of algorithm implementations covering fundamental computer science concepts. This project is designed as an educational resource for students learning algorithmic problem-solving through practical code examples.

Course: Algorithmics | Institution: School of Computer Science | University of Oviedo


πŸš€ Quick Start

Prerequisites

  • Java 21+ (project compiles with Java 21)
  • Maven 3.6+ (tested with 3.9+, uses plugins requiring 3.6+)
  • JUnit 5.10.2 (managed automatically by Maven)
  • Git (optional)

Installation & Setup

# Clone the repository
git clone <repository-url>
cd algorithms

# Build the project
mvn clean compile

# Run all tests
mvn test

# Run a specific test class
mvn test -Dtest=YourTestClassName

Project Structure

algorithms/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/java/topics/               # Algorithm implementations
β”‚   β”‚   β”œβ”€β”€ introduction/               # Getting started, recursion, search, data structures
β”‚   β”‚   β”‚   └── examples/               # Java Collections examples (ArrayList, Stack, TreeSet…)
β”‚   β”‚   β”œβ”€β”€ sorting/                    # Sorting algorithms
β”‚   β”‚   β”‚   β”œβ”€β”€ others/                 # Additional sorts (Heapsort, Radix, Shell, Bidirectional…)
β”‚   β”‚   β”‚   └── utils/                  # Shared sorting utilities & interface
β”‚   β”‚   β”œβ”€β”€ divideconquer/              # Divide & Conquer strategies
β”‚   β”‚   β”‚   └── utils/                  # Shared D&C utilities
β”‚   β”‚   β”œβ”€β”€ dynamic/                    # Dynamic Programming
β”‚   β”‚   β”œβ”€β”€ greedy/                     # Greedy Algorithms
β”‚   β”‚   β”‚   └── agentsTasks/            # Agent-task assignment timing helpers
β”‚   β”‚   β”œβ”€β”€ backtracking/               # Backtracking techniques
β”‚   β”‚   β”‚   └── times/                  # Timing / benchmark helpers
β”‚   β”‚   β”œβ”€β”€ branchandbound/             # Branch & Bound methods
β”‚   β”‚   β”‚   β”œβ”€β”€ times/                  # Timing / benchmark helpers
β”‚   β”‚   β”‚   └── util/                   # Core B&B framework (Heap, Node…)
β”‚   β”‚   β”‚       └── threads/            # Thread-safe B&B variants
β”‚   β”‚   └── parallel/                   # Parallel algorithms (ForkJoin)
β”‚   └── test/java/topics/               # Unit tests (JUnit 5)
β”œβ”€β”€ .github/                            # GitHub configuration
β”‚   └── workflows/                      # CI/CD pipelines
β”‚       └── javadoc.yml                 # Publish Javadoc to GitHub Pages
β”œβ”€β”€ .editorconfig                       # Editor formatting rules
β”œβ”€β”€ .gitignore                          # Git ignore patterns
β”œβ”€β”€ pom.xml                             # Maven configuration
β”œβ”€β”€ README.md                           # This file
β”œβ”€β”€ CONTRIBUTING.md                     # Contribution guidelines
β”œβ”€β”€ CHANGELOG.md                        # Release history
└── LICENSE                             # MIT License

πŸ“š Core Topics & Algorithms

1. Foundations of Algorithms

Main implementations:

  • Array Summation
  • Factorial Computation
  • Foundational Arithmetic Engine
  • Maximum Value Extraction
  • MaxPairWiseProduct problem with 6 different implementations showing optimization progressions
  • Random Dataset Generator
  • Search Algorithms

πŸ“– Learn more: See Foundations of Algorithms


2. Sorting Algorithms

Main implementations:

  • Bidirectional Bubble Sort (Cocktail Shaker Sort)
  • Binary Insertion Sort Algorithm
  • Bubble Sort Algorithm (Left-Bubbling)
  • Bubble Sort Algorithm (Optimized with Sentinel)
  • Direct Insertion Sort Algorithm
  • Direct Selection Sort Algorithm
  • Heapsort Algorithm
  • Mergesort Algorithm
  • Quicksort Algorithm (Median-of-Three)
  • Radix Sort Algorithm (LSD - Least Significant Digit)
  • Shellsort Algorithm

πŸ“– Learn more: See Sorting Algorithms


3. Divide & Conquer

Main implementations:

  • Searching: Binary Search
  • Mathematical: Fibonacci, Factorial, GCD
  • Array Operations: Vector Sum, Mergesort, Quicksort
  • Statistical: Median, Mode, Majoritarian Element, Max Sum

πŸ“– Learn more: See Divide and Conquer


4. Greedy Algorithms

Main implementations:

  • Coin Change (Optimal vs Non-Optimal)
  • Knapsack Problem variants
  • File Disk Optimization
  • Agent Task Assignment
  • Chess Horse Movement

πŸ“– Learn more: See Greedy Algorithms


5. Dynamic Programming

Main implementations:

  • Fibonacci Sequence
  • 0/1 Knapsack Problem
  • Coin Change Problem
  • Combinations/Permutations
  • River Travel Optimization

πŸ“– Learn more: See Dynamic Programming


6. Backtracking

Main implementations:

  • Permutations Generation
  • Subset Sum Problem
  • The Knight's Tour Problem (All Solutions)
  • The Knight's Tour Problem (First Solution)
  • The N-Queens Problem (All Solutions)
  • The N-Queens Problem (First Solution)

πŸ“– Learn more: See Backtracking


7. Branch & Bound

Main implementations:

  • Task Assignment Problem
  • The 8-Puzzle Problem
  • Optimal Placement of Rectangles
  • Optimal Placement of Rectangles (Concurrent Execution)

πŸ“– Learn more: See Branch and Bound


8. Parallel Algorithms

Main implementations:

  • Naive Recursive Fibonacci
  • Parallel Array Transformation (Fork/Join)
  • Parallel Array Squaring (Fork/Join)
  • Parallel Array Summation (Fork/Join)
  • Parallel Fibonacci (Fork/Join)
  • Parallel File Processing (Fork/Join)

πŸ“– Learn more: See Parallel Algorithms


πŸ§ͺ Testing

The project includes comprehensive unit tests using JUnit 5.

# Run all tests with verbose output
mvn test -X

# Run tests for specific topic
mvn test -Dtest=sorting/*Test

# Run with coverage report (if configured)
mvn test jacoco:report

πŸ“– Additional Resources


πŸ“š Documentation & Resources

To keep the repository organized and secure, our documentation is divided into the following files:

  • πŸ“– Contributing Guide: Coding standards and how to participate.
  • 🀝 Code of Conduct: Guidelines for a healthy and welcoming educational environment.
  • πŸ›‘οΈ Security Policy: Possible algorithmic vulnerabilities and how to report them.
  • ⏱️ Changelog: Version history and the evolution of the codebase since 2015.

πŸ‘¨β€πŸ’Ό Author

Vicente GarcΓ­a DΓ­az
School of Computer Science
University of Oviedo


πŸ“œ License

MIT License β€” Copyright (c) 2016 Vicente GarcΓ­a DΓ­az
See LICENSE file for details

About

This repository contains example algorithms initially designed for the Algorithmics course taught at the School of Computer Science, University of Oviedo.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages