Skip to content
murmot

Results for “sort array java example code python site:geeksforgeeks.org 1”

  • geeksforgeeks.org

    Pancake sorting - GeeksforGeeks

    # Python3 program to # sort array using # pancake sort #.Flip the entire array to move the maximum element to # its correct position flip(arr, n - 1) #. Recursively sort the remaining unsorted portion of # the array pancakeSort(arr, n - 1) #.

  • geeksforgeeks.org

    Sort Array - GeeksforGeeks

    Oct 25, 2026 ... Given an unsorted array arr[] of numbers, sort the array in ascending order. Examples: Input: arr[] = [1, 5, 3, 2] Output: [1, 2 ...

  • geeksforgeeks.org

    Merge Sort - GeeksforGeeks

    Merge sort is a popular sorting algorithm known for its efficiency and stability. It follows the Divide and Conquer approach. It works by recursively dividing the input array into two halves, recursively sorting the two halves and finally merging them back together to obtain the sorted array.

  • geeksforgeeks.org

    TimSort - GeeksforGeeks

    Driver Code Ends. Python.Applications of Tim Sort: Used as the default sorting algorithm in Python (sorted(), list.sort()) and Java (from Java 7 onwards for Arrays.sort() on objects). Particularly effective for real-world datasets where data is often partially sorted.

  • geeksforgeeks.org

    Bubble Sort - GeeksforGeeks

    Sorts the array using multiple passes. After the first pass, the maximum goes to end (its correct position).# Optimized Python program for implementation of Bubble Sort def bubbleSort(arr): n = len(arr) #. Traverse through all array elements for i in range(n)

  • geeksforgeeks.org

    Nearly Sorted - GeeksforGeeks

    Sep 30, 2026 ... Directly sort the given array using the built-in sort() function. The array is rearranged in ascending order. C++ Java Python C# ...