algorithm

Finding Maximal Bicliques

I have a problem that I was able to model as finding maximal bicliques (complete bipartite graphs) in a bipartite graph. I am aware of the Bron–Kerbosch algorithm for detecting maximal cliques, and it seems to me that there should be a way to express a biclique problem as a clique one. Does anyone have a solution, either for forming a bi...

C++ Function Calling Itself

Question I wish to know if this is a viable way to implement variable depth recursion so that I can run a function at each step and any better/other solutions to the description problem. Description Suppose I wish to have a function that fills an array either in pattern x,y,x,y,x,ywhere x and y are variables defined by some algorithm and...

what are the recent dataStructure and algorithms that one should know?

Recently I came across the SkipList data structure. It really helped me to solve one otherwise critical problem to be solved. I was struggling to solve the same problem with Balanced Binary tree but it became very complex as the tree needs to be always balanced and I wanted to know the existence of not only a particular value but values ...

it means quick-select algorithm?

Hi, I have a question from my homework. I think my teacher needs an algorithm like quick select for this question, is this correct? The question: Following a program (Subroutine) as a "black box" is given (for example, inside it is not clear and we do not even inside it) with the worst case linear time, can find the middle ...

each group in quick Select algorithm should be sort?

hi i have a question that my teacher in his lecture for quick select algorithm he says that after we Considering the array as groups of 5 elements;it doesn't need to sort each group,is he correct? because when we have a group like <3,5,7,6,1> without sorting how can we find the median??? thanks EDITED: it is not about quick select it...

Bitwise and in place of modulus operator

We know that for example modulo of power of two can be expressed like this: x % 2 inpower n == x & (2 inpower n - 1). Examples: x % 2 == x & 1 x % 4 == x & 3 x % 8 == x & 7 What about general nonpower of two numbers? Let's say: x % 7==? ...

Adding waypoints to A* graph search

I have the ability to calculate the best route between a start and end point using A*. Right now, I am including waypoints between my start and end points by applying A* to the pairs in all permutations of my points. Example: I want to get from point 1 to point 4. Additionally, I want to pass through points 2 and 3. I calculate the pe...

Algorithm - find the smallest subset of cells representing all the rows

I have several lists, that you can consider as rows of integers. For example : [1 3 5] [3 7] [3 5 7] [1 5 9] [3 9] [1 7] [5 9 11] I wish to find the smallest possible set of integers represented on these rows, so that : each row has at least one of the selected integers, in case of cardinality ties, select the set having the highest...

Find out how much percent one string contains in another

I need to find out how much percentage or chars does one string contains into another string. I've tried Levenshtein Distance but that algorithm returns how much char's are needed to be change for the strings to be equal. Can some one help? I need it in c# but that's not so important. The answer code: public double LongestCommonSubs...

Generating Balls in Boxes

Given two sorted vectors a and b, find all vectors which are sums of a and some permutation of b, and which are unique once sorted. You can create one of the sought vectors in the following way: Take vector a and a permutation of vector b. Sum them together so c[i]=a[i]+b[i]. Sort c. I'm interested in finding the set of b-permutatio...

Finding a stable placement of an irregular (non-convex) shape

Given an image of a 2-dimensional irregular (non-convex) shape, how would I able to compute all the ways in which it could lie stable on a flat surface? For example, if the shape is a perfect square rectangle, then it will surely have 4 ways in which it is stable. A circle on the other hand either has no stable orientation or every point...

area of intersection of two triangles, or a set of halfplanes, or area of a convex point set

I need to compute the area of the region of overlap between two triangles in the 2D plane. Oddly, I have written up code for the triangle-circle problem, and that works quite well and robustly, but I have trouble with the triangle-triangle problem. I already first check to see if one entirely contains the other, or if the other contains...

recur by using the pivot in Select algorithm

Hi I have a problem and I can not get the purpose of lines (14,15,16,17) of this site for Select algorithm please help me thanks the site which I have this question from it : http://webcache.googleusercontent.com/search?q=cache:2PhiYQ1r76kJ:www.cse.yorku.ca/~andy/courses/3101/lecture-notes/LN4.ps+Linear+general+selection+algorithm+code&...

binary sort algorithmI

hi do we have binary sort algorithm ? like merge sort or the other kinds of sorts do we have binary sort?? is there any kind of sorts that its name is binary sort? thanks ...

writing an algorithm with Θ(nlogn)

I have written this code for myself(it is not a home work) I want to know is this correct?thanks Algorithm with time Θ (nlogn), which can provide an array of n members to determine whether two elements in the array that are equal to x and then return those elements Algorithm Sum(arr,1,n): MergeSort(arr) For i<-- 1 to n m<-- BinaryS...

problem with quicksort

Possible Duplicate: what is mistake in this code i have following code from algorithm in c++ public class improved_quicksort { public static final int m=10; public static int partition(int a[],int l,int r){ int i=l-1; int j=r; int v=a[r]; while (true){ while(a[++i]<v); ...

binary insertion sort algorithm

i have tried to implement binary insertion sort algorithm from here http://www.brpreiss.com/books/opus5/html/page487.html here is code public class binary_insertion { public static void sort(int a[],int n){ for (int i=0;i<n;++i ){ int temp=a[i]; int left=0; int right=i; while (left<right){ ...

algorithms on strings

i have one question suppose there is given two String String s1=" MARTHA "; String s2=" MARHTA": here we echange position of T and H i am interested to write code which count how many change is necessary to transform from one String to another String ...

about counting sort algorithm

Hi I have read a counting sort algorithm which is like this: Counting Sort(A[1,..n]) //C[1,...k] is the temporary memory and k is the range of integers for i<-- 1 to k C[i]<-- 0 for j<-- 1 to n C[A[j]]<--C[A[j]]+1 for i<--2 to k C[i]<--C[i]+C[i-1] for j<--n downto 1 B[C[A[j]]]<--A[j] C[A[j]]...

Top Hashing and Encryption Algorithms?

I know many web projects still use the older MD5() or SHA1() when creating hashes. However, in my projects I have been using SHA256 for stronger/longer hashes since when I last checked the there was some question about which hashes were the bester ones to use. So I just chose the government standard (at the time). However, I'm wondering...