Results 1 to 5 of 5

Thread: Removing duplicates

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    12

    Angry

    Somehow I am not able to do the following.

    Delete any duplicate numbers out of a small one dim.array.

    The numbers are no more the 5 digits in length and the array is not sorted nor does it have to be.

    I just want to remove the duplicate numbers..


    Thanks in advance..

    Trent

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Is there a fixed amount of elements in your array or can it be redimensioned??
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    12
    It was set up dynamic as:

    Dim rpp() As Integer

    Then set up like this once I knew how many records I was going to process..


    ReDim Preserve rpp(intrecCount)

  4. #4
    Fanatic Member
    Join Date
    Nov 2000
    Location
    Sydney Australia
    Posts
    804

    Lightbulb

    As a suggestion, why don't you creat a new array and go through each item of your old array and only add it to the new array if it doesn't already exist.



  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Is the range of the values small? If you have a reasonable amount, then you could create a value table and then make a single loop checking for each value and then start copying the values over larger intervals backwards each time you find a duplicate. It's a lot faster than going trough the loop over and over again.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Posting Permissions

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



Click Here to Expand Forum to Full Width