/*************************************************************************** * Copyright (C) 2006 by Alex Brandt * * alunduil@alunduil.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful. * * but WITHOUT ANY WARRANTY: without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc.. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _SORTS_H #define _SORTS_H /** * @brief Partition the array for the quicksort algorithm. * @param a The array we want to partition. * @param first The first place to partition from. * @param last The last place to partition. * @return Integer. */ int partition(int a[], int first, int last); /** * @brief Sort the array from position first to position last. * @param a Array to sort. * @param first The first place to sort from. * @param last The last place to sort. */ void quicksort(int a[], int first, int last); /** * @brief Sort the array. * @param a Array to sort. * @param aSize Size of the array. */ void quicksort(int a[], int aSize); /** * @brief Sort the array. * @param a Array to sort. * @param aSize Size of the array. */ void bubblesort(int a[], int aSize); /** * @brief Calculate the gap for comb sort. * @param gap The old gap to calculate against. * @return The new gap. */ int newGap(int gap); /** * @brief Perform comb sort. * @param a Array to sort. * @param aSize Size of the array. */ void combsort(int a[], int aSize); #endif