Tagged Questions
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
0answers
2 views
haar cascade positive example image sizing
Im taking my first steps in making a haar cascade for custom object recognition. Ive spent time getting a fair bit of data and wrote some preprocessing scripts to convert videos to frames. My next ...
-2
votes
1answer
23 views
specific Knapsack Algorithm [duplicate]
I have problem with solve the specific knapsack algorithm problem. Is there someone who give me some tips or help me? I solved it by Brute Force method but the execute time is very long (I checked all ...
0
votes
0answers
15 views
How to calculate x kilometers from a lat/lon
I have a lat/lon and I'd like to calculate X kilometers North South East and West from that location. How would I go about doing that?
I read that "The number of kilometers per degree of longitude is ...
0
votes
1answer
13 views
How is IBM Watson Tradeoff Analytics any different from simple constrained decision making?
I am continuously astounded by the technological genius of the IBM Watson package. The tools do things from recognizing the subjects in images to extracting the emotion in a letter, and they're ...
0
votes
0answers
8 views
Calculating winding number for polygons inside a complex polygon
I am trying to implement an algorithm to offset complex polygons following this paper, however I am stuck when trying to compute the winding number for the different sub-polygons of the polygon. (See ...
1
vote
0answers
7 views
Find Graph Laplacian Matrix Kth smallest eigenpair
I am trying to implement Spectral Graph partitioning, but I am stuck on how to do it. The basic idea is to find the second smallest eigenvalue and its vector (fiedler vector), if you want to bisect ...
-1
votes
0answers
18 views
Unbalanced Binary Search Tree
By my understanding when completing a binary search you start with the middle value and complete a divide and conquer algorithm upon it until you find the correct value.
However when I have looked at ...
-1
votes
0answers
4 views
What algorithm(s) are available for arbitrary shape and symbol matching?
I would like to create and customize an algorithm for recognizing hand-drawn shapes and patterns on a touchscreen device. Initially the goal is to recognize basic shapes (like lines, circles, squares) ...
0
votes
1answer
8 views
Creating sequential fixed size base 36 ids
I want to create a function which will give me fixed size 6 char alpha-numeric IDs with the requirement that the first and last character must be an alpha.
I want them to be generated sequentially. I ...
-3
votes
0answers
24 views
Find all vector<int> permutations (in base X) which are divisble by X
What I want to do is to find all possible permutations of integers from a vector (as fast as possible) in base X that are divisible by X
For example, a vector {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} can give ...
0
votes
2answers
15 views
Designing an algorithm that searches for the kth largest element between two AVL trees
This was a challenge question given in lecture last week and I've been mulling over it since. We were asked to create an algorithm that searches between two AVL trees for the kth largest element. Each ...
3
votes
1answer
57 views
Optimizing the number of calls to expensive function
I have an mainFun that takes four parameters x, a, b, and c, all vector-valued and possibly of varying length. This function calls expensiveFun that is computationally expensive so I'd like to reduce ...
-1
votes
0answers
35 views
What algorithm has the worst run time? [on hold]
Out of all the different algorithms in the world, what is the one that has the worst run time? Like say its worst case run time is 2^n and theres nothing else that can be done for it.
4
votes
2answers
59 views
Reverse Integer number without duplicate digit in java
My objective is to reverse integer number without duplicate digit in Java
How do I improve the complexity of code or is there a good/standard algorithm present?
Incase of duplicate digit, it should ...
0
votes
0answers
11 views
How to Implement distance-weighted kNN algorithm to matlab with specific dataset
I wrote a basic matlab code to Implement distance-weighted kNN algorithm in matlab and apply it to specific dataset. I need to give different k values to see results. however, I can't see any ...
0
votes
0answers
14 views
Searching tree for subtrees with a specific amount of elements
It's the continuation of the exercise: http://cs.stackexchange.com/questions/65384/tree-elements-influence-on-another-elements-searching-for-specific-elements
I need to say how many elements do I ...
0
votes
1answer
24 views
Finding minimum indepedent dominating set using a greedy algorithm
I developed an algorithm that finds the minimum independent dominating set of a graph based on a distance constraint. (I used Python and NetworkX to generate graphs and get the pairs)
The algorithm ...
-2
votes
0answers
18 views
Algorithmic puzzle about triplets
There are two sets X and Y of triplets (a, b, c).
For each triplet T_i in X, Find the number of triplets T_j in Y, such that:
b_i<=a_j<=c_i.
b_j<=a_i<=c_j.
0
votes
0answers
13 views
Algorithm- How to place n-texts on p-bands so that the global accesing time is minimum. Each text has its' own length
The problem sounds like this, we are given n-texts and they are going to be placed on a p number of tapes/bands(don't really know what's the equivalent in english, but I think you understand what I'm ...
0
votes
0answers
50 views
C - Disable possibilities user already used
I couldn't find this anywhere...
I am making a project at my university - very simple. I have some questions/possibilities user can make... after using it, I want to disable it and never show so user ...
0
votes
0answers
35 views
Selecting k non overlapping sets from given n sets
Suppose you are given n sets of form [l, l + 1, l+2, ..... , r-1, r], i.e you have two arrays l[] and r[] where l[i] corrsponds to leftmost element of ith set r[i] corresponds to rightmost element of ...
0
votes
1answer
12 views
SVM- SMO algorithm implementation on C++ or MATLAB
Can somebody help me to find the error of not having the following code converge on MATLAB? Please note that k means kernel and has its own function.
I tried to implement it using the algorithm in ...
0
votes
0answers
31 views
Adding value from parent node
I am trying to implement the A* Algorithm to find the shortest path from A to B. I am using a linked list with nodes to find the best path.
One of the values I need to calculate is g, which is the ...
3
votes
2answers
45 views
How to calculate running mean traffic for last minute
I have a python server that accepts time series data. Now I need to calculate the average traffic for the last minute, output like 90 samples/minute. I'm currently using a python list to hold all time ...
1
vote
1answer
32 views
Modified Dijkstra's Algorithm
We are given a directed graph with edge weights W lying between 0 and 1. Cost of a path from source to target node is the product of the weights of edges lying on the path from source to target node. ...
-3
votes
4answers
71 views
find greatest and smallest number in n
so I am confused to the meaning of the code. Why is greatestnumber = smallestnumber = n ? And what is this comparison ? if(greatestNumber < i If for example I enter 3 numbers: 10,8,2 the output is
...
0
votes
3answers
61 views
Can somebody explains what happens in this algorithm to check if its a pandigital?
I know that the << operand shifts the left value of the operand with the value on the right with bits. So 1 << 2 would give 4. And the | operand copies a bit if it exists in either value. ...
0
votes
0answers
29 views
Algorithm for building trees of white and black nodes
I am given two lists of nodes, one that contains white nodes and one that contains black nodes. Each list has at least one node. These nodes should create a series of trees, where each node in a ...
0
votes
0answers
23 views
how to write the test part of the naive bayesian algorithm
I want to classify sentences with Naive Bayesian algorithm. for that I divided my data to "train: https://www.dropbox.com/s/o7wtvrvkiir80la/F.txt?dl=0" and "test: https://www.dropbox.com/s/...
0
votes
0answers
10 views
How do I determine k when using k-means clustering? And what's the evaluation criteria of different k?
I know there is some methods such as: The Elbow Method.
But I don't understand how can you determine which k is better since it's unsupervised learning? What's the evaluation criteria?
1
vote
4answers
100 views
Split vector to unique and duplicates c++
My goal is to split a vector into two parts: with unique values and with duplicates.
For example I have sorted vector myVec=(1,1,3,4,4,7,7,8,9,9) which should be split into myVecDuplicates=(1,7,4,9) ...
0
votes
1answer
32 views
How to preserve variable length
I'm interested in applying genetic algorithm using DEAP in Python. An example implementation for knapasack can be seen here. I'm trying to create my own crossover function, and I want to preserve the ...
2
votes
1answer
44 views
Google foobar gearing_up_for_destruction
I was doing the google foobar challenge but ran out of time on the following challenge i am trying to see what i did wrong.
Challenge
As Commander Lambda's personal assistant, you've been ...
-4
votes
1answer
17 views
Merging multiple sorted lists efficiently [on hold]
Suppose there are ⌈logn⌉ sorted lists of ⌊n/logn⌋ elements each. What's the time complexity of producing a sorted list of all these elements? Should I use a heap data structure?
0
votes
0answers
21 views
Find the best set among the many sets based on it's item's cost
I have items in sets as a below example. Each item contains particular cost.
I have a max budget. I need to do combination in such a way that in each combination I need at least one item from each set ...
-4
votes
0answers
35 views
Could not understand the mathematical notations, functions and formulas while reading the data structures and algorithms [on hold]
While reading "Data Structures and Algorithms Made Easy in Java", I am facing difficulty in understanding the mathematical notations, functions and formulas used in examples. Like you can see in the ...
-1
votes
0answers
16 views
R code of EM clustering algorithm for discrete data [on hold]
I am a R user. I am trying to use EM for clustering discrete variables. The only implementation that I have found is in Weka; and it is not clear how it works for discrete data. I also have found the ...
-4
votes
3answers
49 views
What are the ways to sort strings like “2001V001.10”? [on hold]
What are the ways to sort the below data in any order (ascending/descending) in java -
Input -
2002V001.10
2003V001.10
2004V001.20
2001V002.10
2004V001.10
2001V001.10
Where string before . is ...
-1
votes
2answers
48 views
How to solve the recurrence A(n) = A(n-1) + n*log(n)?
Given the recurrence:
A(n) = A(n-1) + n*log(n).
How do I find the time complexity of A(n)?
0
votes
0answers
38 views
Barnes-Hut tree creating
I am currently trying to create a Barnes-Hut octree, however, I still not fully understand how to do this properly. I have read threads here, this article and some others. I believe I do understand ...
0
votes
0answers
12 views
Genetic Algorithm - Crossover
I'm following the genetic algorithm approach to solving the Knapsack problem as seen here. I understand that they used a direct value encoding scheme rather than a binary representation. The crossover ...
-2
votes
1answer
47 views
Efficient algorithm to count the numbers in range [L,R] that are divisible by at least one prime number in range [1,N]
Given N, L and R, I have to find the count of numbers in range [L,R] that are divisible by at least one prime number in range [1,N].
Constraints:
1<=N<=50
1<=L,R<=10^18
Example:
N=5
L=...
1
vote
2answers
45 views
How do I permute a set of points with restrictions?
I am trying to permute a set of points in java with the restriction that all points in an odd position n cannot appear before the point in position (n-1) i.e ,given 2 point 1 and 2 ,2 cannot appear ...
1
vote
1answer
23 views
Relationship between Rabin-Karp Algorithm and Deduplication
Many deduplication libraries or applications applies Rabin Karp rolling hash algorithm for fast hashing to cut a chunk from the file binary.
My question is, why would Rabin Karp algorithm often used ...
0
votes
0answers
31 views
C++ opencv : rotating image by an arbitrary number (degree)
From my previous post,
OpenCV : algorithm for simple image rotation and reduction
I still could not rotate my image by an arbitrary number but only 90 degree.
I have changed my code since then, right ...
1
vote
1answer
25 views
Dynamic Programming - “maximize” matrix chain multiplication
I'm now practice dynamic programming by myself. For the classic problem "matrix-chain multiplication" is to find the minimize number of scalar multiplication. Which is,
M[i,j] = 0 if i=j
= Min(...
0
votes
1answer
48 views
Finding the pair of strings with most number of identical letters in an array
Suppose I have an array of strings of different lengths.
It can be assumed that the strings have no repeating characters.
Using a brute-force algorithm, I can find the pair of strings that have the ...
-1
votes
0answers
26 views
How to 3-way merge two objects?
Is there a general well-known algorithm for performing 3-way merge of objects or structured data?
I have an object depicting template. Template can be updated by user. History of changes is (...
0
votes
2answers
58 views
How to solve Pascal triangle loop fails issue? [duplicate]
i'm facing an error on my pascal triangle, but i don't know whether
it's java or my code which is the problem. here is the code:
import java.util.Scanner;
public class sdz {
public static void ...
-1
votes
1answer
25 views
Select operator in database
Given a dataset D_{26xn} with columns named from [a-z] (no of columns is just an example) and n observations. Each column (x) has (r_x) unique states. Rows in D are sorted with descending priority on ...