473,246 Members | 1,943 Online

# 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()
-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.
-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.