All Questions
Tagged with algorithms python
8 questions
1
vote
1
answer
2k
views
Unevenly distributed random number generation [duplicate]
Let's say I have to generate random number from 1 to 100, however, the probability of each number is not 1/100, but a predefined probability.
How to generate that number? I use Ruby/Python.
22
votes
9
answers
19k
views
Is it essential to learn algorithms to be a real programmer? [closed]
I'm a PHP programmer, and until now I have not needed to learn algorithms...
Now I'm start learning Python (a real programming language), because I need to use matplotlib. Does it make sense to start ...
18
votes
5
answers
11k
views
Algorithm for flattening overlapping ranges
I am looking for a nice way of flattening (splitting) a list of potentially-overlapping numeric ranges. The problem is very similar to that of this question: Fastest way to split overlapping date ...
9
votes
1
answer
8k
views
How are queues made thread-safe in Python
I admit this was asked to me in interview a long time ago, but I never bothered to check it.
The question was simple, how does Python make Queue thread-safe?
My answer was, because of Interpreter ...
1
vote
3
answers
1k
views
How to convert this recursive problem to iterative? Line Simplification algorithm fails to run due to Maximum Recursion Depth being hit
I am implementing the Douglas, Peucker's Line Simplification algorithm in Python. I started with this implementation. However, it fails to run in Python due to Maximum Recursion Depth being hit. How ...
37
votes
9
answers
9k
views
Is the algorithm more important than the programming language?
During the current (2013) Google Code Jam contest, there was a problem that took C++ and Java people 200+ lines of code as compared to Python people that solved the same problem only using 40 lines of ...
21
votes
3
answers
881
views
How do I express subtle relationships in my data?
"A" is related to "B" and "C". How do I show that "B" and "C" might, by this context, be related as well?
Example:
Here are a few headlines about a recent Broadway play:
David Mamet's Glengarry ...
-1
votes
2
answers
10k
views
Algorithm for scheduling shifts
I am trying to write a program to help scheduling shifts for the employees of a small business. There are 28 shifts that needs to be assigned to 28 employees (so this means that each person gets a ...