algorithm

Programming theory: Solve a maze

Hey, What are the possible ways to solve a maze? Ive got two ideas, but I think they are not very elegant. Base situation: We have a matrix, and the elements in this matrix are ordered in a way that it represents a maze, with one way in, and one out. My first idea was to send a robot through the maze, following one side, until it's ou...

How can I determine the statistical randomness of a binary string?

How can I determine the statistical randomness of a binary string? Ergo, how can I code my own test, and return a single value that corresponds to the statistical randomness, a value between 0 and 1.0 (0 being not random, 1.0 being random)? The test would need to work on binary strings of any size. When you do it with pen and paper, y...

Is there a .NET library or example code out there that is useful for optimizing points on a line or decimation?

I have a large set of datapoints (all 2D that represent a edges of a shape) where there exists many that all line up in straight lines a series of many points (pixels) I would like to optimize the data by removing the points that make up straight lines (same vector) and leave only the last two end points of the series to define the line ...

User targeting algorithm

I have an application that visitors come and go. I m working with a data provider that gives me information about users such as their gender, age, location, and information about their personalities etc. Now, i d like to target these users with appropriate content. In short, I have content and users with their personality information...

How to efficiently store a matrix with highly-redundant values

I have a very large matrix (100M rows by 100M columns) that has a lots of duplicate values right next to each other. For example: 8 8 8 8 8 8 8 8 8 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3 3 3 3 3 3 3 3 3 3 3...

Better random "feeling" integer generator for short sequences

I'm trying to figure out a way to create random numbers that "feel" random over short sequences. This is for a quiz game, where there are four possible choices, and the software needs to pick one of the four spots in which to put the correct answer before filling in the other three with distractors. Obviously, arc4random % 4 will create...

question about common bit sequences

suppose we have two numbers i want write program which print common bits subsequent which occurs in these number or 1000010111001010100011110001010010101001011101001001001 0101 01110011011001010111101111111010001001011 one of the answer should be 0101 but constraint is that we should make bitwise operations and mathematical operati...

C++ NTL algorithms

Hi there, I cant seem to find any info on, which algorithms in the NTL C++ libraries are used. I am especially interested in the algorithms used for: Modular square root (SqrRootMod) Kernel of matrix over GF(2) (kernel for mat_GF2 objects) Greatest common divisor (GCD - this is probably euclids algorithm) Modular inverse (InvMod) J...

Polynomial time algorithms

I heard the following quote once, but forgot to whom it is attributed: While waiting for a (polynomial-time) algorithm to stop, don't forget that your lifetime is bounded by a polynomial, too. Could somebody supply a reference? Another question I have is: Polynomial-time algorithms are great, but what is an example of an algorithm...

The Travel Tickets Problem

You are given a stack of travel tickets for various transportations that will take you from a point A to point B via several stops on the way. All of the tickets are out of order and you don't know where your journey starts, nor where it ends. Sort the tickets in the right order to complete your journey. tickets = [ {from: "Barcelo...

How to find 1 X 15 array from 3 X 15 array?

Im trying to create 1 X 15 dimension unique array from 3 X 15 array. I am not able to achieve this .Please help me on this . Thanks in advance. The 3 X 15 array was Array[(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3),(1,2,3)] ...

Book Request: Distributed algorithms

Hey guys. I wanna learn sth about distributed algorithms, so I'm looking for any recommendation for books. I'm more interested in theoretical books, because implementation is just the matter of taste (I will use probably erlang (or c#)). But on the other hand i don't want raw, mathematican analyse of algorithms. Just the idea how sth wor...

How can I find the minimal circle include some given points?

I have given some points (2D-coordinates) and want to find the smallest circle, that includes all of this points. The algorithm doesn't have to be very efficient (while it would be nice naturally). ...

Game Development: How to limit FPS?

Hi, I'm writing a game, and I saw the FPS algorithm doesn't work correctly (when he have to calculate more, he sleeps longer...) So, the question is very simple: how to calculate the sleeptime for having correct FPS? I know how long it took to update the game one frame in microseconds and of course the FPS I want to reach. I'm searchi...

What books would you recommend after Cormen?

During my first year at the uni everyone told me that every good programmer should read Cormen's "Introduction to algorithms" and remember it. After 3 years of being lazy I finally managed to read it (and understand+remember most of it/everything) and it kinda interested me (also I realized I'd probably get the job I was applying for had...

Approximate Estimation of Distance Matrices

I have a set of N objects, and I'd like to compute a NxN distance matrix. Sometimes my set of N objects is very large, and I'd like to compute an approximation to the NxN distance matrix by only computing a subset of the distance comparisons. Can anyone point me in the direction of something that calculates approximations to a full dis...

Is there a book that explain the algorithm used by regular expression functions?

Is there a book that explains the algorithm used by the regular expression functions, and optionally shows an implementation in some high level language? ...

Dividing a plane of points into two equal halves

Given a 2 dimensional plane in which there are n points. I need to generate the equation of a line that divides the plane such that there are n/2 points on one side and n/2 points on the other. (by the way this not home work, I am just trying to solve the problem) ...

Algorithm to calculate percent difference betweem two blobs of text.

I've been researching on finding an efficient solution to this. I've looked into diffing engines (google's diff-match-patch, python's diff) and some some longest common chain algorithms. I was hoping on getting you guys suggestions on how to solve this issue. Any algorithm or library in particular you would like to recommend? Thanks. ...

Data structure and algorithms for a directed cyclic graph (F#)

I'm trying to analyse an application where the assembly references should be a directed-acyclic-graph, but aren't. There is also a related problem of sub-assemblies referencing different versions of one sub-sub-assembly (think Escher...) What I want to do is analyse each assembly-subassembly pair and build up a picture of where things a...