All Questions
33 questions
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 ...
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()...
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 ...
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 ...
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.
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...