I am trying to understand the 3-way radix Quicksort, and i dont understand why the the CUTOFF variable there? and the insertion method?
public class Quick3string {
private static final int CUTOFF = 15; // cutoff to insertion sort
// sort the array a[] of strings
public static void sort(String[] a) {
// StdRandom...
i have following code in c++
#include <iostream>
using namespace std;
void qsort5(int a[],int n){
int i;
int j;
if (n<=1)
return;
for (i=1;i<n;i++)
j=0;
if (a[i]<a[0])
swap(++j,i,a);
swap(0,j,a);
qsort5(a,j);
qsort(a+j+1,n-j-1);
}
int main()
{
return 0;
}
void swap(int i,in...
I have a set of simple (no holes, no self-intersections) polygons, and I need to check that they don't intersect each other (one can be entirely contained in another; that is okay). I can check this by simply checking the per-vertex inside-ness of one polygon versus other polygons.
I also need to determine the containment tree, which is...
What are the basic and simpliest steganography algorithms and methods?
I mean the steganography applied to images.
How does simple program that hides data to images work? What are the main techniques used? How does the program recognize the encrypted message in image without the source image?
...
Hi,
Are there any librarys for mood matching a song. i.e. some algorithm to finger print every song and shuffle the list by my mood(the current playing file(s))?
Cheers,
Mark
...
I'm looking for an efficient C or C++ algorithm that can convert RGB to HSV and vice versa. Thanks
...
I am now looking for an elegant algorithm to recursively find neighbors of neighbors with the geohashing algorithm (http://www.geohash.org).
Basically take a central geohash, and then get the first 'ring' of same-size hashes around it (8 elements), then, in the next step, get the next ring around the first etc. etc.
Have you heard of an ...
I'm trying to write a function in PHP that gets all permutations of all possible sizes. I think an example would be the best way to start off:
$my_array = array(1,1,2,3);
Possible permutations of varying size:
1
1 // * See Note
2
3
1,1
1,2
1,3
// And so forth, for all the sets of size 2
1,1,2
1,1,3
1,2,1
// And so forth, for all the...
A fast algorithm to find the size of the largest clique in a perfect graph(this one having odd cycles with at least 1 chord) with about 100 vertices ??
And is there any simpler method than brute force as this is a perfect graph and there should be a polynomial time solution to it. But I am not able to find the algorithm.
Does greedy co...
I am struggling to solve the following problem
http://uva.onlinejudge.org/external/1/193.html
However Im not able to get a fast solution.
And as seen by the times of others, there should be a solution of maximum n^2 complexity
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_proble...
Given..
1 - The start-point GPS coordinates,
2 - The end-point GPS coordinates,
3 - The speed at which the object is travelling,
4 - Knowing that the trip trajectory will be a straight line...
How can I calculate what my GPS coordinated will be in n minutes' time? That is to say, how can I calculate my position at a given time after...
If memory were not scarce, how would you implement a sort in a language with libraries for representing and sorting sets
...
I have a list a vertices and a list of triangles. I'd like to split this single mesh into, say 5, randomly shaped meshes. When the 5 randomly shaped meshes are in place the sphere should all line up and look like 1 solid mesh.
I need a algorithm to do this programmatically, not a tool to do it form me. Any pointers would be great!
...
As a result of changes in the company, we have to rearrange our sitting plan: one room with 10 desks in it. Some desks are more popular than others for number of reasons. One solution would be to draw a desk number from a hat. We think there is a better way to do it.
We have 10 desks and 10 people. Lets give every person in this contest...
hi i have question about one problem
show if square of number is equal sum of it's n right digit plus n or n-1 left digit?
or
let n=297
n*n=88209
and 88+209=n
what is algorithm to solve this problem please help
...
Occasionally I read news articles that mention about some computer models that computer scientists use to predict winners of some sporting events or the odds for betting which I think there must be a mathematical model behind it. I never bothered to think twice even though I am a "pseudo computer scientist" myself. With the 2010 FIFA W...
Suppose you were able keep track of the news mentions of different entities, like say "Steve Jobs" and "Steve Ballmer".
What are ways that could you tell whether the amount of mentions per entity per a given time period was unusual relative to their normal degree of frequency of appearance?
I imagine that for a more popular person like...
Hey!
I'm working on an algorithm for Redundant Binary Representation (RBR) where every two bits represent a digit.
I designed the comparator that takes 4 bits and gives out 2 bits. I want to make the comparison in log 2 n so If I have X and Y .. I compare every 2 bits of X with every 2 bits of Y. This is smooth if the number of bits of...
I'm in the process of creating a game where the user will be presented with 2 sets of colored tiles. In order to ensure that the puzzle is solvable, I start with one set, copy it to a second set, then swap tiles from one set to another. Currently, (and this is where my issue lies) the number of swaps is determined by the level the user i...
Hi,
I have to draw an ellipse of arbitrary size and orientation pixel by pixel. It seems pretty easy to draw an ellipse whose major and minor axes align with the x and y axes, but rotating the ellipse by an arbitrary angle seems trickier. Initially I though it might work to draw the unrotated ellipse and apply a rotation matrix to eac...