I want to write a navigator application, which draws maps from images. Maps need to be drawn dynamically, based on user's navigation. My idea is loading 9 images into memory, and then create a view to show needed map:
When user navigates, the view is moved. When needed, images which no longer seen will be destroyed, and new ones will ...
I have a data table with 600,000 records that is around 25 megabytes large. It is indexed by a 4 byte key.
Is there a way to find a row in such dataset quickly with PHP without resorting to MySQL?
The website in question is mostly static with minor PHP code and no database dependencies and therefore fast. I would like to add this data...
There are two integer sequences A[] and B[] of length N,both unsorted.
Requirement: through the swapping of elements between A[] and B[]( can randomly exchange, not with same index), make the difference between {the sum of all elements in A[]} and {the sum of all elements in B[]} to be minimum.
PS: actually,it is an interview question...
I have an array of 1000-2000 elements which are pointers to objects. I want to keep my array sorted and obviously I want to do this as quick as possible. They are sorted by a member and not allocated contiguously so assume a cache miss whenever I access the sort-by member.
Currently I'm sorting on-demand rather than on-add, but because ...
I would like to create a color generator based on random numbers, which might differ just slightly, but I need colors to be easily recognizable from each other. I was thinking about generation then in a rgb format which would be probably easiest. I'm afraid simply multiplying given arguments wouldn't do very well. What algorithm do you s...
I have question about hoare partition method. Here is code and also pseudo-code. Please if something is wrong, correct pseudo code.
HOARE-PARTITION ( A, p, r)
1 x ← A[ p]
2 i ← p−1
3 j ← r +1
4 while TRUE
5 do repeat j ← j − 1
6 until A[ j ] ≤ x
7 do repeat i ← i + 1
8 until A[i] ≥ x
9 if ...
Lets say you have a DataTable that has columns of "id", "cost", "qty":
DataTable dt = new DataTable();
dt.Columns.Add("id", typeof(int));
dt.Columns.Add("cost", typeof(double));
dt.Columns.Add("qty", typeof(int));
And it's keyed on "id":
dt.PrimaryKey = new DataColumn[1] { dt.Columns["id"] };
Now what we are interested in is the co...
Is there a standard function that returns the position(not value) of the max element of an array of values?
For example:
say i have an array like this:
sampleArray = [1, 5, 2, 9, 4, 6, 3]
I want a function that returns the integer of 3 that tells me that sampleArray[3] is the largest value in the array.
...
Hey everybody,
What is the Best oder of traversing edges within Bellman-Ford algorithm
in Order to achieve a min. number of iterations necessary.?
thx in advance,
Andreas
...
Hi, how can I build a balanced quad tree.
Thanks, Marcos
...
Here we have an interesting real-world algorithm requirement involving colors.
1) Nice random colors: In ordeeing to draw a beautifull chart (i.e: pie chart) we need to pick a random set of Colors that:
a) are different enought
b) Play nicely
Doesnt Look hard. For example u fix bright and saturation and divide hue in steps of 360/N...
I've been going through Skiena's excellent "The Algorithm Design Manual" and got hung up on one of the exercises.
The question is:
"Given a search string of three words, find the smallest snippet of the document that contains all three of the search words—i.e. , the snippet with smallest number of words in it. You are given the index po...
First of all, I don't want to visually arrange 3D models dragging them with the mouse, all I want is:
Given a room of certain dimensions (L,W,H) and given a set of elements like beds, chairs, etc (with L,W,H dimensions, of course) I want to automatically arrange those elements to take advantage of the space as much as I can. So I want ...
I am looking to create a special type of combination in which no two sets have more than one intersecting element. Let me explain with an example:
Let us say we have 9 letter set that contains A, B, C, D, E, F, G, H, and I
If you create the standard non-repeating combinations of three letters you will have 9C3 sets.
These will contain ...
I have to implement quicksort. From Programming Pearls here is the code:
public class Quick{
public static void quicksort(int x[], int l, int u)
{
if (l>=u)
return;
int t = x[l];
int i = l;
int j = u;
do
{
i++;
} while (i<=u && x[i]<t);
do
...
I've a simple but confusing doubt about whether the program below runs in exponential time. The question is : given a +ve integer as input, print it out. The catch is that you deliberately do this in a loop, like this:
int input,output=0;
cin >> input;
while (input--) ++output; // Takes time proportional to the value of input
cout << ...
I recently asked a question about one of the Dijkstra’s algorithms (shunting-yard). But almost everyone thought "Dijkstra's algorithm" meant his shortest path algorithm.
What other algorithms has Dijkstra developed?
...
I am looking for behavior tree implementations in any language, I would like to learn more about how they are implemented and used so can roll my own but I could only find one
Owyl, unfortunately, it does not contain examples of how it is used.
Any one know any other open source ones that I can browse through the code see some examples ...
012@TEST1
524@TEST2
ABC@TEST3
AB@TEST4
53@TEST5
@TEST6
i want to sort the following data such that
Final output:
Sorted on the basis of data before ‘@’
Numbers should come before alpha
@TEST6
012@TEST1
53@TEST5
524@TEST2
AB@TEST4
ABC@TEST3
i want to implement this in java ...help me out
...
here is pseudo code on algorithm to find median of two array
T WO -A RRAY-M EDIAN (X, Y )
n ← length[X] £ n also equals length[Y ]
median ← F IND -M EDIAN (X, Y, n, 1, n)
if median = NOT- FOUND
then median ← F IND -M EDIAN (Y, X, n, 1, n)
return median
F IND -M EDIAN ( A, B, n, low, high)
if low > high
then r...