Skip to content

rsamanez/QuickSort

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

QuickSort 1'000,000 elements

This x86-64 assembly program implements the QuickSort algorithm to sort a randomly generated array of 1,000,000 integers. The algorithm selects a pivot element and partitions the array into two sub-arrays: elements less than or equal to the pivot and elements greater than the pivot. It then recursively sorts the sub-arrays. This implementation demonstrates low-level memory management and control flow, providing an educational example of how high-level sorting algorithms can be translated into assembly language.

Este programa en ensamblador x86-64 implementa el algoritmo QuickSort para ordenar un arreglo de 1,000,000 de enteros generados aleatoriamente. El algoritmo selecciona un elemento pivote y divide el arreglo en dos subarreglos: elementos menores o iguales al pivote y elementos mayores al pivote. Luego, ordena recursivamente los subarreglos. Esta implementación demuestra la gestión de memoria y el control de flujo a bajo nivel, proporcionando un ejemplo educativo de cómo los algoritmos de ordenamiento de alto nivel pueden traducirse a lenguaje ensamblador.

Algorithm

partition(l,h)
 {
   pivot= A[l]
   i=l
   j=h
   while(i<j)
   {
       do
       {
         i++
       }while(A[i]<=pivot)
       do
       {
         j--
       }while(A[j]>pivot)
       if(i<j)
           swap(A[i],A[j])
   }
   swap(A[l],A[j])
   return j
 }

Execution

Compile with:
     nasm -f elf64 -o sortRandomArray64.o sortRandomArray64.asm
Link with:
     ld -m elf_x86_64 -o sortRandomArray64 sortRandomArray64.o
Run with:
     ./sortRandomArray64

About

Assembler x64 Program to sort a random array with 1'000,000 elements

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published