

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The c++ code for implementing shell sorting and bucket sorting algorithms as part of an assignment for the data structures course csm 388. The code includes the implementation of the shellsort function for shell sorting and the bucketsort function for bucket sorting.
Typology: Lecture notes
1 / 2
This page cannot be seen from the preview
Don't miss anything!


void shellSort(int array[], int size) { int gap, j, k,temp; for(gap = size/2; gap > 0; gap = gap / 2) { //initially gap = n/2, //decreasing by gap / for(j = gap; j<size; j++) { for(k = j-gap; k >= 0; k -= gap) { if(array[k+gap] >= array[k]) break; else 0.]=[-P0;'] -*9/8 temp = array[k+gap]; array[k+gap] = array[k]; array[k] = temp; } } cout <<"\n Using" << gap << " "; gap; printArray(); } }
void bucketSort(int array[],int size) {
vector