algorithm

Finding equal subgraphs

Given: a directed Graph Nodes have labels the same label can appear more than once edges don't have labels I want to find the set of largest (connected) subgraphs which are equal taking the labels of the nodes into account. The graph could be huge (millions of nodes) does anyone know an efficient solution for this? I'm looking for...

Best approach to holding large editable documents in memory

I need to hold a representation of a document in memory, and am looking for the most efficient way to do this. Assumptions The documents can be pretty large, up to 100MB. More often than not the document will remain unchanged - (i.e. I don't want to do unnecessary up front processing). Changes will typically be quite close to each oth...

robust algorithm for surface reconstruction from 3D point cloud?

I am trying to figure out what algorithms there are to do surface reconstruction from 3D range data. At a first glance, it seems that the Ball pivoting algorithm (BPA) and Poisson surface reconstruction are the more established methods? What is the established, most robust algorithm in the field? Recommended research publications? Is t...

Get the most average position of X objects on a path with Y available positions

Hi, Its friday, and in local time the clock is 3.22pm, so my brain wont give me a solution, so i ask: Im trying to write a function/algorithm in Actionscript 3.0 that gives me the most average positions of x number of positions along a path of y number of available positions. Y is always larger than X of course. The background is, I ...

How do I calculate a point on a circle’s circumference?

How can the following function be implemented in various languages? Calculate the (x,y) point on the circumference of a circle, given input values of: Radius Angle Origin (optional parameter, if supported by the language) ...

Looking for algorithms to generate realistic planets

I'd like to collect a list of algorithms and other resources to generate realistic and interesting visuals of planets. The visual should look like something which you'd expect to find on the NASA homepage. Key attributes would be: a nice colorful atmosphere for gas giants rings (optional) impact craters for solid rocks without atmosph...

Computing the second (mis-match) table in the Boyer-Moore String Search Algorithm

For the Boyer-Moore algorithm to be worst-case linear, the computation of the mis-match table must be O(m). However, a naive implementation would loop through all suffixs O(m) and all positions in that that suffix could go and check for equality... which is O(m3)! Below is the naive implementation of table building algorithm. So this qu...

Substring Extraction problem

Given 2 strings, write a function that returns the position of String B that matches String A if String A is a substring of String B. Otherwise return -1. Example: strA = "ello" strB = "Hello_World" Your function should return 1. strA = "blah" strB = "blha" Your function should return -1. ...

Threading for distance vector which does not drop packets.

Hi I am doing my assignment in Network architecture 1, where I have to implement a distance vector routing at each node. At each node, I have a thread which listens for incoming DatagramPackets containing routing information from neighboring nodes only on a specific port. When a datagram arrives, the thread processes that datagram, an...

branch and bound

Can someone explain the branch and bound search technique for me? I need to find a path with the smallest cost from any start node to an end node of any random graph using branch and bound search algorithm. ...

Algorithm for analyzing text of words

I want an algorithm which would create all possible phrases in a block of text. For example, in the text: "My username is click upvote. I have 4k rep on stackoverflow" It would create the following combinations: "My username" "My Username is" "username is click" "is click" "is click upvote" "click upvote" "i have" "i have 4k" "have 4...

Astar-like algorithm with unknown endstate

A-star is used to find the shortest path between a startnode and an endnode in a graph. What algorithm is used to solve something were the target state isn't specifically known and we instead only have a criteria for the target state? For example, can a sudoku puzzle be solved with an Astar-like algorithm? We dont know how the endstate ...

How can I check parity without converting to binary?

How can I get the number of "1"s in the binary representation of a number without actually converting and counting ? e.g. def number_of_ones(n): # do something # I want to MAKE this FASTER (computationally less complex). c = 0 while n: c += n%2 n /= 2 return c >>> number_of_ones(5) 2 >>> ...

Image comparison - fast algorithm

I'm looking to create a base table of images and then compare any new images against that to determine if the new image is an exact (or close) duplicate of the of the base. For example: if you want to reduce storage of the same image 100's of times, you could store one copy of it and provide reference links to it. When a new image is e...

How do you Index Files for Fast Searches?

Nowadays, Microsoft and Google will index the files on your hard drive so that you can search their contents quickly. What I want to know is how do they do this? Can you describe the algorithm? ...

how to calculate the network diameter

I have data stored in relational database mysql and PHP. I have a table called "rel" which has two fields: from_node | to_node ===================== 1 2 1 3 2 3 and so on...... How can I calculate the network Diameter of a network. I know it is the longest or shortest path between any two p...

finding the outside of a geometric graph

I have a map of polygons, for example: (sorry the image isn't so great, I'll try and get better one later) The green lines are the shortest path from between the connected shapes. What I need to do is find the green lines that form the outer edge and which direction I need to traverse them in to circle CCW. The polygons will alway...

Fastest Dijkstra algorithm for j2ME

Hi All, Can anybody help me to make j2ME implementation of Dijkstra algorithm faster ? I have two loops, one inside another. Like this while(for each item in Q) { //...do something. //the following loop is to find the minimum for(all un-visited nodes in Q) { //.. do something to get min. } } I have almost...

Text packing algorithm

I bet somebody has solved this before, but my searches have come up empty. I want to pack a list of words into a buffer, keeping track of the starting position and length of each word. The trick is that I'd like to pack the buffer efficiently by eliminating the redundancy. Example: doll dollhouse house These can be packed into the bu...

Efficient way to search a stream for a string

Let's suppose that have a stream of text (or Reader in Java) that I'd like to check for a particular string. The stream of text might be very large so as soon as the search string is found I'd like to return true and also try to avoid storing the entire input in memory. Naively, I might try to do something like this (in Java): public b...