Skip to content

Applications-of-computer-algorithms/Counting-And-Roman-Sort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Sorting Utility

This is a terminal-based application designed to sort numbers using one of two algorithms: Counting Sort or Roman Sort. The program reads input from a file, processes it, and writes the sorted output to a file.


πŸš€ Features

  • πŸ› οΈ Two Sorting Algorithms:
    • 0: Counting Sort
    • 1: Roman Sort
  • πŸ“‚ Input from File: Reads numbers from a file in the same directory as the program.
  • πŸ“€ Output to File: Writes the sorted output to a file (out.txt) in the same directory.
  • πŸ“‰ Handles Negative Numbers: The program can process negative values gracefully.
  • ⚑ Efficient Sorting: Optimized to handle sorting tasks with high performance.

πŸ“‹ How to Use

1. Prepare the Input File

Ensure there is an input file (e.g., input.txt) in the same directory as the program. The file should contain a list of integers separated by spaces or newlines.

2. Run the Program

Use the terminal to execute the program with the following command structure:

./sorting_utility <algorithm_number> <input_file>

Parameters:

  • <algorithm_number>: Specifies the sorting algorithm to use:
    • 0 for Counting Sort
    • 1 for Roman Sort
  • <input_file>: The name of the file containing the numbers to sort.

Example:

./sorting_utility 0 input.txt

This command will use Counting Sort to sort the numbers in input.txt.

3. Check the Output

The sorted numbers will be written to a file named out.txt in the same directory as the program. Open the file to view the results.


πŸ›‘οΈ Requirements

  • C++ Compiler
  • Input file with numbers in the correct format

πŸ“ Notes

  • If the input file is missing or cannot be opened, the program will terminate with an error.
  • The input file must be in the same directory as the program.
  • Negative numbers are supported, and the sorting algorithms handle them properly.

About

Terminal based sorting utility

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages