1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Quicksort with Python

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am totally new to python and I am trying to implement quicksort in it. Could someone please help me complete my code?

    I do not know how to concatenate the three arrays and print them.

    def sort(array=[12,4,5,6,7,3,1,15]):
    less = []
    equal = []
    greater = []

    if len(array) > 1:
    pivot = array[0]
    for x in array:
    if x < pivot:
    less.append(x)
    if x == pivot:
    equal.append(x)
    if x > pivot:
    greater.append(x)
    sort(less)
    sort(pivot)
    sort(greater)

    Continue reading...

Compartilhe esta Página