I have been writing a JS algorithm. Its blazing fast in chrome and dog slow in FF. In the chrome profiler, I spend <10% in a method, in FF the same method is 30% of the execution time. Are there javascript constructs to avoid because they are really slow in one browser or another?
One thing I have noticed is that things like simple v...
I have a canvas where I can draw, resize and move rectangles around.
I'm looking for an algorithm to prevent overlap and enable snapping of the rectangle I'm editing with other rectangles.
I'm tried different approaches but I couldn't get one working properly.
All my approaches are based on a simple loop that check the rectangle I'm e...
If n beds are to be allocated to m people.Each may have multiple preferences or not prefer at all. How to satisfy maximum people. A person who had a preference and got the same will be accounted as a satisfied person.
I tried allocating a person with minimum preferences first with minimum preferred bed. Is there some case I am missing, ...
I'm taking in a float as input, and then outputting its equivalent representation in base 2 scientific notation. This is in IEEE 32 bits with: 31 sign bit, 23-30 exponent (with 127 offset), 0-22 mantissa (with implicit leading 1).
One of the conditions which I'm not exactly sure the meaning of is "Your mantissa should have the implicit ...
Hi,
I'm working on a cluster analysis program that takes a set of points S as an input and labels each point with that index of the cluster it belong to. I've implemented the DBScan and OPTICS algorithms and they both work as expected.
However, the results of those algorithms can be very different depending on the initial values of MinP...
Given n circles with radii r1 ... rn, position them in such a way that no circles are overlapping and the bounding circle is of "small" radius.
The program takes a list [r1, r2, ... rn] as input and outputs the centers of the circles.
I ask for "small" because "minimum" radius converts it into a much more difficult problem (minimum ve...
Hello Guys,
I'm going to implement recursive folder comparison on python. What do you think would best algorithm for this?
Get two lists of the files for the folders
Sort both lists
Compare using filecmp module for a file
Repeat for every folder recursively
In result I need to get only the list of the files that are different (conte...
Possible Duplicate:
Dumb 8 Queens problem in C++ using goto and backtrack
Having problems understanding how to use an one dimensional array to implement the eight queens problem. Also can't figure out how to print the array to print out all possible solutions.
#include "stdafx.h"
#include <iostream>
using namespace std;
in...
Does anyone have a concise and robust implementation of Google's Encoded Polyline Algorithm in C#?
I essentially want the implementation of this signature:
public string Encode(IEnumerable<Point> points);
...
Greetings all,
I am in the designing phase of one of my hobby project.I am going to develop an 3D air-combat game . (inspired by HAWX).
But I am wondering how the AI works for enemy crafts ? I guess ,they do not move along a path (path finding on a graph)as in FPS games .
What kind of algorithms can I use for enemy craft movement?
Are t...
Suppose that I have an array of random reals, how do I the indices pair (i, j) where j<i and
maximise (a[j] - a[i]) in O(n ln(n)) time
n ln n sugguest recursions. So I was thinking of sorting the array in n ln n sort. but then the min and mix of the sorted array might not satisfy j<i
The difference a[j]-a[i] depends on all i , j so s...
Like the title, How to compare text?. For a example, go to textdiff.com.
...
I need help to design the best data structure for a GRAPH. The following is my implementation.
Please give your thoughts on this design.
#ifndef _GRAPH_H_
#define _GRAPH_H_
#include <map>
#include <vector>
#include <iostream>
#include <list>
template <typename T>
class Vertex {
public:
Vertex(){};
Vertex(T inVertex): m_ver...
Hi guys,
I am given a task of developing a tool for migrating data from MSSQL 2000 do MySQL database.
My clients runs a third party software which stores data in MSSQL 2000. The application is desktop software that stores data in local MSSQL Server.
My Application is in web. We store data on online servers. Now my task is to write a ...
I'm writing a Digital Fountain system in C#. Part of this system creates me sets of integers, I need to find the combinations of sets which create can leave me with a set of just one item. What's the fastest way to do this?
Set A: 1,2,3,4,5,6
Set B: 1,2,3,4,6
Set C: 1,2,3
Set D: 5,6
Solutions:
A - B => 5
A - (C + D) => 4
I don't need...
Who can recoment stable and correct implementation SVD method in C++? Preferably standalone implementation (would not want to add large library for one method).
I use OpenCV... but openCV SVD return different decomposition(!) for single matrix. I understand, that exists more than one decomposition of simple matrix... but why openCV do l...
Please also let me know the time complexity we can improve.
...
Cycle sort is an in-place sort based on the idea that the permutation you're sorting can be factored into cycles. If you rotate each cycle one position, the array will be sorted. This can easily be coded so that the number of writes to the array is the theoretical minimum needed for any in-place sort (which is nice for huge data sets on,...
Hi,
i have to Find the longest path in a directed cyclic graph from a source s to a destination f. Assume no positive weight cycles exists
even though no positive weight cycles exist, cycles of 0 or negative weights do exist. Can someone suggest an algorithm for finding the longest path in this case. please cite source if possible.
tha...
Hello
Given a DAG with |V| = n and has s sources we have to present subgraphs such that each subgraph has approximately k1=√|s| sources and approximately k2=√|n| nodes.
If we define the height of the DAG to be the maximum path length from some source to some sink.
We require that all subgraphs generated will have approximately the sa...