search

Introduction

A recent assignment in my Advanced Programming class (CSIS 352) required me to implement a sorting algorithm, and do some basic analysis of the algorithm. I already had some code from the previous class (Intro to Computers and Programming II CSIS 252) that allowed me to specify a few parameters, and do some simple comparisons quite quickly.

By modifying that code slightly, and making it easier (still working on this part, but it's fairly easy now) to add new algorithms I had a nice utility for showing different timing information for different sorting algorithms on a randomly created array.

Download

To download the source code it is easiest to use subversion. Simply use subversion to check out the trunk of the repository:

svn co http://svn.alunduil.com/svn/search/trunk search

The code is also browse-able online at my subversion repository.

INSTALL

This program was created using Gentoo Linux with a 2.6.19 gentoo sources kernel revision 5 on an X86_64 architecture. The compiler used for building and testing is gcc version 4.1.1 release 3 in the portage tree provided by Gentoo.

To build this program, simply type 'make' which creates the default executable, search.

Description

This program utilizes the following algorithms and data types:

  1. bubblesort
  2. comb sort
  3. quicksort

Input and Output

Input

See help for more information, but a standard usage example is shown:

./search -n 1000 -t 3 -s quick

This performs quicksort on a 1000 element array (randomly generated) and averages over three trials.

Output

The program outputs the average number of seconds to run the sorting routine on the array.

Example:

./search -n 1000 -t 3 -s quick
The average time to run the quicksort is 0(s)

Program Testing

The program has shown correct results for all implemented algorithms, and should be easy to add additional algorithms to the utility.

Bugs

No known bugs are in this program.

If bugs are found please email Alex Brandt with a bugreport.