[algogeeks] string

2010-07-18 Thread Ratnesh Thakur
Given a string A, and a string B, and a dictionary, how would you convert A to B in the minimum no of operations, given that: i) All the intermediate words must be from the dictionary ii) An ‘operation’ is defined as: a) Delete any character from a string ex dog → do b) Insert any character

Re: [algogeeks] Re: graph

2010-07-18 Thread Ratnesh Thakur
@jalaj..he has asked for a linear algo On Sat, Jul 17, 2010 at 12:47 AM, jalaj jaiswal jalaj.jaiswa...@gmail.comwrote: can be done in O(n^2) also below is a rough pseudocode initialize visited[v]=0 for every vertex v{ call dfs(v) check if al visited are 1 or not if all

Re: [algogeeks] Array with 0 and 1

2010-07-08 Thread Ratnesh Thakur
col=0;colncols;col++) if (a[col]||temp!=temp) if (a[col]~0!=0) colcount++; Best Regards Ashish Goel Think positive and find fuel in failure +919985813081 +919966006652 On Wed, Jul 7, 2010 at 9:53 PM, Ratnesh Thakur ratneshthaku...@gmail.comwrote: for(i=0 to n-1

Re: [algogeeks] Array with 0 and 1

2010-07-07 Thread Ratnesh Thakur
for(i=0 to n-1) if( binarysearch(i,n-1,1) + 1) count++ print count. binarysearch(first,last,item) if(1 is there) return mid else return -1. similarly we can go for coloumns. o(nlogn) On 7/5/10, divya jain sweetdivya@gmail.com wrote: i think u need to visit every element atleast

Re: [algogeeks] rotation

2010-07-02 Thread Ratnesh Thakur
i think this should work. for(i=1;i=k;i++) { var=a[n-1] for(j=n-1;j=1;j--) a[i]=a[i-1] a[0]=var } On Fri, Jul 2, 2010 at 5:36 PM, Saurabh Ahuja nsit.saur...@gmail.comwrote: a[0] = a[2] a[1] = a[3] a[2] = a[4] a[0] and a[1] has been changed a[3] = a[0] a[4] = a[1] so this solution

Re: [algogeeks] palindrome substring

2010-06-18 Thread Ratnesh Thakur
check this http://www.akalin.cx/2007/11/28/finding-the-longest-palindromic-substring-in-linear-time/ On Fri, Jun 18, 2010 at 3:36 PM, Manzoor Ahmed manzoo...@gmail.com wrote: What do you mean by origin string? On Fri, Jun 18, 2010 at 2:38 PM, Chunyuan Ge hhy...@gmail.com wrote: Origin

[algogeeks] doubly linked list

2010-06-15 Thread Ratnesh Thakur
how to implement doubly linked list using only one pointer ? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to