algorithm

how to elegantly duplicate a graph (neural network)

I have a graph (network) which consists of layers, which contains nodes (neurons). I would like to write a procedure to duplicate entire graph in most elegant way possible -- i.e. with minimal or no overhead added to the structure of the node or layer. Or yet in other words -- the procedure could be complex, but the complexity should no...

What cluster node should be active?

There is some cluster and there is some unix network daemon. This daemon is started on each cluster node, but only one can be active. When active daemon breaks (whether program breaks of node breaks), other node should become active. I could think of few possible algorithms, but I think there is some already done research on this and s...

Data structure name: combination array/linked list

I have come up with a data structure that combines some of the advantages of linked lists with some of the advantages of fixed-size arrays. It seems very obvious to me, and so I'd expect someone to have thought of it and named it already. Does anyone know what this is called: Take a small fixed-size array. If the number of elements you ...

Iterating and Calculating numbers in a Map

I have a Map of Lists with key = GROUP and value = List numbers stored as Strings. One element is below GROUP1/[3.0, 4.0, 2.0, 3.0, 3.0, 2.0, 2.0, 2.0, 2.0, -2.0, -2.0, -2.0, 2.0] What I have to do is to cancel off (remove) all the negative numbers against the positives but reduce the +ve numbers by that value. In the above example, ...

define bigrand function in java

here is code of bigrand function in c code int bigrand (){ return RAND_MAX* rand()+rand(); } please tell me what is equivalent code in java? ...

Traveling salesman example with known global optimum

Hello. I made a memetic algorithm in Python for traveling salesman problem. However, all the test data (list of distances between cities) I've encountered lack the information of the best solution, so I can't know how close to global optimum my algorithm gets. Does anyone know where I can find some tsp test data (preferably in matrix f...

Best algorithm for finding the combination of a word?

Possible Duplicate: How to find all possible subsets of a given array? so say you have ab you can have a,b,ab whats the best way of doing this? ...

Making more recent items more likely to be drawn

There are a few hundred of book records in the database and each record has a publish time. In the homepage of the website, I am required to write some codes to randomly pick 10 books and put them there. The requirement is that newer books need to have higher chances of getting displayed. Since the time is an integer, I am thinking like...

Space partitioning algorithm

I have a set of points which are contained within the rectangle. I'd like to split the rectangles into subrectangles based on point density (giving a number of subrectangles or desired density, whichever is easiest). The partitioning doesn't have to be exact (almost any approximation better than regular grid would do), but the algorith...

GWT Calendrical Calculations

We have a GWT application that needs to display various holidays. Is there a library available to do these calendrical calculations? If not, we'll have to do our own that we can ingest a set of rules to. Cheers ...

question about charAt function

i know java API function charAt for example String s="dato" char r=s.charAt(0); r is equal d but my question is how realy it works or what function can i use instead of charAt function to get same result? thanks ...

finding an element of in a sorted array thats shifted

Possible Duplicate: Searching a number in a rotated sorted Array Say the original list is 1 2 3 4 5 6 7 8 9 10 and u shift it so that it becomes 5 6 7 8 9 10 1 2 3 4 so say i want to check if 7 is in the array. how would i do this efficiently. ...

Programmatically determine the relative "popularities" of a list of items (books, songs, movies, etc)

Given a list of (say) songs, what's the best way to determine their relative "popularity"? My first thought is to use Google Trends. This list of songs: Subterranean Homesick Blues Empire State of Mind California Gurls produces the following Google Trends report: (to find out what's popular now, I restricted the report to the last 3...

Algorithm to find 'maximal' independent set in a simple graph

Hi, in words, can someone post directions towards finding the 'maximal' independent set in a simple graph? I read up something from ETH site which said one can find such in O(n) by simply picking a random vertex v and than scanning the rest and attempting to find if there's an edge from v to the rest. Thanks ...

Javascript algorithm to find elements in array that are not in another array

I'm looking for a good algorithm to get all the elements in one array that are not elements in another array. So given these arrays: var x = ["a","b","c","t"]; var ​​​​​​​​​y = [​​​​​​​"d","a","t","e","g"]; I want to end up with this array: var z = ["d","e","g"]; I'm using jquery, so I can take advantage of $.each() and $.inArray(...

0/1 Knapsack with irrational weights

Consider the 0/1 knapsack problem. The standard Dynamic Programming algorithm applies only when the capacity as well as the weights to fill the knapsack with are integers/ rational numbers. What do you do when the capacity/weights are irrational? The issue is that we can't memoize like we do for integer weights because we may need pote...

question about random select

here is code print number in decreasing order import java.util.*; public class select { public static void Select(int m,int n){ Random r=new Random(); if (m>0) if (r.nextInt(0x3fff8001) % n <m ){ System.out.println(n-1); Select(m-1,n-1); } else{ Select(m,n-1); } } public static void main(String[]args){ int m=35; i...

Spaced repetition (SRS) for learning

A client has asked me to add a simple spaced repeition algorithm (SRS) for an onlinebased learning site. But before throwing my self into it, I'd like to discuss it with the community. Basically the site asks the user a bunch of questions (by automatically selecting say 10 out of 100 total questions from a database), and the user gives ...

question about interface

I have posted this question http://stackoverflow.com/questions/2874487/how-can-i-implement-this-python-snippet-in-java I have compiled it now i need to use in main project public static void main(String[]args){ } Can anybody show me example? ...

question about interface

Possible Duplicate: question about interface i have posted this question i have compiled it now i need to use in main project public static void main(String[]args){ } ? can anybody show me example? ...