MiniMax-M2-gguf-q2ks-mixed-AutoRound

609
7
by
Intel
Other
OTHER
New
609 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary

AI model with specialized capabilities.

Code Examples

Python Implementationpython
def quick_sort(arr, low, high):
    if low < high:
        # Step 1: Partition the array and get pivot index
        pivot_index = partition(arr, low, high)

        # Step 2: Recursively sort elements before and after partition
        quick_sort(arr, low, pivot_index - 1)  # Sort left sub-array
        quick_sort(arr, pivot_index + 1, high)  # Sort right sub-array

def partition(arr, low, high):
    # Choose the rightmost element as pivot
    pivot = arr[high]

    # Index of smaller element
    i = low - 1

    for j in range(low, high):
        # If current element is smaller than or equal to pivot
        if arr[j] <= pivot:
            i += 1
            # Swap arr[i] and arr[j]
            arr[i], arr[j] = arr[j], arr[i]

    # Move pivot to its correct position
    arr[i + 1], arr[high] = arr[high], arr[i + 1]
    return i + 1

# Example usage and helper function
def quick_sort_wrapper(arr):
    """Helper function that sorts the entire array"""
    if len(arr) <= 1:
        return arr
    quick_sort(arr, 0, len(arr) - 1)
    return arr

# Example usage
if __name__ == "__main__":
    # Test array
    data = [10, 7, 8, 9, 1, 5]
    print(f"Original array: {data}")

    sorted_data = quick_sort_wrapper(data)
    print(f"Sorted array: {sorted_data}")

    # Another example
    test_arr = [64, 34, 25, 12, 22, 11, 90]
    print(f"Original: {test_arr}")
    quick_sort_wrapper(test_arr)
    print(f"Sorted: {test_arr}")
Another examplejavascript
function quickSort(arr, low = 0, high = arr.length - 1) {
    if (low < high) {
        // Partition and get pivot index
        const pivotIndex = partition(arr, low, high);

        // Recursively sort elements before and after partition
        quickSort(arr, low, pivotIndex - 1);
        quickSort(arr, pivotIndex + 1, high);
    }
    return arr;
}

function partition(arr, low, high) {
    // Choose the rightmost element as pivot
    const pivot = arr[high];

    // Index of smaller element
    let i = low - 1;

    for (let j = low; j < high; j++) {
        // If current element is smaller than or equal to pivot
        if (arr[j] <= pivot) {
            i++;
            // Swap arr[i] and arr[j]
            [arr[i], arr[j]] = [arr[j], arr[i]];
        }
    }

    // Move pivot to its correct position
    [arr[i + 1], arr[high]] = [arr[high], arr[i + 1]];
    return i + 1;
}

// Example usage
const data = [10, 7, 8, 9, 1, 5];
console.log("Original array:", data);

quickSort(data);
console.log("Sorted array:", data);
Alternative: Lomuto Partition Schemepython
def quick_sort_lomuto(arr, low, high):
    if low < high:
        # Partition index
        j = partition_lomuto(arr, low, high)
        quick_sort_lomuto(arr, low, j - 1)
        quick_sort_lomuto(arr, j + 1, high)

def partition_lomuto(arr, low, high):
    pivot = arr[high]
    i = low

    for k in range(low, high):
        if arr[k] < pivot:
            arr[i], arr[k] = arr[k], arr[i]
            i += 1

    arr[i], arr[high] = arr[high], arr[i]
    return i

# Simple usage
def simple_quick_sort(arr):
    quick_sort_lomuto(arr, 0, len(arr) - 1)
    return arr

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.