This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| public class Example_2_BinarySort { | |
| // Naive Approach | |
| public static void binarySort_Naive(int[] arr) { | |
| // Iterate through the array and count the number of 0's | |
| int zeroes = 0; | |
| for(int value : arr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Arrays; | |
| import java.util.HashMap; | |
| import java.util.Map; | |
| public class Example_1_PairSum { | |
| // Naive Method | |
| public static void findPair_Naive(int[] arr, int sum) { | |
| // Iterate through the array except last element |