Matsushita's Blog

Sort

Sort Objects with Comparator

Heap Sort in Java

What is Heap Reference www.youtube.com Heap is the tree structure that has two following restrictions. Binary Tree Parent node is smaller or bigger than children nodes. Heap is good at controlling the relation about small and large. So hea…

Bucket Sort in Java

What is Bucket Sort Bucket Sort is linear sort algorithm. It takes O(N) time. But this algorithm has some restrictions to use. The restrictions are following We know the maximum value in array The maximum value is not too large each elemen…

Sort an array of strings by anagrams

Problem Write a method to sort an array of strings so that all the anagrams are next to each other. Solution This problem asks us to group the strings in arrays such that anagrams appear next to each other. How to find the anagram The feat…