Ian Burres wrote:I am putting together a program that will compare the elements in several arrays, with one array holding values entered by the user, and then store all common elements in a final array.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:It would probably be easier to compare the three arrays I already have, but I want the user to be able to enter his/her own values, which would then be compared against them.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:I want multiple copies if duplicates.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:I can use any object of type Comparable. Big O(n) is worst case scenario. If there are nested loops I might have n^2 or even n^3. So of there are 5 sets with 10 elements then I would have 10(5-1). If its squared, I would have (5-1) * 10^2 That's 50 comparisons for linear and 500 for quadratic.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:The pre generated lists that is...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:I made some modifications. Now all I'm concerned with is getting the actual results. Frustrated beyond all belief right now.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:I'm getting a return for the number of comparisons, but it's always the same value. I'm also still having trouble getting the common elements among the sets. Getting closer though.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:By the way, I cannot use Hash tables. More specifically: Each collection will be represented as an array of objects of type Comparable.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:By the way, I cannot use Hash tables. More specifically: Each collection will be represented as an array of objects of type Comparable.
Ian Burres wrote:True Mike. I've gone back to the drawing board. I now have two classes; a driver and the CommonElements class. I'm using predeclared arrays and the findCommonElements method does one thing and thing only. I'll post it shortly. Thanks guys
and the findCommonElements method does one thing and thing only
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ian Burres wrote:I took out the static and changed the setter to this.comparisons = comparisons;
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Whose rules are you playing by? This tiny ad doesn't respect those rules:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|