An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to algorithm design.
0
votes
3answers
24 views
how to print for loop results in a upper triangular matrix in R
The script in R as follow.
for (i in 1:(ncol(K)-1)) #ncol=7,K is dataset
for (j in i:ncol(K)){
print(mi.empirical(rbind(K[, i],K[,j])))
}
output is given as
[1] 0
[1] 0.1412579
...
0
votes
0answers
29 views
Finding a mapping which was applied to values
I have mapping A which maps some objects to one or more ordered pairs of integers (a, b). Each pair appears only once in the mapping.
Some bijective mapping F was applied to the integers used in those ...
-6
votes
0answers
30 views
distributed incremental algorithm [on hold]
I need an incremental algorithm in my project. But a process cannot meet my target because of the high concurrency.
I known that Twitter has an algorithm that is distributed incremental, but I can't ...
0
votes
2answers
61 views
Bucket vs Radix sort
I read this comment from another post - and thought to open a separate question:
Bucket sort is more efficient for 'Dense' arrays, while Radix Sort can handle sparse (well, not exactly sparse, but ...
-1
votes
0answers
11 views
Is there any tool to detect encryption algorithm of raw/encrypted series?
I'm search Google for cryptanalysis and relevant crypt tools but nothing can analyze couple of raw and encrypted raw.
How can I detect encryption algorithm from these raw/encrypted series?
...
-2
votes
0answers
50 views
How to find the maximum sum of two non-neighbors in array [on hold]
How can I quickly find the maximum sum of two non-neighbors in array? For example if the array is {1,-6,50,4,100,90}, the result should be 150 because 190 would require a sum of neighbors in the ...
3
votes
2answers
63 views
Find a sorted subsequence of size 4 in an array in linear time
We are given an array of numbers and we want to find a subsequence of size 4 that is sorted in increasing order.
for eg ARRAY : -4 2 8 3 1 5
sorted subsequence of size 4 : -4 2 3 5
...
0
votes
3answers
80 views
Testing a vector without scanning it [on hold]
For a series of algorithms I'm implementing I need to simulate things like sets of coins being weighed or pooled blood samples. I'm currently implementing this as a binary vector. By a vector I mean ...
0
votes
3answers
71 views
Fill matrix with binary numbers, regular and gray coded
I have a matrix that holds 1:s or 0:s, creating binary numbers. Its width is n. For n = 2 and n = 3 it would look like:
00 000
01 001
10 010
11 011
100
101
110
111
and so on. ...
3
votes
7answers
106 views
How to get the target number with +3 or *5 operations without recursion?
This is an interview problem I came across yesterday, I can think of a recursive solution but I wanna know if there's a non-recursive solution.
Given a number N, starting with number 1, you can only ...
1
vote
2answers
26 views
Storing Rectangles/Circles/Triangles in a KD-Tree
I was looking at Kd-tree and found some implementations of this algorithm. All of these were storing points (2d in major of cases). What I am trying to achieve is to store different shapes in it like ...
0
votes
2answers
45 views
How to print the calculated process of a game like 24point?
Here's the problem:
Given 4 numbers, I need to give a calculated process which results 24. All the operations I can use are addition, subtraction, multiplication, division. How to print the calculated ...
-5
votes
0answers
31 views
A probability calculation relating to quick sort [on hold]
This is a question from 《introduction to algorithms》numbered 7.4-6. It is described as below:
Consider modifying the PARTITION procedure by randomly picking three elements from array A and ...
-1
votes
0answers
23 views
Algorithm to find target sum of elements of chronologically indexed array
I am trying to develop an algorithm to find the optimal subset that will match the given target sum with the most utility of the earliest element from an chronologically indexed array of elements.
...
0
votes
1answer
60 views
Algorithm for best combination possible given some interesting constraints
I am looking for a way to compute the best possible combinations of selections so that the scores add up to the highest possible amount given:
There are just as many teams as there are rounds
The ...