algorithm

I cant verify seed generation if someone can see what is wrong

I cant verify seed generation if someone can see what is wrong Question: So i got this function that generates seeds makeseed() and now im trying to make a "verify" seed keep in mind that any seed generated IS Correct so i want it so that the user can input seeds and it’ll check if …

Total answers: 1

How to optimize splitting overlapping ranges?

How to optimize splitting overlapping ranges? Question: This Python script I wrote to split overlapping ranges into unique ranges (last iteration). It produces correct output and outperforms the version in the answer. I tested output against correct method’s output and output of a brute force approach. An infinite number of boxes arranged in a line …

Total answers: 1

Algorithm: Polygon max element in O(log n)

Algorithm: Polygon max element in O(log n) Question: I want to find the vertice in convex polygon, which has the greatest x axis value. The polygon is convex and random. Its vertices are represented in array as tuples: (x,y). The vertices from cartesian coordinate system to array are ordered in counterclockwise order. The most left …

Total answers: 1

Improving performance of resolving a solitaire math-game

Improving performance of resolving a solitaire math-game Question: A bit of history: Since I was a kid, I have been playing a very easy little solitaire game to which I have never found a solution and honestly, I don’t know if there is one, but I would like to find it out with the help …

Total answers: 1

Numbers of combinations modulo m, efficiently

Numbers of combinations modulo m, efficiently Question: First of all I’m solving a programming problem rather than a math problem now. The question is Anish got an unbiased coin and he tossed it n times and he asked Gourabh to count all the number of possible outcomes with j heads, for all j from 0 …

Total answers: 3

Degenerate root finding problem: get the first value for which f(x)>0

Degenerate root finding problem: get the first value for which f(x)>0 Question: Given a function f(x) that is zero for all values x less than a critical value c, and non-zero for values x>c. I want to approximate the critical value c using an optimization method. Because the function f(x) is expensive, I want to …

Total answers: 2

A* algorithm in python having trouble with making the final path

A* algorithm in python having trouble with making the final path Question: Full now working Code: https://docs.google.com/document/d/1j1BLe4L735nmXWR0Vnj3TeHumzI5x7Ea5yWJSc5j-8w/edit I tried to code the A* pathfinding algorithm and I got it to expand in the right way using the g and h costs. It looked really cool, however when I tried finding the final path by using …

Total answers: 1