Skip to content
Advertisement

Tag: algorithm

How to find nearest point in segment in a 3d space

I am solving an algorithmic problem which sounds like this: Given a three-dimensional space and segments in it. Find the point with minimal distance to all of the segments. Example input: in the first line N – the number of segments, in the N next lines given the begin and the end of each segment: x1 y1 z1 x2 y2

Reconstruct input string given ngrams of that string

Given a string, e.g. i am a string. I can generate the n-grams of this string like so, using the nltk package, where n is variable as per a specified range. Gives the output: Is there a way to ‘reconstruct’ the original string using combinations of the generated ngrams? Or, in the words of the below commenter, is there a

Binary Insertion Sort vs. Quicksort

I was looking at different sorting algorithms and their performance (link) and then I tried to implement some sorting algorithms myself. I wanted to improve them as well and so, as I was coding the insertion sort, I thought why not to use binary search, as the first part of array is already sorted, and in order to get rid

Algorithm for integer solutions of a circle?

I am trying to search for integer solutions to the equation: If I search this in wolfram alpha, they are all found almost immediately even for very large n. When I implemented a brute force approach it was very slow: So I assume there is a much faster way to get all of the integer solutions to the equation above.

Advertisement