Home
News
Feed
search engine
by
freefind
advanced
Histogram_Distribution_Finder
2015-01-13
azim58 - Histogram_Distribution_Finder import java.util.*; /* * The purpose of this class is to take a list of numbers, and then to create * the most complex distribution. In other words, the purpose is to create * the distribution with the maximum number of bins with different numbers * of elements in them. */ public class Histogram_Distribution_Finder { private UsefulTools useful_tools = new UsefulTools(); private int lower_bound = 1; private int upper_bound = 65536; private int number_of_bins_with_different_number_of_elements = 0; private Histogram_Distribution most_complex_distribution = new Histogram_Distribution(); /** * @param args */ public static void main(String[] args) { TODO Auto-generated method stub Histogram_Distribution_Finder hdf = new Histogram_Distribution_Finder(); hdf.testClass1(); } public void testClass1() { Histogram_Distribution_Finder hdf = new Histogram_Distribution_Finder(); hdf.searchRangeOfDistributions(useful_tools.stringWithCommasToArrayList("2, 3,5,7,11,13,17,19,23,2931,37,41,43,47,53,59,61,67,7173,79,83,89,97,101,103, 107,109,113127,131,137,139,149,151,157,163,167,173179,181,191,193,197,199,2 11,223,227,229233,239,241,251,257,263,269,271,277,281283,293,307,311,313,31 7,331,337,347,349353,359,367,373,379,383,389,397,401,409419,421,431,433,439 ,443,449,457,461,463467,479,487,491,499,503,509,521,523,541")); hdf.getMostComplexDistribution(); } public void searchRangeOfDistributions(ArrayList raw_numbers) { this.number_of_bins_with_different_number_of_elements = 0; int comparison_number_of_bins_with_different_number_of_elements = 0; for(int i=lower_bound; i<upper_bound; i++) { Histogram_Distribution hd = new Histogram_Distribution(); hd.createDistribution(i, raw_numbers); comparison_number_of_bins_with_different_number_of_elements = hd.getNumberOfBinsWithDifferentNumberOfElements(); if(comparison_number_of_bins_with_different_number_of_elements>this.number_ of_bins_with_different_number_of_elements) { we've found a more complex distribution most_complex_distribution = hd; this.number_of_bins_with_different_number_of_elements = comparison_number_of_bins_with_different_number_of_elements; } } } public Histogram_Distribution getMostComplexDistribution() { return most_complex_distribution; } }
azim58wiki: