Jump to content

User talk:DanielKO

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Based on your comments on Talk:Levenshtein distance, I think you might be interested in Wikipedia_talk:WikiProject_Programming_languages#Category:Articles_with_example_code_proposal_and_call_for_volunteers. --Quuxplusone 01:36, 4 December 2006 (UTC)[reply]

Gnome sort

[edit]

I agree, that pile of implementations on the Gnome sort page needed to be junked, but I had a little trouble at first deciphering the pseudocode. I reimplemented it in Python and the end result was easier to understand (as well as actually runnable), so I replaced the pseudocode with my Python implementation. I just thought I'd notify you. If you disagree, go ahead and put the pseudocode back. Here's my implementation:

def gnomesort(a):
    n = 0
    while n < len(a) - 1:
        if a[n] > a[n + 1]:
            a[n], a[n + 1] = a[n + 1], a[n]
            if n > 0: n -= 1
        else:
            n += 1