×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    179

    Exclamation duplicate elements in array

    if any one has ever made a function to remove duplicate elements in an string array , in j2me environment.

    pls give it here , i will have to not write it again .

    thanks and regards

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: duplicate elements in array

    Can you make a method of this algo,

    The easiest approach is to make a hash table to keep track of the numbers we've seen so far. Something like this:

    Given an array A of length n,

    let h ← (new hash table)
    for 1 <= i <= n:
    if A[i] is present in h: return A[i]
    set h[A[i]] ← True
    return <no duplicates>
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Regular Contributor
    Join Date
    Jun 2009
    Posts
    179

    Exclamation Re: duplicate elements in array

    "HashSet" class is not available in j2me , otherwise , i would have done.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: duplicate elements in array

    Quote Originally Posted by Arunesh View Post
    "HashSet" class is not available in j2me , otherwise , i would have done.
    Hey come on that is hashtable.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,085

    Re: duplicate elements in array

    try to use - java.util.Hashtable

    for this.

    thanks,
    ~Amitabh

Similar Threads

  1. Error loading connection when obfuscation high?
    By ejakkk in forum Mobile Java General
    Replies: 8
    Last Post: 2009-06-26, 12:54
  2. PIM contact list supported array elements
    By gbaballa in forum Mobile Java General
    Replies: 3
    Last Post: 2008-07-09, 13:40
  3. need information about j2me polish
    By rathikathangaraj in forum Mobile Java General
    Replies: 4
    Last Post: 2007-12-19, 09:01
  4. How to initialise elements of an array?
    By dee_viz in forum Symbian
    Replies: 9
    Last Post: 2007-09-20, 19:32
  5. Replies: 1
    Last Post: 2006-07-05, 18:05

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×