Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
1 answer
102 views

Most efficient way to find spatial order from a list of tuples (Python)

I have a circle-growth algorithm (line-growth with closed links) where new points are added between existing points at each iteration. The linkage information of each point is stored as a tuple in a ...
solub's user avatar
  • 123
3 votes
2 answers
2k views

Insert a number in a sorted list and return the list with the number at the correct index

I feel like the title is a bit wordy. What I have defined here is a function that takes two parameters: a list that contains valued sorted from smallest to biggest a number to insert at the right ...
Mister Tusk's user avatar
1 vote
1 answer
1k views

Recursive quicksort in Python

I want to find a more elegant way to build a recursive sorting function. The function randomly selects one of the numbers from a given list, k, and splits the list ...
user avatar
4 votes
1 answer
2k views

CLRS Exercise 2.3-4: Recursive Insertion Sort

I'm going through CLRS 3e and executing exercises to obtain a better understanding of CS fundamentals. Below is my solution to the following exercise from chapter 2: We can express insertion sort ...
openingceremony's user avatar
5 votes
4 answers
5k views

Recursive and iterative approach for mergesort

Problem: Question 8: * Mergesort is a type of sorting algorithm. It follows a naturally recursive procedure: Break the input list into equally-sized halves Recursively sort both ...
overexchange's user avatar
  • 3,401
3 votes
2 answers
6k views

Recursive functions for sorting

I made a few recursive functions for learning purposes which do a variety of tasks. Here is my current and functioning code: ...
LucyBen's user avatar
  • 273
2 votes
3 answers
2k views

Merge sort algorithm written in Python

...
macbug's user avatar
  • 65
4 votes
2 answers
2k views

How might we make this Python Merge Sort implementation more Pythonic?

I've implemented a (version of) Merge Sort algorithm in Python. My goal here is two-fold: Improve understanding of Merge Sort and recursion in a language agnostic way. Improve understanding of Python ...
doughgle's user avatar
  • 629