468,512 Members | 1,445 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

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 3892
weaknessforcats
9,207 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

Post your reply

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

Similar topics

reply views Thread by Les Stout | last post: by
2 posts views Thread by Tempy | last post: by
3 posts views Thread by Sim Zacks | last post: by
21 posts views Thread by Imran | last post: by
19 posts views Thread by Mike | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.