If you are talking about character array then it can be done in space 
O(128)=constant and time O(n),,. as Use Hash table of all 128 characters , 
and then traverse through your array and mark a flag in the hash table..when 
you encounter any duplicate character , which would be marked already in the 
hash table , dont print it..! 

And if its integer array... best would be sort it in O(n logn) and traverse 
through the loop and print those  numbers which are not same as previous 
number..
On Saturday, 10 September 2011 14:51:18 UTC+5:30, Ishan Aggarwal wrote:
>
> Write a program to remove duplicate elements from an array by printing them 
> only once?
>
> What will be the minimum time and space complexity required for this 
> program?
>
> -- 
> Kind Regards
> Ishan Aggarwal
> [image: Aricent Group]
> Presidency Tower-A, M.G.Road,Sector-14
> Gurgaon,Haryana.122015 INDIA
> Phone : +91-9654602663
> ishan2....@aricent.com
>
>  

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/TqJhP_DAD2AJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to