Blogged by: L N Aggrawal
Today we have discussed about lab work. Suppose if the program is of bubble sort. The question
will be divided in five parts i.e
1. Display the content of array.
Here, Array can be globally or locally initialized. Create a function which display the values of
array.
2. Swap the two values of array.
Here, You have to pass two position of array in a swap function. With using temp variable you
can simply swap the values.
3. One pass of bubble sort.
Here, by using loops and swap function you can perform this operation. The operation is done in
a function onepassbubblesort.
4. Bubble Sort.
Here , in bubblesort function write the code I this function using swap function and loops.
5. Optimization or Switch Flag.
Even we discussed about the if condition concepts. You have to look every aspects of the condition
applied to the expression. Later at the end we discussed about quick sort i.e
1. If there is three arrays. One contains the complete array array1. The other two arrays i.e higher
array which store greater value as compared to first element of array1. The other array lower
contains value less that the first element. How this can be done?
2. How the above will be done using one additional array?
No comments:
Post a Comment