---
title: "Discussion on \"Sorting\" | Hashnode"
description: "Discussion on \"Sorting\". Selection sort : select the minimum and swap with a[i]\n\nO(n²) all cases\n\nfor(int i = 0; i< n-1 ;i++){\n   int min = i;      \n   for(int j = i ; j<n;j++){\n       if(arr[j] < arr[min]){\n           min = j;\n        }\n   }\n   swap(arr[min] , arr[i]);\n}\n\nB..."
url: "https://hashnode.com/posts/sorting/687e196a45b2ecb635f6a300"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Sorting](https://personal-pk.hashnode.dev/sorting?utm_source=hashnode&utm_medium=feed)

Selection sort : select the minimum and swap with a\[i\] O(n²) all cases for(int i = 0; i< n-1 ;i++){ int min = i; for(int j = i ; j<n;j++){ if(arr\[j\] < arr\[min\]){ min = j; } } swap(arr\[min\] , arr\[i\]); } B...

Jul 21, 2025 · 4 min read · personal-pk.hashnode.dev  
Read the article

## Written by

[Pavan Kumar K](https://hashnode.com/@pavan80)

@pavan80 · Bangalore

  
[View profile](https://hashnode.com/@pavan80)

Developer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
