qsortcode

qsortcode - /* @file qsortcode.cpp @author William Duncan...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** @file qsortcode.cpp @author William Duncan @date 2005-10-01 Description: implementation of the quicksort function along with auxilliary functions. Course: CS1254.02 Logon ID: cs1254xx Lab #: 3 Instructor: William Duncan */ #include <iostream> #include "qsortcode.h" using namespace std; /** This function chooses a pivot for quicksort's partition algorithm and swaps it with the first item in an array. @param A an array containing the data. @param F the first index of the array to be sorted. @param L the last index of the array to be sorted. @return the element in the pivot position. */ int ChoosePivot(int A[],int F,int L) { /* ==> You will rewrite this function. But first get the program to work using this simple pivoting. scheme Your Tasks: 0. Leave the function as is so that it uses first-element as pivot and works with only integer data. 1. Rewrite this function so that it chooses the pivot using the median-of-3 strategy and works with only integer data. 2. Templatize this function so that it works with arrays
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

qsortcode - /* @file qsortcode.cpp @author William Duncan...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online