Giter VIP home page Giter VIP logo

cp-travel's Introduction

Data Structures and Algorithms Study Log

Overview

This repository serves as a log for my journey in learning and practicing data structures and algorithms. It is structured around exercises and examples from notable texts in the field, including "Introduction to Algorithms, Fourth Edition" and "Competitive Programming Volumes 1 and 2" by Helix Hamin.

Repository Structure

The repository is organized into two main directories:

  • CP-Volumen1: Contains chapters and exercises related to Competitive Programming Volume 1.
  • Estructuras_Algoritmos: Includes exercises and examples focusing on various data structures and algorithms.

Each chapter directory contains problem sets, source code, input/output files, and a dedicated Makefile for compiling and testing the code.

Directory Structure

.
├── CP-Volumen1
│   ├── Chapter#1
│   │   ├── Chapter1.md
│   │   ├── input.txt
│   │   ├── Kattis
│   │   ├── Makefile
│   │   ├── output_expected.txt
│   │   ├── output.txt
│   │   ├── UVA
│   │   └── Varios
│   └── Chapter#N
├── Estructuras_Algoritmos
│   ├── Chapter#1
│   └── Chapter#N
└── LICENSE

How to Use

Compilation

The repository is configured with a Makefile that includes default values for the problem type (t) and problem number (n), which are set to 'u' (UVA) and '1', respectively. These values can be overridden by specifying them when running the make command.

The Makefile is set up to dynamically select source directories and files based on the type of problem (UVA or Kattis). The following is a simplified explanation of the Makefile's compilation process:

  • Directory Configuration: Automatically determines the working directory paths for UVA and Kattis problem files.
  • Compiler Settings: Uses g++ for compiling C++ files.
  • Source and Executable Configuration: Depending on the problem type (t), it selects the appropriate source directory and source file. It compiles the source file into an executable named a.out in the same directory.

To compile a solution, use the command:

make compile t=[u/k] n=[problem_number]

Where:

  • t specifies the type of problem (u for UVA, k for Kattis), default is 'u'.
  • n is the problem number, default is '1'.

This setup allows for flexible compilation based on the problem source and type, streamlining the process for different problem sets.

Running Solutions

The Makefile includes several rules for running and testing the compiled solutions, accommodating both detailed checks against expected outputs and quicker execution checks without comparison.

Detailed Testing

These commands execute the compiled solution, redirecting input.txt as input and comparing the actual output against output_expected.txt to verify correctness:

  • For UVA problems:

    make run_uva
  • For Kattis problems:

    make run_kattis

The outputs are written to output.txt and then compared to output_expected.txt using the diff command. Any differences are displayed, indicating discrepancies from expected results.

Quick Testing

For rapid testing without output verification:

  • General execution command (chooses based on t variable):

    make run
  • Execute UVA solution:

    make runu
  • Execute Kattis solution:

    make runk

These commands directly run the compiled executable a.out, which can be useful for quick checks or debugging.

Cleaning Up

To remove all compiled and temporary files from both the UVA and Kattis directories, use:

make clean

This command cleans the directories by removing all .o and .out files, helping maintain a tidy workspace.

cp-travel's People

Contributors

julianvb03 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.