sort

Module

Implements sorting functions.

You can import these APIs from the algorithm package. For example:

from algorithm.sort import sort

sort

sort(inout buff: Pointer[Int], len: Int)

Sort the vector inplace.

The function doesn’t return anything, the vector is updated inplace.

Args:

  • buff (Pointer[Int]): Input buffer.
  • len (Int): The length of the buffer.

sort[type: DType](inout buff: Pointer[SIMD[type, 1]], len: Int)

Sort the vector inplace.

The function doesn’t return anything, the vector is updated inplace.

Parameters:

  • type (DType): DType of the underlying data.

Args:

  • buff (Pointer[SIMD[type, 1]]): Input buffer.
  • len (Int): The length of the buffer.

sort(inout v: DynamicVector[Int])

Sort the vector inplace.

The function doesn’t return anything, the vector is updated inplace.

Args:

  • v (DynamicVector[Int]): Input integer vector to sort.

sort[type: DType](inout v: DynamicVector[SIMD[type, 1]])

Sort the vector inplace.

The function doesn’t return anything, the vector is updated inplace.

Parameters:

  • type (DType): DType of the underlying data.

Args:

  • v (DynamicVector[SIMD[type, 1]]): Input vector to sort.