I have a N-dimensional vector, X and 'n' equidistant points along each dimension and a parameter 'delta'. I need a way to find the total of n^N vectors enclosed by the Hypercube defined with the vector X at the center and each side of Hypercube being of size 2*delta.
For example:
Consider a case of N=3, so we have a Cube of size (2*de...
I wish to select a random word from a list where the is a known chance for each word, for example:
Fruit with Probability
Orange 0.10
Apple 0.05
Mango 0.15
etc
How would be the best way of implementing this? The actual list I will take from is up to 100 items longs and the % do not all tally to 100 % they do fall short to account...
Lets take StackOverflow questions as example. Each of them has multiple tags assigned. How to build an algorithm that would find related questions based on how many common tags they have (sorted by number of common tags)?
For now I can't think about anything better than just selecting all questions that have at least one common tag into...
Hi,
I'm trying to find the value of PI using the "Dart Board Method" but I've been unable to find a relevant algorithm on the net. Do you know of a link which can help me to understand this method and also provides an algorithm for this?
Thanks.
...
This is purely out of curiosity. I was browsing through an article comparing various string search algorithms and noticed they were all designed to find the first matching substring. This got me thinking... What if I wanted to find all occurrences of a substring?
I'm sure I could create a loop that used a variant of KMP or BM and dumpe...
I have seen many questions on SO about this particular subject but none of them has any answer for me, so I thought of asking this question.
I wanted to generate a random number between [-1, 1]. How I can do this?
...
I can use the median of medians selection algorithm to find the median in O(n). Also, I know that after the algorithm is done, all the elements to the left of the median are less that the median and all the elements to the right are greater than the median. But how do I find the k nearest neighbors to the median in O(n) time?
If the med...
Can someone explain in English how does Non-Recursive merge sort works ?
Thanks
...
I am working on a project with a group, and we are making an experimental site that involves heavy user interaction. In a nutshell, the nature of the site involves heavy user posting and commenting. Based on the theme of our site, we are expecting to get controversial posts and most likely offensive material.
My question is what algori...
I'm planning to automate the FAQ section in my site where the questions and answers stored in standard DB and would like to get the input question from the user and recognize it (algorithm) and get the appropriate answer for that and return it to the user.
Approach :
get input string -> parse -> check words with each question in DB ->re...
I recently launched my humble side project and would like to add a "related submissions" section when viewing a submission. Exactly like what SO is doing here - see right column, titled "Related"
Considering that each submission has a title and a set of tags, what is most effective (optimum result), most efficient (fast, memory friendly...
How is derivative of a f(x) is typically calculated programmatically to ensure maximum accuracy? I am implementing the Newton-Raphson method and it requires taking of the derivative of a function.
thanks
...
I have a datasets with information like age, city, age of children, ... and a result (confirm, accept).
To help modelisation of "workflow", I want to create automatically a decision tree based on previous datasets.
I have take a look at http://en.wikipedia.org/wiki/Decision_tree_learning and I know that the problem is clearly not obvio...
I have implemented the algorithm X using Dancing Links in Java, however, I'm getting unexpected results, that is I'm having dupes of rows of results which are not exact covers.
My code can be found at http://pastebin.com/m4cd3817f .
I have previously posted a chunk of code in which the wonderful community of StackOverflow helped me fi...
I am implementing an avl tree for my assignment.
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
struct TreeNode {
char *item;
struct TreeNode *left;
struct TreeNode *right;
signed char balance;
};
typedef struct TreeNode Node;
void _print_avl (Node *, int , const char *);
Node * get_new_node (...
I had this question on an Algorithms test yesterday, and I can't figure out the answer. It is driving me absolutely crazy, because it was worth about 40 points. I figure that most of the class didn't solve it correctly, because I haven't come up with a solution in the past 24 hours.
Given a arbitrary binary string of length n, find th...
I am trying to enumerate a number of failure cases for a system I am working on to make writing test cases easier. Basically, I have a group of "points" which communicate with an arbitrary number of other points through data "paths". I want to come up with failure cases in the following three sets...
Set 1 - Break each path individuall...
I'm working on a Braille translation library, and I need to translate a string of text into braille. I plan to do this in multiple passes, but I need a way to keep track of which parts of the string have been translated and which have not, so I don't retranslate them.
I could always create a class which would track the ranges of positi...
I have the following pseudo-code in my book for a breadth-first search:
function breadth_first_search:
begin
open := [Start]
closed := [];
while open != [] do
begin
remove leftmost state from open, call it X;
if X is a goal then return SUCCESS
...
Hello,
I am searching for an online resource referring to data structures and algorithms. Basicaly what I am interested in, is a kind of comprehensive list of things such as: when a data structure or algorithm is used, pros and cons compared to each other, real life-problem usage, etc.
I have a couple of popular books on the subject, l...