473,396 Members | 2,055 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,396 software developers and data experts.

Find All Duplicates in a List of Numbers - Array implementation

Hi ! can anyone help me with the following topic:

Find All Duplicates in a List of Numbers - Array implementation - -InitializeTree()
-AddNode()
-Add into this programs one function which counts all duplicates by using a binary search tree implemented as an array (note: set the array size to 5,000,000 or larger).


I think that it is better to use linked-list to implement binary search tree. However, my teacher gave me this topic and asked me to use array to implement BST. oh my god, can any one help me? the deathline for me is Sunday, December 9th.
Dec 7 '07 #1
2 4126
weaknessforcats
9,208 Expert Mod 8TB
All you have to do is set up an array, like:
Expand|Select|Wrap|Line Numbers
  1. int arr[100];
  2.  
Initialize all of the elements to 0.

Then read your list of numbers. If the number was 23, then increment arr[23].

When you are done, all zero elements didn't exist, all 1 elements have no duplicates, etc.
Dec 7 '07 #2
All you have to do is set up an array, like:
Expand|Select|Wrap|Line Numbers
  1. int arr[100];
  2.  
Initialize all of the elements to 0.

Then read your list of numbers. If the number was 23, then increment arr[23].

When you are done, all zero elements didn't exist, all 1 elements have no duplicates, etc.
Thanks for your help, however,you know, I have to use a binary search tree (array implementation) to find the duplicated number. So weaknessforcats, can you plz help me with this exercise. To my knowledge, I think we have to folow these steps:
-Initialize an empty binary search tree.
-Read number by number .
-Each time compare the number with the contents of the tree, if it is found duplicated, then output, otherwise add it to the tree.

Unfortunately, I don't exactly know how to create and maintain a binary search tree using array :( The deathline is comming up, could you plz help me as soon as possible. If anyone had done this exercise before, could you plz share your sourcode to me.
My email address is kakahaohiep_ht@yahoo.com
I'm looking forward to receive your reply.
Best Wish
Dec 7 '07 #3

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

Similar topics

0
by: Les Stout | last post by:
I am not a programmer, so please bear with me. I have 2 tables with part numbers on and other relevant information. the one list does not have duplicate numbers, but the other has sometimes...
2
by: Tempy | last post by:
I am not a programmer, so please bear with me. I have 2 tables with part numbers on and other relevant information. the one list does not have duplicate numbers, but the other has sometimes...
18
by: Mike Bartels | last post by:
Hi Everyone! I have two Arrays A and B. Both arrays are byte arrays with 7 bytes each. The contents of array A and B are the same A = {1, 2, 3, 4, 5, 6, 7}; B = {1, 2, 3, 4, 5, 6, 7}; When...
3
by: Sim Zacks | last post by:
I am using 8.0 beta 1 on an RH 8 Linux server. I have a union query that I am converting from access (where it worked) and it is returning duplicates. The only difference between the two rows is...
21
by: Imran | last post by:
I have a vector of integers, such as and I want to find out the number which occurs most frequently.what is the quick method. My array size is huge. what I am doing is 1. find out the...
5
Chrisjc
by: Chrisjc | last post by:
I only took a class on VB because I had to for school I don't recall all to much of it.. But I have a job now doing database administration. And I have to sort part numbers that are duplicated...
3
by: ashimk1 | last post by:
Hi All, I have an array that contains duplicates as well unique numbers. ex- (21, 33, 35, 21, 33, 70, 33, 35, 50) I need to arrange it in such a way that all the duplicates will come up first...
6
by: badcrusher10 | last post by:
Hello. I'm having trouble figuring out what to do and how to do.. could someone explain to me what I need to do in order to work? THIS IS WHAT I NEED TO DO: Professor Snoop wants a program...
19
by: Mike | last post by:
I have a list of numbers, e.g., (1,3,4,5,8,16,20), and am trying to create a simple IF statement to see if the value is in that list. Is there an easier or more efficient way, than the sample code...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.