Number Sort Algorithm


Results 1 to 40 of 55

Threaded View

  1. #32
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel, I tested the sorting snippet you have posted, using a rather interesting swapping technique.

    The code worked, but now and than, it was yielding very fanny results.

    From a closer code analysis, I came to the conclusion that :

    Code:
    If CounterA > 0 then CounterA=CounterA-2
    should be corrected with:

    Code:
    If CounterA > 1 then CounterA=CounterA-2
    After the correction, I didn't see any fanny result for the rest of my testing period.

    The explanation I have given is the following:

    If CounterA = 1 then CounterA - 2 = 255 and this screw up everything.

    Can you confirm?

    Al.
    Last edited by aratti; - 19th December 2009 at 18:14.
    All progress began with an idea

Similar Threads

  1. Dynamic USB Serial Number (PIC18F4550)
    By awmt102 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th July 2009, 18:03
  2. Working with the random number generator
    By kwelna in forum mel PIC BASIC
    Replies: 9
    Last Post: - 16th January 2007, 18:50
  3. Random number results
    By bartman in forum mel PIC BASIC
    Replies: 3
    Last Post: - 9th March 2005, 18:39
  4. more random number questions
    By bartman in forum mel PIC BASIC
    Replies: 1
    Last Post: - 14th November 2004, 18:55
  5. Split number into variables
    By psmeets in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 7th January 2004, 05:15

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

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