473,671 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find All Duplicates in a List of Numbers - Array implementation

63 New Member
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 4142
weaknessforcats
9,208 Recognized Expert Moderator Expert
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
tuananh87vn
63 New Member
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
1157
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 three of the same number. The numbers are 7 digit numbers with a change index of 2 numbers e.g. 1234567 01.(In seperate columns) The list with no duplicates has the highest change index and the other can have 3 or even 4 different indexes. e.g.
2
364
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 three of the same number. The numbers are 7 digit numbers with a change index of 2 numbers e.g. 1234567 01.(In seperate columns) The list with no duplicates has the highest change index and the other can have 3 or even 4 different indexes. e.g.
18
39991
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 I do
3
4814
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 the Row field, which is returned automatically. and an example of a row that it has returned duplicate. I have verified that the row only shows up 1 time in each select statement when run individually.
21
8137
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 maximum value N 2. loop through 1...N 3. count # times each occurred
5
1536
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 several times.. (I.E.) ======================================== 49-10049 49-10049 49-10049 49-10049 49-10051 49-10051 49-10051 ========================================
3
1479
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 followed by unique numbers. Result for the given example should be: (21, 21, 33, 33, 35, 35, 70, 50)
6
11741
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 that will randomly generate 10 unique random numbers. Your job is to write a program that produces random permutations of the numbers 1 to 10. “Permutation” is a mathematical name for an arrangement. For example, there are six permutations of the...
19
13844
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 below, to do it? ===== <script type="text/javascript"> num = 2; list = ;
0
8472
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8596
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2806
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 we have to send another system
2
2048
muto222
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.