I've been asked to recommend a resource (on-line, book, tutorial) to learn Algorithms (in the sense of of the MIT Intro to Algorithms) for non-CS or Math majors. Obviously the MIT book is way to involved and some of the lighter treatments (like Oreilly's Algorithms in a Nutshell) still seem as if you would need to have some background i...
Hello I am trying to write a C# version of KMP search from Algorithms in C book.
Having trouble finding the flaw in my algorithm. Would someone help?
static int KMP(string p, string str) {
int m = p.Length;
int n = str.Length;
int i;
int j;
int[] next = new int[m];
next[0] = -1;
for (i = 0, j = -1; i < m; i...
Given a BST, is it possible to find two numbers that add up to a given value, in O(n) time and little additional memory. By little additional memory, it is implied that you can't copy the entire BST into an array.
...
I have been looking at various programming problems and algorithms in an effort to improve my programming and problem solving skills. But, I keep running into description like this one:
"Let A = [a1,a2,...,an] be a permutation of integers 1,2,...,n. A pair of indices (i,j), 1<=i<=j<=n, is an inversion of the permutation A if ai>aj. We a...
Hi!
I'm looking for efficient algorithm for storing and fetching data by key.
I've already read about Litvin linear dynamic hash and another methods, but still, i wonder is there some way to get (search, calculate) key in VERY large binary file (consider more than 100 gb)?
I'm just curios is there ANY algorithm which works without perf...
void swap(ref int x, ref int y)
{ x = x ^ y; y = y ^ x; x = x ^ y; }
im learning about bitwise XOR. how is this swapping occurring? it's blowing my mind. this method is supposed to swap the contents of X and Y, but i dont understand AT ALL what is going on?
...
Has anyone implemented a path finding algorithm (A*, Dijkstra's algoritm, Breath First Search, etc.) using CouchDB's maps & views? Is it even possible? I've seen some implementations for other mapreduce software (e.g. http://horicky.blogspot.com/2010/02/nosql-graphdb.html), however they rely on an global state, which CouchDB lacks (right...
I am looking for an algorithm that will allow me to visually separate any two to four vehicles within a large list of vehicles that are close enough together on a map such that they obscure one another. I need to filter out instances where there are more than four vehicles as the vehicles will congregate in certain areas in large quanti...
Hello i'm trying to create an algorythm that finds out how many ways i can get change back.
But i just can't get the implemtation right, i keep getting 4 where i should get 6 and i just can't see why.
This is my implementation in C#, it is create from the pseudocode from http://www.algorithmist.com/index.php/Coin_Change
private st...
What are some practical applications of the ROT13 algorithm? Since it can't be used for encryption, the only usages I've seen of it involve scrambling spoilers or answers to questions. Are there other more practical and useful cases where ROT13 is used?
...
This website offers the "Schinke Latin stemming algorithm" for download to use it in the Snowball stemming system.
I want to use this algorithm, but I don't want to use Snowball.
The good thing: There's some pseudocode on that page which you could translate to a PHP function. This is what I've tried:
<?php
function stemLatin($word) {
...
Given a decimal x, I want to test if x is within 10^-12 of a rational number with denominator 9999 or less. Obviously I could do it by looking at x, 2x, 3x, and so on, and seeing if any of these is sufficiently close to an integer. But is there a more efficient algorithm?
...
I working on a combinatorial optimization problem that I suspect is NP-hard, and a genetic algorithm has been working well with our dataset. We're a research group and plan to publish our results in our field (not in math or CS), and I'd like to explore the NP-hard question before sending the manuscript out for review.
There are two ...
Hi people,
I just wanted to know what is the best way to un-order the elements in an ordered array in Java,
Thanks
...
I was asked a few weeks ago, to find all the different and unique ways to reach the top right of a chess board, with x, y > 3, starting from (0, 0), knowing that you can only increase x and y by +1.
I still haven't been able to find algorithms that would explain how to navigate over a chessboard, so I was wondering if you guys had anyth...
I am beginning to learn crypto algorithms and I understand how the above mentioned algorithms work. Is it that the key length of AES is longer? Which steps of AES encryption makes it less vulnerable than DES?
...
Hi all:
I went to an interview today and here is the question:
Suppose you have got 1 billion integers which are unsorted at one disk file,please find out the largest 100 numbers,try the best solution as you can.
Anybody who has ideas,please do share!
Thanks in advance!
...
Hi all:
So here is the question:
Suppose you have got 100 thousands integers which ranges from 1 to 1 million,please sort out the integers and its time complexity should be O(n)
Anybody who shares his or her ideas is well appreciated.
Thanks in advance!
...
I have to XOR numbers from 1 to N, does there exist a direct formula for it ?
For example if N = 6 then 1^2^3^4^5^6 = 7 I want to do it without using any loop so I need an O(1) formula (if any)
...
Hi, I'm trying to parse a large number of short strings into some logical parts. It seems like an interesting problem that someone could've already solved, but I cannot find any papers / solutions (or maybe I'm trying wrong keywords).
The strings are have 2-5 parts. If I substitute each word for a letter saying which "part" / "section" ...