473,473 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Array Comparisons in Program

Currently i write to an arraylist of (n) lenght. After I collect that
arraylist i have always been dumping the arraylist to a file (excel
spread). This time however i have been asked to create up to 4
arrayslist hold there value and compare all 4 array so that they have
unique values.

Example logic is below:
if my first array holds all unique values then i end
array1(5,6,7,8,9)

if my first array doesn't hold unique value i go another round and get
array2 then compare.
array1(3,4,5,5,6,7)
array2(2,7,7,8,9,1)
i would then take array1 and array2 and average them out to get
another avgarrylist that would hold unique values.
Can someon please help. How can i do this?

Sep 4 '07 #1
4 1043
cmdolcet69 <co************@hotmail.comwrote in
news:11**********************@g4g2000hsf.googlegro ups.com:
Can someon please help. How can i do this?
You could use a hashtable - if you add duplicates into a hashtable you'll
get an exception.
Sep 4 '07 #2
On Sep 4, 3:47 pm, Spam Catcher <spamhoney...@rogers.comwrote:
cmdolcet69 <colin_dolce...@hotmail.comwrote innews:11**********************@g4g2000hsf.googleg roups.com:
Can someon please help. How can i do this?

You could use a hashtable - if you add duplicates into a hashtable you'll
get an exception.

Can i do it with jsut comparing the arrays, i need the simplest and
quickest way of doing this.
i read somthing about an arraylist.sort? How would that work? I want
sort through my original arraylist and see if any duplicte are in the
arraylist.

Sep 4 '07 #3
cmdolcet69 <co************@hotmail.comwrote in
news:11**********************@57g2000hsv.googlegro ups.com:
On Sep 4, 3:47 pm, Spam Catcher <spamhoney...@rogers.comwrote:
>cmdolcet69 <colin_dolce...@hotmail.comwrote
innews:11**********************@g4g2000hsf.google groups.com:
Can someon please help. How can i do this?

You could use a hashtable - if you add duplicates into a hashtable
you'll get an exception.


Can i do it with jsut comparing the arrays, i need the simplest and
quickest way of doing this.
Using a hash table is the simplest.
i read somthing about an arraylist.sort? How would that work? I want
sort through my original arraylist and see if any duplicte are in the
arraylist.
You'll have to compare each element in the list?
Sep 4 '07 #4
Hi,

Assuming that you have version 2005.

Create a generic list instead of an arraylist, that you can do as well in
version 2003, however than you need some casting.

Cor

"cmdolcet69" <co************@hotmail.comschreef in bericht
news:11**********************@g4g2000hsf.googlegro ups.com...
Currently i write to an arraylist of (n) lenght. After I collect that
arraylist i have always been dumping the arraylist to a file (excel
spread). This time however i have been asked to create up to 4
arrayslist hold there value and compare all 4 array so that they have
unique values.

Example logic is below:
if my first array holds all unique values then i end
array1(5,6,7,8,9)

if my first array doesn't hold unique value i go another round and get
array2 then compare.
array1(3,4,5,5,6,7)
array2(2,7,7,8,9,1)
i would then take array1 and array2 and average them out to get
another avgarrylist that would hold unique values.
Can someon please help. How can i do this?
Sep 5 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ritchie | last post by:
Hi all! Still working on this program! Just to recap, I am writing a program to sort an array with four different sort algorythms. I am having a little trouble at the moment though! Now, I...
24
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
37
by: Richard Heathfield | last post by:
candide said: They aren't. An array is an array. An address is a pointer value. These are not the same thing. If you mean that &array and &array are the same, they aren't. They have different...
152
by: vippstar | last post by:
The subject might be misleading. Regardless, is this code valid: #include <stdio.h> void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); } int main(void) { double array = { {...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.