473,246 Members | 1,943 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,246 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 4122
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

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.