Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
1 answer
105 views

Simple sort function

I am learning Python and for practice I have written this function which sorts a list. Can you please provide feedback on how I have structured it and what better ways could be there to write it for ...
Syed Ali Ahmed Islam 's user avatar
3 votes
1 answer
478 views

Number sorting algorithm from scratch

Updated (at the bottom) I am attempting to write a Python program where I have to create a sorting algorithm without the assistance of the built-ins (like the sort()...
seoul_007's user avatar
  • 454
13 votes
3 answers
2k views

Python3 - merge sort, O(n) space efficiency

Any critique of my implementation of Merge sort would be much appreciated! I tested it using a driver function (shown below), and everything works. However, it still feels unwieldy, I am a beginner ...
Joseph Gutstadt's user avatar
10 votes
3 answers
3k views

My approach to sorting algorithm

For practicing purposes, I had the idea of making a sorting algorithm in Python. My approach to it was to iterate through a given unsorted list to find the shortest number in it, add the number to a ...
Tlomoloko's user avatar
  • 635
4 votes
2 answers
474 views

Heap Sort and Binary Tree Sort Algorithms (Python)

Heap Sort A Binary Heap is a Complete Binary Tree where the items are stored in a special order such that the value in a parent node is greater or smaller than the two values in the children nodes. ...
Emma Marcier's user avatar
  • 3,702
5 votes
3 answers
5k views

Binary Tree Sort Algorithm (Python)

A Binary Tree Sort is an algorithm that builds a binary search tree from the elements to be sorted, and then traverses the tree (in-order) so that the elements come out in sorted order. Average Case ...
Emma Marcier's user avatar
  • 3,702
3 votes
1 answer
186 views

Quick Sort Algorithm (Python)

QuickSort is a Divide and Conquer algorithm, which picks an element as "pivot" and partitions a given list around the pivot. There are many different versions of Quick Sort, as to how to pick a pivot ...
Emma Marcier's user avatar
  • 3,702
3 votes
1 answer
487 views

Iterative Merge Sort Algorithm (Python)

Merge Sort Merge Sort algorithm is a general-purpose comparison-based sorting algorithm. Most implementations produce a stable sort, in which the order of equal elements is preserved. Here, our ...
Emma Marcier's user avatar
  • 3,702
3 votes
1 answer
1k views

Recursive Merge Sort Algorithm (Python)

Merge Sort Merge Sort algorithm is a general-purpose comparison-based sorting algorithm. Most implementations produce a stable sort, in which the order of equal elements is preserved. Just for ...
Emma Marcier's user avatar
  • 3,702
2 votes
1 answer
2k views

Shell Sort, Insertion Sort, Bubble Sort, Selection Sort Algorithms

There are seven sorting algorithms in the code copied below. The first five algorithms have been previously reviewed in this link. Selection Sort The Selection Sort algorithm sorts a list by ...
Emma Marcier's user avatar
  • 3,702
14 votes
4 answers
3k views

Shell Sort, Insertion Sort, Bubble Sort, Selection Sort Algorithms (Python)

There is a follow-up question available: shell-sort-insertion-sort-bubble-sort-selection-sort-algorithms-python. Selection Sort The selection sort algorithm sorts a list (array) by finding the ...
Emma Marcier's user avatar
  • 3,702
2 votes
1 answer
303 views

Sorting Algorithms (Python)

Selection Sort The selection sort algorithm sorts a list (array) by finding the minimum element from the right (unsorted part) of the list and putting it at the left (sorted part) of the list. The ...
Emma Marcier's user avatar
  • 3,702
8 votes
2 answers
1k views

Selection Sort Algorithm (Python)

Selection Sort The selection sort algorithm sorts a list by finding the minimum element from the right unsorted part of the list and putting it at the left sorted part of the list. The algorithm ...
Emma Marcier's user avatar
  • 3,702
2 votes
1 answer
137 views

Single Linked List (Python)

I'm following a tutorial on Single Linked List (SLL). There are so many methods in the code, if you had time please feel free to review any part of it and I can work on it and repost it. I'm ...
Emma Marcier's user avatar
  • 3,702
2 votes
1 answer
78 views

In-Place Merging of Two Bubble Sorted Linked Lists (Python)

I'm following a tutorial on merging two bubble-sorted Single Linked Lists in Python. merge1 does the merging by creating a new list with maybe \$O(N+M)\$ memory ...
Emma Marcier's user avatar
  • 3,702

15 30 50 per page