Tagged Questions
4
votes
2answers
149 views
Python implementation of the Ramer-Douglas-Peucker Algorithm
I recently implemented the RDP polygon approximation algorithm in Python and I'm skeptical of whether or not I implemented it correctly of with the greatest efficiency. The algorithm runs in around ...
1
vote
2answers
289 views
The efficiency of looping over nested dictionaries in Python
How to make the following code more efficient?
...
4
votes
0answers
96 views
Ways of speeding up this python implementation of SAT (Separating axis theorem)
A project I was working on required the usage of the Separating Axis Theorem to detect collisions between two convex polygons in real time. So I implemented a basic class (...
2
votes
1answer
514 views
Collections.Counter in Python3
Can you suggest how I might make the following code more efficient:
...
3
votes
2answers
693 views
Hangman in Python
I created this version of Hangman in Python 3. Does anyone have any tips for optimization or improvement?
...
3
votes
2answers
161 views
Generating a random string of characters and symbols
After coding this, I was wondering if there are any ways in which I can improve upon it. It generates a random string of characters and symbols the same length as what is entered by the user. It uses ...
3
votes
1answer
65 views
Time optimization of counting shifts in insertion sort
Is there any way of counting how many shifts would it take to count shifts while doing insertion sort? This is a Hackerrank problem. Here's my solution, but it takes more than 16 seconds.
...
5
votes
2answers
530 views
Sherlock and The Beast
I have recently written the program for the Sherlock and The Beast' HackerRank challenge. That's working fine, but the problem is that it takes too much time if a big number is given as a input. I ...
0
votes
1answer
36 views
Calculating Leibniz of Pi [closed]
I have this Python program for calculating Leibniz of 'pi'. I am not able to shorten it more. Can anyone here optimise/shorten it?
...
4
votes
1answer
111 views
Modified BFS code optimizations
I need some help reviewing this code in terms of making as fast as possible. This is a modified version of BFS that does quite a bit of processing on the side.
Use case:
I have a large graph ...
5
votes
1answer
476 views
Optimizing my code for Project Euler Problem #23 (Non-abundant sums)
Project Euler Problem 23 asks:
A perfect number is a number for which the sum of its proper divisors
is exactly equal to the number. For example, the sum of the proper
divisors of 28 would be ...
3
votes
2answers
903 views
Improving and optimizing Tic-Tac-Toe game written in Python 3
I've been teaching myself Python3 for about a week now and I decided to put my skills to the test by writing a simple Tic-Tac-Toe game. Here is what I came up with:
...
2
votes
1answer
89 views
How to turn this working A/B optimization program into more pythonic code?
I have a working solution for the given problem of A/B Optimization, but you as an experienced Python (3) developer will agree with me, that this solution is not very pythonic at all.
My Question ...
1
vote
2answers
230 views
Is there a more efficient way for code reuse in Python - Largest prime factor?
I was doing timing with variations of function largest_prime_factor. I was able to write a better one largest_prime_factor2. ...