PHYS 130 Lecture 14: MATH 126 Notes - gytqmoortwfdaee
Document Summary
The algorithm for having the complexity o(n),for the data elements, so that, the false key precedes true elements is as given below: // function to preceding the elements void bucketsort ( array[ ], int num ) The extra space is declared and used for the true, and false data elements. // the constant extra space is declared. int count[ 2 ]; // declare variable of int data type int i, j, k; // loop to initialize the counter variable for ( i = 0; i < 2; i++ ) // zero is initialized to all three spaces. The values of the true, and false elements is calculated by using the for() loop. // loop to increase the counter value of the corresponding key for ( i = 0, i < num; i++ ) // condition to calculate the false elements if ( array[ i ] == false ) // the key values is reset k = 0;