Re: [algogeeks] Re: Questions

2012-01-02 Thread gaurav arora
we can use Boyer's Moore algo int isSubset(int*mat,int p,int q,int*arr,int n) { int h; h=hash(arr,n); for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.

Re: [algogeeks] Re: Questions

2011-12-05 Thread payal gupta
ya hashing cud be a bttr soln bt wat cud be hash fn den??? Regards, PAYAL GUPTA. On 11/30/11, Ankuj Gupta wrote: > We can do it by hashing. hash the 2-d array and then search for 1 d array > in the hash table. > > -- > You received this message because you are subscribed to the Google Groups > "

Re: [algogeeks] Re: Questions

2011-11-30 Thread Ankuj Gupta
We can do it by hashing. hash the 2-d array and then search for 1 d array in the hash table. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/7PE1mqG4RRgJ.

Re: [algogeeks] Re: Questions

2011-11-10 Thread UTKARSH SRIVASTAV
can we apply lcs on 2-d array and 1-d array correct me ig i am right complexity is high too On Tue, Nov 8, 2011 at 4:21 AM, vikas wrote: > probably you are mistaken about the complexity calculations, > the above algo will search for the first element in the 2D matrix, > and if you look

[algogeeks] Re: Questions

2011-11-07 Thread vikas
probably you are mistaken about the complexity calculations, the above algo will search for the first element in the 2D matrix, and if you look carefully , at max n-1 match for each unsuccessful 1D combination is done hence complexity goes to n(n-1) or O(n^2) at max with space complexity O(n). BTW,

Re: [algogeeks] Re: Questions

2011-11-03 Thread surender sanke
@vikas ur algo will search for 1st element of 1d in whole 2d array, on worst case u'll search it in n^2, then search for all 1d elements in 2d in O(n) so whole complexity goes to O(n^2 +n) it can be reduced if we use hashing of 1d array, and count_found and while searching for 1st element of 1d i

[algogeeks] Re: Questions

2011-11-01 Thread vikas
ok, so do it like this; 1. create boolean array boolean temp[][] = new boolean[row][column]; init(temp, true); 2. traverse the array for the 1d array of 0th index and then a recursive search if search fails, or position already contains false, return and search again boolean search(in

Re: [algogeeks] Re: Questions

2011-11-01 Thread SAMM
For example :- 2d array :: 1 2 3 456 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 we hav 1d array as :-- 13 2 21 10 23 12 So the 1d array is a subset of 2d array ... On 11/1/11, vikas wrote: > what do you mean by subset of 1D present in the 2D array? is it > something li

[algogeeks] Re: Questions

2011-11-01 Thread vikas
what do you mean by subset of 1D present in the 2D array? is it something like 3245 , the search may be 3245/ 24/ 45/ all 16 subsets need to be searched? On Oct 28, 12:02 pm, SAMMM wrote: > How do u plan to implement it ??? -- You received this message because you are subscribed to the Goo

[algogeeks] Re: Questions

2011-10-28 Thread SAMMM
How do u plan to implement it ??? -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more

Re: [algogeeks] Re: Questions

2011-10-27 Thread Dheeraj Sharma
cant we use knuth morris algorithm..to find pattern..in a row? On Thu, Oct 27, 2011 at 10:28 PM, Anup Ghatage wrote: > I guess this is just like finding a word in a matrix > > > On Thu, Oct 27, 2011 at 7:32 PM, SAMMM wrote: > >> Forgot to mention this was asked in Amazon Interview .. >> >> -- >

Re: [algogeeks] Re: Questions

2011-10-27 Thread Anup Ghatage
I guess this is just like finding a word in a matrix On Thu, Oct 27, 2011 at 7:32 PM, SAMMM wrote: > Forgot to mention this was asked in Amazon Interview .. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send

[algogeeks] Re: Questions

2011-10-27 Thread SAMMM
Forgot to mention this was asked in Amazon Interview .. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@goog

Re: [algogeeks] Re: Questions on Graphs

2011-09-22 Thread Ankur Garg
Thanks Don :) On Fri, Sep 23, 2011 at 2:51 AM, Don wrote: > Given an undirected graph in which each edge has a capacity, find the > maximum capacity from node A to node B. > > Given a directed graph where each edge has a cost, find the lowest > cost path from node A to node B. > > Find the minim

[algogeeks] Re: Questions on Graphs

2011-09-22 Thread Don
Given an undirected graph in which each edge has a capacity, find the maximum capacity from node A to node B. Given a directed graph where each edge has a cost, find the lowest cost path from node A to node B. Find the minimal spanning tree of a weighted, connected graph. On Sep 22, 2:03 pm, Ank

[algogeeks] Re: Questions -->

2011-09-11 Thread vikas
regarding detection of mouth: detect the face and then,try finding the mouth pattern, validate that it is mouth indeed for validation check for eyes, nose at some rational distance .. | --- On Sep 11, 1:11 pm, Anup Ghatage wrote: > ^ Thats correct, apart from which, th

Re: [algogeeks] Re: Questions -->

2011-09-11 Thread Anup Ghatage
^ Thats correct, apart from which, the flood fill uses a technique to approximate the nearest pixel colors in RGB and fills the neighbouring pixels of the nearest approximation, think of it like the paint bucket tool you use in ma paint. On Sun, Sep 11, 2011 at 10:58 AM, deepikaanand wrote: > see

[algogeeks] Re: Questions -->

2011-09-10 Thread deepikaanand
seed fill or flood fill is a technique to fill polygon of arbitrary boundaries ..by selecting a point or a seed in the polygon and recursively calling the function to fill the polygon -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to

Re: [algogeeks] Re: questions related to C

2011-07-12 Thread Neeraj Gupta
http://www.cplusplus.com/reference/algorithm/swap/ On Wed, Jul 13, 2011 at 10:40 AM, Aniket Dutta wrote: > what about a generic swap function which works for structures also? > > > On Wed, Jul 13, 2011 at 2:23 AM, Don wrote: > >> To check for overflow, use condition: >> >> if (b > (maxuint-a)) >

Re: [algogeeks] Re: questions related to C

2011-07-12 Thread Sandeep Jain
Try it. It should work fine. Regards, Sandeep Jain On Wed, Jul 13, 2011 at 10:40 AM, Aniket Dutta wrote: > what about a generic swap function which works for structures also? > > > On Wed, Jul 13, 2011 at 2:23 AM, Don wrote: > >> To check for overflow, use condition: >> >> if (b > (maxuint-a

Re: [algogeeks] Re: questions related to C

2011-07-12 Thread Aniket Dutta
what about a generic swap function which works for structures also? On Wed, Jul 13, 2011 at 2:23 AM, Don wrote: > To check for overflow, use condition: > > if (b > (maxuint-a)) > return error; > > Where maxuint is the largest value which can be stored in an unsigned > integer. > > Don > > On Ju

[algogeeks] Re: questions related to C

2011-07-12 Thread Don
To check for overflow, use condition: if (b > (maxuint-a)) return error; Where maxuint is the largest value which can be stored in an unsigned integer. Don On Jul 8, 5:50 am, vikas wrote: > Q1 - write a generic macro to swap two values (int,float,double,pointers as > well ) > > Q2 - Implemen

Re: [algogeeks] Re: questions related to C

2011-07-12 Thread hary rathor
#define SWAP(f,type) f(type x, type y)\ {\ type z; z=x, x=y,y=z; \ } swap(M_INT, int) swap(M_FLT,float) swap(m_double,double) int main() { int p =5,q=4; float r=5.4,s=6.9; double v=6.5,w=6.9; swap(p,q); swap(r,s); swap(v,w); } -- You received this message because you are subscribed to the Go

[algogeeks] Re: questions related to C

2011-07-12 Thread Dave
@Tendura: This violates the sequence point rule. Results are undefined. Dave On Jul 12, 2:02 pm, tendua <6fae1ce6347...@gmail.com> wrote: > regarding question to the generic macro to swap int, float, double > > # define swap(a,b) ((a)^=(b)^=(a)^=(b)) > > On Jul 12, 10:08 pm, Aniket Dutta wrote:

[algogeeks] Re: questions related to C

2011-07-12 Thread tendua
regarding question to the generic macro to swap int, float, double # define swap(a,b) ((a)^=(b)^=(a)^=(b)) On Jul 12, 10:08 pm, Aniket Dutta wrote: > c=a+b > then find b=c-a; > if this b equals previous one then ok else overflow > > On 7/9/11, John Hayes wrote: > > > regarding question relate

[algogeeks] Re: Questions on Hashing

2008-06-01 Thread Vinodh
Hi Guys, Please give some insights on these. Thanks. Vinodh On May 29, 4:31 pm, Vinodh <[EMAIL PROTECTED]> wrote: > Hi, > For some time now I started studying Algos and Data Structures. I got > these question when I was going through Hashing. Please help me > answering them. Some questions are