0
votes
0answers
39 views

Generating all the words accepted by a deterministic finite automaton [duplicate]

Imagine you've got a finite deterministic automaton A defining some finite regular language L, consisting of N words. The first question is: how would you determine the number of words N? Then, I ...
0
votes
3answers
108 views

Unique ID algorithm

I've got a route that contains objects. Each one has value 0 or 1. I need unique route ID which will identify any objects order. Currently I'm doing it using binary number that is converted to decimal ...
0
votes
2answers
128 views

Randomized Hash function with no collisions

Related to the question Which hashing algorithm is best for uniqueness and speed? Is there a way to create a hash function, or find one, whose hash length depends completely on the input length, has ...
0
votes
1answer
130 views

Euclidean Space Fully Connected Nondirectional Graph: Shortest Path to all nodes

So this may be a question that is born of my inability to properly express my intentions to Google. In a fully connected non-directional graph such that any three points can be properly represented ...
0
votes
1answer
184 views

Find possible variations of one item out of multiple baskets.

I have three baskets of balls and each of them has 10 balls which have the following numbers: Basket 1: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Basket 2: 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ...
3
votes
1answer
309 views

What are the essential mathematics topics that a programmer should know in order to learn algorithms? [closed]

Being a electronics engineer, I was never exposed to any algorithms. Now I am a experienced programmer and want to learn Algorithms. I started with CLRS. But I was overwhelmed by the maths in the ...
2
votes
1answer
133 views

Draw graph of a function whose characteristics are unknown [closed]

Suppose I have a function. I have code that, given an x value, produces a y value. I can assume that the function is somewhat mathematically sane, not something crazy like an ...
2
votes
2answers
213 views

How do you program a way to create mathematics formulas?

For one of my project ideas, I want to create a dice rolling app. It would allow people to setup somewhat complex combinations of dice roll cascades in a visual way. I have a pretty good idea on how ...
0
votes
0answers
137 views

Algorithm for pinning joints for use with inverse kinematics

I'm part of the development team for a 2D animation program. One of the key features of the program is the ability to pose figures using Inverse Kinematics. Although we have that part down, we need to ...
7
votes
4answers
317 views

Fastest way to check if two square 2D arrays are rotationally and reflectively distinct

The best idea I have so far is to rotate first array by {0, 90, 180, 270} degrees and reflect it horizontally or/and vertically. We basically get 16 variations [1] of first array and compare them with ...
1
vote
1answer
79 views

Matching users based on a series of questions

I'm trying to figure out a way to match users based on specific personality traits. Each trait will have its own category. I figure in my user table I'll add a column for each category: id name ...
2
votes
2answers
148 views

Effective and simple matching for 2 unequal small-scale point sets

I need to match two sets of 3D points, however the number of points in each set can be different. It seems that most algorithms are designed to align images and trimmed to work with hundreds of ...
1
vote
2answers
219 views

How fast should a Python factoring script be?

Just how efficient is "good enough" for all intents and purposes? I wrote a script to simply list off all numbers that divide into an input, x, as pairs (i, n//i) and was just curious how efficient I ...
5
votes
1answer
192 views

Bin sorting problem - Please help categorize

I have a problem I am developing a solution for and currently I solve it with a brute force solution that checks all possibilities. It works for small numbers of bins but I'd like to work with a ...
3
votes
1answer
194 views

Finding maximum number of congruent numbers

Let's say we have a multiset (set with possible duplicates) of integers. We would like to find the size of the largest subset of the multiset such that all numbers in the subset are congruent to each ...
1
vote
0answers
246 views

Optimization algorithm, how to develop this problem

I have a situation where I would like your input and think over / solve algorithm. The specs There are inventories with a specified amount of capacity. 'X (width) and Y (time)' creates ...
2
votes
2answers
461 views

Transform math formula into code (line-line intersection)

I'm having hard times transforming a math formula to code. I can solve it on the paper easily, but it's hard for me to bring it into code form. Is it generally possible to bring a math formula ...
2
votes
3answers
2k views

what is a efficient way to find repeating decimal

I am trying to find a efficient algorithm in Java to find the repeating decimal part of two integers a and b where a/b. eg. 5/7 = 0.714258 714258.... I currently only know of the long division ...
0
votes
1answer
213 views

Algorithm to detect a CLICK within Square range

It might be a simple question but I am looking for optimal solution. I will have numbers printed on a screen and I will be aware of coordinates. Numbers/Symbols will have 4 points(Square) to define ...
10
votes
5answers
744 views

Interview puzzle on traveling on a line segment

Here's an interesting question I came upon: Let's just say on a number line of length M, where 0 < M <= 1,000,000,000, you given N (1 < N <= 100,000) integer pairs of points. In each ...
2
votes
1answer
114 views

Turning n-dim points into m-dim where m<n and where point-to-point distance deviation is minimized

I want to apply k-means clustering to a (sparse) adjacency graph. For this I need to assign the nodes to a position in an euclidean space. Trivially I can do this by having a space with as many ...
24
votes
9answers
4k views

How to check if 4 points form a square?

Assume I have 4 points (they are 2-dimension), which are different from each other, and I want to know whether they form a square. How to do it? (let the process be as simple as possible.)
26
votes
4answers
2k views

Can you use Pi as a crude random number generator?

I recently saw this question over at math.SE. It got me thinking. Could Pi be used as a crude random number generator? I mean the results are well known(how long has pi been computed to now?) but, Pi ...
3
votes
3answers
898 views

Algorithm to calculate trajectories from vector field

I have a two-dimensional vector field, i.e., for each point (x, y) I have a vector (u, v), whereas u and v are functions of x and y. This vector field canonically defines a set of trajectories, i.e. ...
2
votes
2answers
246 views

Dealing with units in arithmetic operations (multiplication and division)

I need to design a function to perform the basic arithmetic operations that are addition (+), subtraction (-), multiplication (x), and division (/) between 2 numbers. That function takes 3 arguments: ...
5
votes
2answers
640 views

Fractional and Cartesian Coordinates

I have a set of fractional coordinates. I also have a rotation matrix that operates on cartesian coordinates. Does anyone know how I could convert my rotation matrix so I can operate on the ...
17
votes
4answers
4k views

Return random `list` item by its `weight`

I have, for example, this table +-----------------+ | fruit | weight | +-----------------+ | apple | 4 | | orange | 2 | | lemon | 1 | +-----------------+ I need to return random ...
2
votes
2answers
498 views

What maths should I learn to become a better computer scientist? [closed]

I'm a self taught programmer, and although I know many people feel math isn't necessary, I find that in many examples of algorithms I come across talk about (what sounds to be) some pretty complex ...
3
votes
2answers
179 views

Do Databases Optimize Queries with Sum/Average or Other Aggregates?

Imagine a database that has billions of rows with, say, payments. You need to calculate an average payment sum. That will be SELECT avg(amount) FROM payments; Now, if you need to re-calculate this ...
0
votes
1answer
223 views

How important is maths depending on what your coding? [duplicate]

Possible Duplicate: What does mathematics have to do with programming? How often do you have to solve pure mathematical or algorithmical problems? I heard that math can be very important in ...
4
votes
3answers
527 views

What function or method can I use to equally distribute a workload

This is more of mathematical question than an algorithmic one; nevertheless it will be implemented in php. I have an array of N tasks. Each task has taken t time to complete(e.g. task 1 has taken 5 ...
2
votes
1answer
332 views

Is the Leptonica implementation of 'Modified Median Cut' not using the median at all?

I'm playing around a bit with image processing and decided to read up on how color quantization worked and after a bit of reading I found the Modified Median Cut Quantization algorithm. I've been ...
8
votes
1answer
347 views

Why is a Bayes classifier used for spam filtering?

I've been reading about Bayesian spam filtering and I think I understand the theory, but I just don't see why this approach is needed in order to calculate the likelihood of a message being spam, ...
6
votes
5answers
7k views

How to handle large numbers?

Well, I've just started doing puzzles and it's so annoying to see puzzles which are easy to do but also need to handle very large numbers. That's the problem. Say I have to deal with numbers like 10 ...
8
votes
7answers
1k views

What would be an appropriate algorithm to factorise numbers in the range of a few billion?

I'm learning Python at the moment and to give me reasons to apply what i'm learning I'm having a crack at some of the problems on Project Euler I'm currently on number 3, which is to determine the ...
9
votes
3answers
17k views

Good way to learn how to solve questions on InterviewStreet [duplicate]

Possible Duplicate: How do I adapt to pre-interview challenge questions? InterviewStreet is a new company that essentially acts as a filter for companies to find programmers that can code. ...
4
votes
1answer
402 views

Using Quadratic Bezier Curves to generate a cave that stays within certain bounds

I'm working on a project that generates a series of quadratic bezier curves and connects them together, maintaining slope from the end of one segment to the beginning of the next to make the ...
5
votes
3answers
510 views

All possible solutions to equation, where operators are arbitrary?

Given something like this: 1 5 3 4 = 18 I need to determine (using an algorithm) if there is a combination of operators and brackets that bring me to 18. Only "+" and "*" and "(" and ")" are ...
2
votes
2answers
2k views

0x9e3779b9 golden number

i'm trying to understand a constant 0x9e3779b9 what kind of data is this? it's not binary, not decimal, what is this? it's a constant used on the TEA algorithm it says it's derived from the golden ...
3
votes
6answers
2k views

how to prove the complexity of an algorithm mathematically

I know the fundamental algorithms and it's complexities. for e.g if Binary Search has Complexity O(log n), then how I can mathematically prove this?