FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Sorting Methods in Arrays
NewsProgramming Languages

Sorting Methods in Arrays

via Dev.to PythonAbirami Prabhakar3h ago

lets first understand what sorting means sorting means arranging elements in a particular order (mostly ascending or descending) example [5, 2, 3, 1] → [1, 2, 3, 5] there are many ways to sort an array, and each method works differently why do we need sorting sorting helps in: searching faster organizing data solving many problems like binary search, merging, etc types of sorting methods in this blog, I will go through some common sorting methods Bubble Sort Selection Sort Insertion Sort Merge Sort Quick Sort 1. Bubble Sort the bubble sort compares adjacent elements and swaps them if they are not in order, largest element “bubbles” to the end example [5, 2, 3] 5 > 2 → swap → [2,5,3] 5 > 3 → swap → [2,3,5] code def bubblesort ( arr ): n = len ( arr ) for i in range ( n ): for j in range ( 0 , n - i - 1 ): if arr [ j ] > arr [ j + 1 ]: arr [ j ], arr [ j + 1 ] = arr [ j + 1 ], arr [ j ] return arr complexity Time Complexity: O(n²) Space Complexity: O(1) 2. Selection Sort selection sort f

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
0 views

Related Articles

Fear and Loathing in the vibe-coding abyss
News

Fear and Loathing in the vibe-coding abyss

Lobsters • 22m ago

Nothing 4a pro review and first impression!
News

Nothing 4a pro review and first impression!

Medium Programming • 1h ago

9 Battle-Tested Patterns for App Configuration in .NET 9
News

9 Battle-Tested Patterns for App Configuration in .NET 9

Medium Programming • 1h ago

Elegant Global Error Handling Using Middleware In .NET
News

Elegant Global Error Handling Using Middleware In .NET

Medium Programming • 1h ago

npm vs Yarn vs pnpm vs Bun — Which Package Manager Should You Use in 2026?
News

npm vs Yarn vs pnpm vs Bun — Which Package Manager Should You Use in 2026?

Medium Programming • 1h ago

Discover More Articles