Wednesday, November 4
Trending
- Best Ethical Hacking Tools in 2027: Free & Paid Picks
- Software supply chain attacks 2026: Timeline and developer checklist
- Binance Hack: $6.3 Billion Drained in the Largest Crypto Theft Ever. What We Know So Far
- This Site Uses XSLT Chrome Warning Explained: How to Fix It
- iPad mini OLED Price in India: Wi-Fi & Cellular Variants, Offers
- iMac M6 Price in India: All Variants, Colors, Offers and Release Date
- MacBook Pro M6 Price in India
- Apple Pro and Tell Event: Touchscreen MacBook Pro, M6 MacBook Pro, Price in India
Sorting is the process of arranging a list of elements in ascending or descending order. Sorting can be broken down into two categories:
- Internal Sorting
The computer’s main memory is used for internal sorting. As a result, it can take advantage of the random access feature of the main memory.
The elements to be sorted are stored in an integer array. Various sorting algorithms can be used to sort these elements.
- External Sorting
Secondary storage is used for external sorting. When there is too much data to sort in memory, external sorting becomes necessary.
The move of data from secondary storage to main memory should always be done by moving a set of contiguous elements.
- Simple sorting algorithms such as bubble sort and insertion sort take
O (n2)time to sort n elements. - Complex algorithms such as quick sort, merge sort, and heap sort take
O (n log n)time to sort n elements. - The bubble sort, the insertion sort, and the merge sort are stable sorting algorithms. While the quick sort and heap sort are unstable.
- The algorithm is said to be stable if after sorting, identical elements appear in the same sequence as in the original unsorted list.
