algorithm

Comment my MMO client<>server movement handling.

I'm working on a basic 2D flash MMO. The first alpha will contain the basics: players can move around. This is, I think, also the most important part to be highly optimized. As movement happens all the time and costs a lot of bandwidth. This is how my current system works: All movement is calculated by the client When a client changes...

SORT Integer Array TAG a STRUCTURE Array (or two)

So the idea is to sort a large STRUCTURE using an element of that structure, for arguments sake Zip Code. To keep it simple lets pretend that there are two arrays, one integer containing the zip codes and two, a larger structure (3k Bytes) array. Sorting the integer array is suitably fast with Quick Sort, but tagging the Structure arr...

How do you implement Velicer's MAP criterion in R

I'm looking at the psych package and the VSS tutorial, do I simply replace VSS with MAP? Like this: MAP(x, n = 8, rotate = "varimax", diagonal = FALSE, fm = "pa", n.obs=NULL,plot=TRUE,title="Very Simple Structure",...) or is there another way to do this? I've doing factor analysis right now and I'm using the elbow method on a scree pl...

Distributed systems, best framework ?

Hello, I am building a software program that follows the scenario: I have many computers, and add each one of them to the a cluster. Each computer in the cluster can add a file to a distributed table (dictionary,hashmap, should be fast enough). So now I have a place where everyone can see what files does the group/cluster contains. No...

C#: Combining adjacent ranges

As a follow up to the method that collapses overlapping ranges I thought I would try to create a method that combines adjacent ranges. Basically, after running the Collapse method you may end up with for example 1 to 5 and 6 to 10. I would like to combine those into one range, 1 to 10. This is what I have come up with so far, but it d...

Code-golf: generate pascal's triangle

Generate a list of lists (or print, I don't mind) a Pascal's Triangle of size N with the least lines of code possible! Here goes my attempt (118 characters in python 2.6 using a trick): c,z,k=locals,[0],'_[1]' p=lambda n:[len(c()[k])and map(sum,zip(z+c()[k][-1],c()[k][-1]+z))or[1]for _ in range(n)] Explanation: the first element of...

enemies and slopes

How would you achieve a certain slope for a moving object ? I'm trying to get a enemy to spawn of the screen at point x,y and fly by itself across the screen to a new x,y while aslo adding a slope so it looks like it's swooping downward,straight, or upwards.. something like that. Right now I only have the knowledge of spawning and movi...

Quickest way to find substrings in text files

What's the fastest way to find strings in text files ? Case scenario : Looking for a particular path in a text file with around 50000 file paths listed (each path has it's own line). ...

Combining semacodes and steganography?

This is an idea I have been thinking about, but I do not quite know how to solve it. I would like to know if any solutions like this exists out there, or if you guys have any idea how this could be implemented. Steganography Steganography is basically the art of hiding messages. In modern days we do this digitally by e.g. modifying the...

Algorithm to evenly distribute items into 3 columns

I'm looking for an algorithm that will evenly distribute 1 to many items into three columns. No column can have more than one more item than any other column. I typed up an example of what I'm looking for below. Adding up Col1,Col2, and Col3 should equal ItemCount. Edit: Also, the items are alpha-numeric and must be ordered within t...

How to create a spanning tree

I have a directed graph for all kinds of available address formats in Java, which includes cycles. I want to store user Address which is a span of this graph in addition to the above template. My graph is obtained from the XML below: <address> <city start="true"> <minicity /> <street /> <square /> </city>...

Is the Mythical Man Month communication paths truly n^2 ?

Wouldn't it be closer to: n * (n - 1) / 2 The above formula is the answer to this middle school Math-team problem: "You have n people in a room and they all shake hands with everyone else. How many handshakes took place?" Wouldn't this also apply to the number of people communicating within a software project? Disclaimer I haven't...

Algorithms or Patterns for reading text

My company has a client that tracks prices for products from different companies at different locations. This information goes into a database. These companies email the prices to our client each day, and of course the emails are all formatted differently. It is impossible to have any of the companies change their format - they will not...

project ideas on algorithms ,data structures and parallel programming

Hi, I am a final year Computer Science and Engineering student.As part of the final year project i was planning to implement a graph algorithms library(using parallelization) for c++ but came to know that they have already been implemented. I would be very grateful if you people could suggest me some other project ideas related to my...

Least Squares solution to simultaneous equations

I am trying to fit a transformation from one set of coordinates to another. x' = R + Px + Qy y' = S - Qx + Py Where P,Q,R,S are constants, P = scale*cos(rotation). Q=scale*sin(rotation) There is a well known 'by hand' formula for fitting P,Q,R,S to a set of corresponding points. But I need to have an error estimate on the fit - s...

Transform arbitrary SQL SELECT TOP(x) to a SELECT COUNT(*)?

I want to be able to take any arbitrary SELECT TOP(X) query that would normally return a large number of rows (without the X limit) and transform that query into a query that counts how many rows would have been returned without the TOP(X) (i.e. SELECT COUNT(*)). Remember I am asking about an arbitrary query with any number of joins, w...

Inverting binary networks

How can I invert a binary equation, such that I can find which inputs will produce a given output. Example: Inputs: i0 through i8 Outputs: o0 through o8 Operators: ^ = XOR, & = AND Binary equations: (1&i0) ^ (1&i1) ^ (0&i2) ^ (1&i3) ^ (0&i4) ^ (0&i5) ^ (0&i6) ^ (0&i7) ^ (0&i8) = o0 (0&i0) ^ (1&i1) ^ (0&i2) ^ (1&i3) ^ (1&i4) ^ (0&i5)...

Apriori Algorithm

I've heard about the Apriori algorithm several times before but never got the time or the opportunity to dig into it, can anyone explain to me in a simple way the workings of this algorithm? Also, a basic example would make it a lot easier for me to understand. ...

Percentiles of Live Data Capture

I am looking for an algorithm that determines percentiles for live data capture. For example, consider the development of a server application. The server might have response times as follows: 17 ms 33 ms 52 ms 60 ms 55 ms etc. It is useful to report the 90th percentile response time, 80th percentile response time, etc. The naive alg...

data structures and algorithms e-books

Hi, Where can I find e-books on Data Structures and Algorithms? I am currently reading "Computer Algorithms: Introduction to design and Analysis" by Sara Baase and Allen Van Gelder. I would like to have additional information to supplement what's in this book. Also some references on worst-case analysis would be great. ...