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.
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
> "
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.
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
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,
@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
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
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
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
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
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 ..
>>
>> --
>
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
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
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
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
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
^ 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
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
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))
>
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
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
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
#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
@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:
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
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
26 matches
Mail list logo