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.

learn more… | top users | synonyms (2)

0
votes
1answer
22 views

Given a 2D matrix of characters we have to check whether the given word exist in it or not

Given a 2D matrix of characters we have to check whether the given word exist in it or not. eg s f t d a h r y o we can find "rat in it (top down , straight ,diagonal or anypath).. even in ...
0
votes
0answers
8 views

DBSCAN algorithm (recursion logic)

DBSCAN(D, eps, MinPts) C = 0 for each unvisited point P in dataset D mark P as visited NeighborPts = regionQuery(P, eps) if sizeof(NeighborPts) < MinPts mark P as ...
1
vote
2answers
36 views

ratio of running times when N doubled in big O notation

I learned that,using Big O notation O(f(n)) + O(g(n)) -> O(max(f(n),g(n)) O( f(n) )* O( g(n)) -> O( f(n) g(n)) but now, I have this equation for running time T for input size N T(N) = ...
5
votes
4answers
55 views

Obtaining the minimum number of tails of coin after flipping the entire row or column multiple times

First, I'm not good at English so the subject of this question is awkward... What I'm trying to solve is this: NxN coins are placed on the grid. And we can flip the entire row or column. We can flip ...
15
votes
1answer
105 views

finding smallest k elements in array in O(k)

This is an interesting question I have found on the web. Given an array containing n numbers (with no information about them), we should pre-process the array in linear time so that we can return the ...
-6
votes
3answers
67 views

O(3^n) exponential time complexity

public void run(int n) { System.out.println(power(3, n)); } public int power(int c, int n) { int result = 1; for (int i = 0; i < c; i++) { result *= n; } ...
-1
votes
2answers
57 views

Why simplex algorithm works for solving Linear Programming

We know that simplex is a very famous algorithm used to solve linear programming probleams, and I know how to use it, but what confused me is that why simplex always assumes that one of the vertices ...
2
votes
2answers
32 views

What does it mean when we say the time complexity is O(M+N)?

Is it the same as saying O(max(M,N))? I am learning time complexity and this type of complexity comes up time and again with graphs.I don't fully understand what they mean by O(M+N), where ...
3
votes
1answer
46 views

Computing percentiles

I'm writing a program that's going to generate a bunch of data. I'd like to find various percentiles over that data. The obvious way to do this is to store the data in some kind of sorted container. ...
0
votes
0answers
19 views

Number of permutation cycles in matrix transposition

I am trying to solve a problem on Sphere Online Judge (SPOJ) link to which is: http://www.spoj.com/problems/TRANSP/ The matrix can be thought of as a Permutation and it's transposition as another ...
-1
votes
2answers
21 views

Analizing a string before Burrows-Wheeler transform?

If we consider this aaabccba as our input string, baaacacb would be the output string after applying Burrows-Wheeler transform on the input. observing the output you'll see that the two clumped c are ...
-4
votes
1answer
45 views

Python: How to check for a regular languages [closed]

Whenever I am trying to solve a math (algorithm) problem. I have to generate or check for a regular language. Generation is easy thanks to Modulus Function but facing a difficulty in checking a ...
0
votes
2answers
36 views

How to find the closest element to a given binary key value using binary search algorithm?

I have a sorted list of binary vectors, let's call it L, and I have a binary vector q, how can I find the vectors in L that are closest to q using binary search?
-4
votes
0answers
23 views

Easy: Solve … by Iteration Method [closed]

Use iteration method to solve: a)T(n) = T(n-1) +(1/n), (T(0)=1) b)T(n) = 3T(n/3) +1, (T(3)=1)
0
votes
0answers
26 views

Two algorithms to find nearest neighbor with Locality-sensitive hashing, which one?

Currently I'm studying how to find a nearest neighbor using Locality-sensitive hashing. However while I'm reading papers and searching the web I found two algorithms for doing this: 1- Use L number ...

1 2 3 4 5 2053
15 30 50 per page