aspose file tools*
The moose likes Java in General and the fly likes how to remove duplicates from an array without changing order Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to remove duplicates from an array without changing order" Watch "how to remove duplicates from an array without changing order" New topic
Author

how to remove duplicates from an array without changing order

Mohamed Riyaz
Greenhorn

Joined: May 25, 2003
Posts: 1
Required solution to remove duplicate values from an array without changin order of the data.(Without usage of Collections,Set utilities)
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1824

Hi, Mohamed, and welcome to JavaRanch.
Since this sounds like a school assignment to me, I'll not give you a solution, but instead will try to point you in the right direction. You say you can't use Collections, but is there anything prohibiting you from creating a second array? Think about how you might use a second array to acheive this.
Once you figure out how to acheive this using two arrays, you might realize that this can be done using only the one array (albeit slightly less effeciently, especially if you have to shift the elements in the array whenever you remove an element).
Once you have some code ready, feel free to post if for critiquing/debugging. We'll gladly helpwith that part. (Be sure to surround your code with [ CODE ] and [ /CODE ] tags, as it makes it easier for us all here at the ranch to read.)


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to remove duplicates from an array without changing order