Blog Archives

Randomness

Randomness is an important computational resource, just as running time and memory space. Randomness sometimes is essential for designing algorithms. Randomness is useful! Quick Select In quick sort, a random pivot selection has the property that, for any input data,

Tagged with: , , ,
Posted in Algorithm, Java

Quick Sort

Quick sort is to partition the array around one element and then sort each part recursively. Pick up one element as the pivot Move all elements less than the pivot to the left, and all elements greater than the pivot

Tagged with: , ,
Posted in Algorithm, Java

Merge Sort

Consider the problem of sorting an array of numbers in order. Merge sort is to recursively divide the array in half, and then recombine the sorted subarrays. Divide the array in half. Recursively divide until each subarray has only one

Tagged with: , ,
Posted in Algorithm, Java

Selection, Insertion and Bubble Sort

Sorting — arranging items in order — is the most fundamental task in computation. Sorting enables efficient searching algorithms such as binary search. Selection, insertion and bubble sort are easily understandable and also similar to each other, but they are

Tagged with: , , ,
Posted in Algorithm, Java