def run(a, prt=sys.stdout):
  desc = 'QUICKSORT PARTITION'
  ah = ArrayHistory()
  j = _partition(a, lo=0, hi=len(a)-1, array_history=ah)
  ah.prt()
  ah.show(desc)
  print desc, "RESULT:", ' '.join(str(e) for e in a)
Beispiel #2
0
def run(a):
    desc = 'QUICKSORT'
    ah = ArrayHistory()
    Sort(a, array_history=ah)
    ah.prt()
    ah.show(desc)
    print(desc, "RESULT:", a)
def run(a):
  desc = 'QUICKSORT'
  ah = ArrayHistory()
  Sort(a, array_history=ah)
  ah.prt()
  ah.show(desc)
  print desc, "RESULT:", a
Beispiel #4
0
def run(a, prt=sys.stdout):
  desc = 'QUICKSORT PARTITION'
  ah = ArrayHistory()
  j = _partition(a, lo=0, hi=len(a)-1, array_history=ah)
  ah.prt()
  ah.show(desc)
  print(desc, "RESULT:", ' '.join(str(e) for e in a))
Beispiel #5
0
def run(a, desc=None, prt=sys.stdout):
    ah = ArrayHistory()
    Sort(a, array_history=ah)
    if desc is None:
        desc = "INSERTION SORT"
    prt.write("{DESC} RESULT {A}\n".format(DESC=desc, A=' '.join(str(e) for e in a)))
    ah.prt()
    ah.show(desc)
def run(a, desc=None, sort_seq=None, prt=sys.stdout):
  ah = ArrayHistory()
  Sort(a, array_history=ah, sort_seq=sort_seq)
  if desc is None:
    desc = "SHELL SORT" 
  prt.write("{DESC} RESULT {A}\n".format(DESC=desc, A=' '.join(str(e) for e in a)))
  ah.prt()
  ah.show(desc)
Beispiel #7
0
def run(a, prt=sys.stdout):
    desc = 'QUICK3WAY'
    ah = ArrayHistory()
    # Do not shuffle so that we may better visualize _sort actions
    Sort(a, array_history=ah, shuffle=False)
    ah.prt()
    #ah.show(desc)
    prt.write("{DESC} RESULT: {A}\n".format(DESC=desc,
                                            A=' '.join([str(e) for e in a])))
def run(a, prt=sys.stdout):
  desc = 'QUICK3WAY'
  ah = ArrayHistory()
  # Do not shuffle so that we may better visualize _sort actions
  Sort(a, array_history=ah, shuffle=False)
  ah.prt()
  #ah.show(desc)
  prt.write("{DESC} RESULT: {A}\n".format(
    DESC=desc, A=' '.join([str(e) for e in a])))