473,399 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

finding uncommon elements from 2 array

Hi ,
I have two character arrays, I want to get the all the elements from 2nd array which are not in 1st array. Can some one help.



thanks
goldy
May 31 '07 #1
4 3712
AdrianH
1,251 Expert 1GB
Hi ,
I have two character arrays, I want to get the all the elements from 2nd array which are not in 1st array. Can some one help.



thanks
goldy
We are here to help, but only those who help themselves (by attempting the work). What have you done so far on the problem? What are you having difficulty with?


Adrian
May 31 '07 #2
weaknessforcats
9,208 Expert Mod 8TB
Are you able to write down on a piece of paper the steps you would follow to do this with two arrays that are also written on paper?

Often, you can code from a description. It's kind of a poor man's desiogn specification. Rarely, however, can you code straight out of your head.
May 31 '07 #3
Silent1Mezzo
208 100+
A quick and dirty way to do it would be to loop through each of the elements in the 2nd array and check each one with all of the elements in the first array. If none of the elements in the first array matches you know it isn't in there.

Theres definately better way's to do this...
May 31 '07 #4
JosAH
11,448 Expert 8TB
Hi ,
I have two character arrays, I want to get the all the elements from 2nd array which are not in 1st array. Can some one help.



thanks
goldy
If the two arrays aren't sorted all you can do is check every element in array2
and see if it is present in array1; if it is, skip it, if it isn't store it somewhere.
If you're using C++ you can use a vector or list for that purpose and use some
if its fine functionality; if you're using C you're stuck with arrays and a bit of
memory management.

kind regards,

Jos
May 31 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: slickn_sly | last post by:
int find_index_of_min( float num, int arraySize ) { int index, min; min = 0; for( index = 1; index < arraySize; index++ ) { if( num > num ) { min = index;
9
by: Harsha Srinath | last post by:
Athough this might not be directly relayed to C syntax, I thought some of you may find this an interesting problem :- 1.One number, in an array integers from 1 to 1,000,000 is present twice. How...
19
by: gk245 | last post by:
Trying to write a program that will figure out if a number is perfect or not. Here is my logic: 1) Read in the number 2) Split it up (number - 1) 3) Put all the split up numbers into an...
2
by: equinox1248 | last post by:
Hi, I thought this would be answered several time in this group, but I couldn't find anything relevant. What would be the most efficient way of calculating sum of absolute values of two...
1
by: psmahesh | last post by:
Hi folks, I am comparing two arrays and removing matches from the second array from the first array. Can someone take a look at this code below and mention if this is okay and perhaps if there...
4
by: deLenn | last post by:
Hi, Does scipy have an equivalent to Matlab's 'find' function, to list the indices of all nonzero elements in a sparse matrix? Cheers.
4
by: Sandman | last post by:
Hi, So I have 2 arrays: one contains userids. It may look like: user_id =12, user_id =30, user_id =43 The other is a multi-dimensional array with fields like: user_info = Array (
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
2
by: awaisworld13 | last post by:
I want to write a program which take input and save the poistions of the array elements in another array. let if i enter an array A= 4 A=1 A=2 A=3 now the output array will hold 1 2 3
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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...

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.