I have been working on the Knapsack problem using genetic algorithms. But I have run into a few difficulties...
First off the user generates a data set which is stored in a text document. From there I read the data in to the program.
I do fine getting the program to calculate fitness values, select parents, produce children, then muta...
I have a very, very large graph, and I want to find the shortest path from one vertex to another. The graph is directed and unweighted.
I have considered using some modification of Dijkstra's algorithm, but I usually use that for weighted undirected graphs.
So then my other thought was to use a DFS, since I can treat all the weights ...
I'm lost here. Here's the problem and I think it's NP-hard. A center is staffed with a finite number of workers with the following conditions:
There are 3 shifts per day with 2 people in each shift
Each employee works for 5 days straight and then 2 days off with only one shift per day
So the problem is: how many workers do we need if...
I want to learn Algorithms and become fluent in them. My goal is to land a job as a Software Development Engineer at either Google or Microsoft. I've been recommended to use the book "Introduction to Algorithms" by Cormen.
But I feel like the book is not for beginners.
Can anyone recommend a book on Algoritms that I can find easier ? o...
Possible Duplicates:
Generating permutations lazily
How to generate all permutations of a list in Python
Algorithm to generate all possible permutations of a list?
I didn't think this could be tough, but I'm having problem to come up with an algorithm to find all variations of n characters. We can assume each character onl...
OK, so I don't sound like an idiot I'm going to state the problem/requirements more explicitly:
Needle (pattern) and haystack (text to search) are both C-style null-terminated strings. No length information is provided; if needed, it must be computed.
Function should return a pointer to the first match, or NULL if no match is found.
Fa...
Can someone explain why this algorithm is free from deadlock specifically? thanks
...
Please suggest any template matching algorithms, which are independent of size and rotation.
(any source codes as examples if possible please)
EDIT 1:
Actually I understand how the algorithm works, we can resize template and rotate it. It is computationally expensive, but we can use image pyramids. But the real problem for me now is whe...
I am working on a tree library, and part of the required functionality, is to be able to search a node for child nodes that match a pattern.
A 'pattern' is a specification (or criteria) that lays out the structure, as well as attributes of nodes in the subtree(s) to be matched.
For example, suppose a tree represents data regarding a pa...
Background: I have a function in my program that takes a set of points and finds the minimum and maximum on the curve generated by those points. The thing is it is incredibly slow as it uses a while loop to figure out the min/max based on approximated error. Not completely sure what formal method this is because I did not write it myself...
I must write a function that takes two words (strings) as arguments, and determines if the first word can be transformed into the second word using only one first-order transformation.
First-order transformations alter only one letter in a word
The allowed transformations are: insert, remove and replace
insert = insert a letter at an...
Christoph Koutschan has set up an interesting survey that tries to identify the most important algorithms "in the world". Since one of the criteria is that "the algorithm has to be widely used" I though that extending the survey to the huge group of users at Stack Overflow would be a natural thing to do.
So, what do you think? Which alg...
I frequently use the STL containers but have never used the STL algorithms that are to be used with the STL containers.
One benefit of using the STL algorithms is that they provide a method for removing loops so that code logic complexity is reduced. There are other benefits that I won't list here.
I have never seen C++ code that ...
I have a problem where I have to find multiple combinations of subsets within nested hashsets. Basically I have a "master" nested HashSet, and from a collection of "possible" nested HashSets I have to programmatically find the "possibles" that could be simultaneous subsets of the "master".
Lets say I have the following:
var...
So I was looking at this code from a textbook:
for (int i=0; i<N; i++)
for(int j=i+1; j<N; j++)
The author stated that the inner for-loop iterates for exactly N*(N-1)/2 times but gives no basis for how he arrived to such an equation. I understand N*(N-1) but why divide by 2? I ran the code myself and sure enough when N is 10, the i...
I recently found a "DNA Computing" Algorithm (not genetic programming or genetic algorithms) that attempts to find the Hamiltonian Path in a graph, but I'm a little confused by the pseudo code... note that the notation is a little messed up because I copied it from a PDF paper on DNA computing:
Input: for each node v and edge (u; v),
...
I'm writing a Settlers of Catan clone for a class. One of the extra credit features is automatically determining which player has the longest road. I've thought about it, and it seems like some slight variation on depth-first search could work, but I'm having trouble figuring out what to do with cycle detection, how to handle the joining...
Right now I calculate it like this:
double dx1 = a.RightHandle.x - a.UserPoint.x;
double dy1 = a.RightHandle.y - a.UserPoint.y;
double dx2 = b.LeftHandle.x - a.RightHandle.x;
double dy2 = b.LeftHandle.y - a.RightHandle.y;
double dx3 = b.UserPoint.x - b.LeftHandle.x;
double dy3 = b.UserPoint.y - b.LeftHandle.y;
...
At some point in our lives we're put in the situation to learn a new language (either by job requirements or just passion). Personally, I'm trying to learn Objective-C coming from a background of several years coding php. My problem is that I'm bored with your average starting programs (most of them coming from maths; eg: Fibonacci).
Wh...
Is speaking of a linear linked linked in contrast to a circular linked list a valid / common term? For some examples I'm posting to my students I need to distinguish between both and don't want to use terms which don't actually exist!
...