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.
-1
votes
0answers
21 views
Algorithm that searches for strings in a database
Say you have a database of some big number of .txt files. And say you want to implement a search feature so that if a user types in a word or string of words, it will return all files that contain ...
0
votes
0answers
5 views
Three Dimensional Positioning given the distances from well known fixed stations
I have a mathematical (Algorithm) problem
I need to compute the position of a static object based on the distance to multiple fixed stations (it the same thing we do to calculate the GPS receiver ...
1
vote
1answer
21 views
Overestimate in A*
Suppose that I want to change the logic in A*, trying to find the most useful path (i.e., the one with the highest gain) instead of finding the shortest path (i.e., the one with the lowest cost).
In ...
0
votes
2answers
22 views
bitwise AND doesn't work on MSB
I'm implementing a bit vector by packing bits into an array of uints. The getBit(index) function does a (array[cell] & (1 << bit)) >> bit to get whether a bit has been set or not. This ...
2
votes
4answers
54 views
calculating complexity of sorting
std::sort performs approximately N*log2(N) (where N is distance) comparisons of elements(source - http://www.cplusplus.com/), so its complexity is N*log2(N).
Please, help me to calculate complexity ...
1
vote
2answers
16 views
how to distribute the entries of a matrix in a larger one using matrix products
Given the matrix A, where A is
x_11 x_12 x_13
x_21 x_22 x_23
x_31 x_32 x_33
x_41 x_42 x_43
how can I efficiently create this second matrix using matrix products?
x_11 0 0 x_21 ...
0
votes
0answers
23 views
lookAt not functioning properly with low values
I have a skewed frustum for off-axis projection here and I am trying to simulate a scene's perspective from different positions of user. Imagine it as a box kept at the center of the screen and the ...
0
votes
0answers
38 views
Prediction analysis (Time series model) in UNIX
I know its not a code level question but wanted your views.
I need to perform “Prediction Analysis” in UNIX level using Time series model (like ARIMA).
We have implemented the same using R , but my ...
0
votes
1answer
42 views
Evolutionary Algorithm - Physical Travelling Salesman
I want to solve Physical Travelling Salesman Problem using Evolutionary Algorithm.
The objective of the PTSP is to visit the maximum number of waypoints of the map in the minimum number of time ...
0
votes
5answers
70 views
Sum of last k digits same as sum of first k digits
I want to find if sum of first k digits of few numbers in given range is equal to sum of last k digits. Here the range is very large and k is less than 20.
One way we can do this is by brute force ...
0
votes
2answers
31 views
Detect and extract changing numbers in list of strings
Let's say I have a list of of audio file names (it could be any list of strings with continuing numbers in it) that have different naming schemes but all of them contain the track number in their file ...
0
votes
3answers
48 views
Complex series algorithm
I have a series of numbers A.
There is an index - k, which will be passed as an argument to a program.
The series is an arithmetic progression (d=1) until the k-th element. For example:
A0 = 0, A1 ...
-2
votes
0answers
15 views
Network flow homework [closed]
I'm having trouble with a network flow homework problem.
In addition to being finicky eaters, cows are notoriously lazy. No cow
is willing to move more than two miles to get to its watering ...
0
votes
0answers
32 views
With two point sets A and B, what is an efficient way of finding points in B that are not in A
I have a pointset representing a set of polygons which I pass to a polygon boolop (clipping) algorithm. Once I get the result, I want to know what points the boolop newly created -- these would be due ...
0
votes
2answers
78 views
Maximize multiple buckets sum?
Have 180 balls.
Have 70 buckets.
Each ball's value depend on which bucket it's in:
ball1 = { 1, 14, 2, 3, 4 ... } //70 values in total for each bucket
ball2 = { 24, 2, 23, 2, 5 ... }
...
Each ...
-7
votes
0answers
34 views
MRU Page Replacement Algorithm [closed]
*>Hello, can anyone give the C or C++ code for MRU page replacement algorithm? I couldn't find it anywhere. Please help *
==EDIT==
So no-one is interested to help a newbie? Thanks anyway
-1
votes
1answer
63 views
'for' loops for making groups of combination
I have an array in c++ with unknown entries (minimum 6) i need a for loop (probably includes a few for loop) which makes 3 groups of 2. I don't care about order of groups or in the group. And tricky ...
-2
votes
0answers
35 views
How to solve integer linear programming problems? (Optimization/Train Scheduling)
To be more specific.. I have to schedule 5 trains. I know the length of each train. I know the speed of each train. I know the network topology, The start point and destination point of each train. ...
0
votes
1answer
22 views
K-D tree for ray tracing in a rotating scene
If I want to ray trace a scene using a K-D tree, and this scene happens to rotate every certain time, is it necessary to rebuild the K-D tree for each rotation or something?
1
vote
2answers
40 views
Algorithm for placing nodes in orbit around another
I'm trying to figure out what sort of equation would get me this.
If I have a center node, and an undetermined number of nodes orbiting it, how would I get the canvas coordinates I need to place them ...
0
votes
1answer
35 views
Implementing a binary insertion sort using binary search in Java
I'm having trouble combining these two algorithms together. I've been asked to modify Binary Search to return the index that an element should be inserted into an array. I've been then asked to ...
2
votes
3answers
56 views
Is it worth it to rewrite an if statement to avoid branching?
Recently I realized I have been doing too much branching without caring the negative impact on performance it had, therefore I have made up my mind to attempt to learn all about not branching. And ...
0
votes
0answers
27 views
Transposition table (HashTable) with Alpha-Beta
This Alpha-Beta function works fine without the hash table implemented,but when i try to use it together with the hash table,it sometimes plays the wrong moves in some cases.
(connect 4 game).
I ...
1
vote
1answer
27 views
Lower Bound of finding the median
Assume we're given a list of n numbers and we want to find a number that is greater than or equal to the median. I want to learn the lower bound for the worst case complexity of this problem. I know ...
3
votes
2answers
75 views
SPOJ 370 - Ones and zeros (ONEZERO)
I am trying to solve SPOJ problem "Ones and zeros":
Certain positive integers have their decimal representation consisting only of ones and zeros, and having at least one digit one, e.g. 101. If a ...
2
votes
1answer
87 views
How can I solve this using BIT?
Hi to everyone this is my first question, I found a nice math problem, but I still can't solve it, I tried to find one solution using google and found that it can be solve using the Binary Indexed ...
-1
votes
2answers
40 views
A basic confusion on quicksort
Suppose we choose a pivot as the first element of an array in case of a quicksort. Now the best/worst case complexity is O(n^2) whereas in average case it is O(nlogn). Is not it weird (best case ...
1
vote
1answer
27 views
Find operation in Fibonacci Heap
I have this question when teaching myself Fibonacci Heap, which now I know is an efficient data structure to implement priority queue with amortized O(1) time complexity when decreasing priority of an ...
1
vote
1answer
44 views
Sorted shared Mailbox or Bus for a pool of Akka actors?
I'm trying to learn Scala and Akka at the same time and it's amazing but it is also slightly confusing sometimes, I'm sorry for the fragmentation of my question.
I understand the actor model. There ...
-8
votes
0answers
67 views
Algorithm 3 ArrayLists [closed]
what is the best solution in java for this problem.
I have 3 Arraylist.
List<Records> pendingRecords = new ArrayList<Records>();
List<Records> rejectedRecords = new ...
-2
votes
2answers
74 views
How do I sort a list of strings mixed with integers in C#? [duplicate]
I have the following list:
1
2
3
10
20
30
Dog
Cat
30Dog
30Cat
and I wish to sort it such that I get the following list:
1 2 3 10 20 30 30Cat 30Dog Cat Dog
How can I do this in C#? I basically want ...
0
votes
0answers
52 views
What is the most efficient algorithm to split a shape, which can be rectangular or circular, into n equal area part? [closed]
Efficiency is defined as making the fewest cuts regardless of length for every n slices.
The cuts must be doable without lifting the knife. Only cuts that are either circular, elliptical, or ...
3
votes
2answers
67 views
Speeding up computation of Dice coefficient in C / Rcpp
I need to compute a similarity measure call the Dice coefficient over large matrices (600,000 x 500) of binary vectors in R. For speed I use C / Rcpp. The function runs great but as I am not a ...
0
votes
1answer
38 views
Efficiently find connected subgraphs (not necessarily induced) of a given order
Given a connected undirected vertex-labelled graph, an edge in the graph, and some number n ≥ 2, is there an efficient algorithm to find all the connected (but not necessarily induced) subgraphs of ...
1
vote
1answer
28 views
Time Complexity and Experimental Results
I have two algorithms A and B, that work on Logical Graphs, and I would like to compare their efficiency in term of time.
When I calculated the time complexity for both algorithms I found:
Time ...
-2
votes
2answers
70 views
Enumerate all algebraic numbers
Could you provide me an algorithm (preferably in C-like language), which is capable of enumerating all algebraic numbers? Wikipedia states these numbers are countable (unlike real numbers). I have ...
0
votes
2answers
22 views
Efficient way to determine if a string is a legal XML element name
I have made a straightforward implementation conforming to the W3 specification. Here I simply hold the different sets of legal characters (legal start chars differ from following chars) and use ...
2
votes
3answers
67 views
What is the implication of “A g-sorted array remains g-sorted even after h-sorting it”?
I was reading shell-sorting when I came across the above statement. What does this imply and what difference does it make to the way I look at shell sorting?
PS: I am not looking for the proof of the ...
0
votes
1answer
28 views
Implementing Backward Greedy for Feature Selection
I'm trying to apply feature selection of a dataset with 1700 features and 3300 instances. One of the ways for feature selection is stepwise regression. It is a greedy algorithm that deletes the worst ...
0
votes
1answer
22 views
Assigning jobs to people using Maximum Flow, harder version
I am self studying max flow and there was this problem:
the original problem is
Suppose we have a list of jobs
{J1, J1,..., Jm}
and a list of people that have applied for them
{P1, P2, ...
5
votes
2answers
189 views
Simulating a large battle [closed]
I have to simulate a battle between two players. It can last from one to six rounds. Attacker can have 13 different types of spaceships, defender - additional 9 types of defence structures. The thing ...
0
votes
1answer
24 views
LPM implementation for linux kernel module
I want to implement Longest Prefix Match algorithm in kernel module by using data structures provided by linux kernel (like hlist, prio_tree, radix tree etc).
Which data structure of linux kernel best ...
2
votes
1answer
54 views
Crab Graphs, Algorithms, Graph Theory, How is this network flow?
Can somebody please help me out with this problem? The solution is apparently using network flow but I am not very familiar with network flow. How does network flow help you solve this?
A crab is an ...
-2
votes
3answers
57 views
Sort and list all occurrences in a string array [duplicate]
I'm doing some coding exercise and come across this question on sorting a string array, and list all the occurrences of each unique string in the array. I've been trying to find out if I can do it ...
1
vote
2answers
69 views
How to “cut off the tail” of a series
I have a list of 10 terms with their scores. The first x tend to be much more important than the rest. So I want to find x.
For example, plotting this list shows a plateau after third term. Hence we ...
0
votes
1answer
39 views
2 = theta (1 + 1/n)^n ; why is a constant theta to e? [closed]
This is for my Combinatorial Algorithms class. I kind of have an idea as to why a constant would equal e as but I'm a bit confused when I have the statement that 2 and (1 + 3/n)^n are theta of each ...
1
vote
1answer
29 views
Fox Algorithm with MPI
I am coding an implementation for Fox Algorithm with MPI in C.
I already subdivised my global_matrix into smaller blocks. So each process has a little block of matrix A and matrix B.
However I have ...
-3
votes
0answers
15 views
implementation of Top-nodes algorithm for reservation system [closed]
I cannot find many resources on the top-nodes algorithm and would like to build a simple implementation for a reservation system app with a no sql database. How would the nodes be stored in the ...
0
votes
0answers
115 views
Drawing Binary Trees Recursively
I'm working on my assignment which is to draw a binary tree, for a given input. For example 16 would draw out:
--------x-------
----x-------x---
--x---x---x---x-
-x-x-x-x-x-x-x-x
xxxxxxxxxxxxxxxx
...
2
votes
1answer
69 views
How causal consistency is different to sequential consistency?
I understand that in sequential consistency all processes have to be processed sequentially. For example:
Process 1 Process 2
x = 1 z = 5
y = 2 p = 3
So, we can get x=1, z=5, ...