GithubHelp home page GithubHelp logo

assignment-2's Introduction

CSCE 221 Assignment 2

Michael Kosler, Michael Parsons, Doug Lasater
[email protected], [email protected], [email protected]
02/07/2012

Program Description

Assignment 2 deals mainly with the testing various sorting functions, specifically selection sort, insertion sort, bubble sort, shell sort,
and radix sort. The user of the program is required to write in a few command line arguments that tell the program:

  • which sorting algorithm to use;
  • where to get its input source;
  • where to insert the sorted output;

Purpose of the Assignment

In addition to implementing various sorting algorithms, the assignment is trying to show us how different algorithms compare to one another directly.
We are also supposed to see that the algorithms have much different run times based on the size of their input, which gives us a good visualization
of how a run-time function (and asymptotic notation) works in a real world scenario.

Data Structures Description

We are mainly sorting through arrays of integers, so nothing fancy there.

Algorithm Description

  • Selection Sort:
  • Insertion Sort:
  • Bubble Sort:
  • Shell Sort:
  • Radix Sort:

Program Organization and Description of Classes

The program is organized into separate classes for each sorting function. For example, insertion sort is encapsulated within its own class, and bubble
sort is encapsulated within its own class. They all inherit from a superclass, sort, which provides a virtual function sort and a protected variable
num_cmps.

Instructions to Compile and Run Your Program

In the command line:
cd path/to/files/
make

Usage: ./sort [-a ALGORITHM] [-f INPUTFILE] [-o OUTPUTFILE] [-h] [-d] [-t] [-c] Example: ./sort -a S -f input.txt -o output.txt -t -c -d ./sort -h Options: -a ALGORITHM Use ALGORITHM to sort. ALGORITHM is a single character representing an algorithm ‘S’ (selection sort), ‘B’ (bubble sort), ‘I’ (insertion sort), or ‘H’ (shell sort) -f INPUTFILE Obtain integers from INPUTFILE instead of STDIN -o OUTPUTFILE Place output message into OUTPUTFILE instead of STDOUT -h Display this help and exit -d Display input integers before displaying output message -t Display running time of the chosen algorithm in milliseconds -c Display number of element comparisons

Input and Output Specifications

The input files need to be formatted so that the first line in the file is the size of the array of numbers (to be sorted). Then every number in the
array needs to be added to its own line.

The output file is similar to the input file, except it will only print out the sorted numbers, and not worry about the size of the array.

Logical Exceptions

To be completed

C++ Object-Oriented or Generic Programming Features

Our program uses inheritance and polymorphism heavily. The main reason we split the program into classes is to give an easier interface to understand.
Every single sort class has a sort function; every single sort class has a num_cmps variable. We used an abstract class as a pseudo-template for the
subclasses. We also gave the user the oppportunity to test the function against their own inputfiles.

Tests

To be completed

assignment-2's People

Contributors

mkosler avatar mparsons avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar dougiefresh49 avatar  avatar  avatar

assignment-2's Issues

Doug Lasater

I have an issue with this douglas kid...he's a douche. And he talks to his future self and panicks(lul british) about it.

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.