[algogeeks] Intersection of arrays

2011-10-25 Thread kumar raja
Find intersection of K unsorted array of N elements each. Intersection consists of elements that appear in all the K arrays. what data structure is useful here?? -- Regards Kumar Raja M.Tech(SIT) IIT Kharagpur, 10it60...@iitkgp.ac.in -- You received this message because you are subscribed to

Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread Bittu Sarkar
@Saurabh There is no biggest number in an infinite array [?] On 25 October 2011 09:07, saurabh singh saurab...@gmail.com wrote: suppose the element doesn't lies in the array and is bigger than the biggest number:D everything will fail... On Mon, Oct 24, 2011 at 9:43 PM,

Re: [algogeeks] adobe question help

2011-10-25 Thread Bittu Sarkar
N = (N | ((1(j-i+1)-1)i) (Mi); On 12 October 2011 01:22, prasad jondhale jondhale.pra...@gmail.com wrote: grt -- 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

Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread saurabh singh
Really? the array is infinite length.. what if the sequence is 1,1,1,1,1,1,1,1...infinity? We need to know the max in order the algorithm is terminating.. On Tue, Oct 25, 2011 at 11:32 AM, Bittu Sarkar bittu...@gmail.com wrote: @Saurabh There is

Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread Bittu Sarkar
@Saurabh I think you did not get the question clearly. It's a theoretical question because in practice you cannot have an infinite length array of non-decreasing numbers anyways. Yes the sequence 1,1,1,... is infinite and the algorithm cannot just know all by itself what the largest number is,

Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread rahul sharma
yeah...first search in 2^0 and 2^1if elemtn range is between this thern search in this length with Binary search else searchin 2^1 and 1^2 and apply same procedure until element range is found and if element is not found in range then it means element not found On Tue, Oct 25, 2011 at

Re: [algogeeks] Intersection of arrays

2011-10-25 Thread kumar raja
Dheeraj can u please tell me how to keep track count for an element ,in hash table. I want the exact structure of the hash table The hash function uses the input as the elements value ,and stores it in some slot by computing hash function..then where is the question of storing count for that

[algogeeks] Questions on Hashing ...Share ur ideas...

2011-10-25 Thread kumar raja
Problem 1: Remove duplicate elements from an unsorted array of size N Problem 2: Find intersection of K unsorted array of N elements each. Intersection consists of elements that appear in all the K arrays. Problem 3: How to make a linked list support operations in O(1) time. The operations on

Re: [algogeeks] Intersection of arrays

2011-10-25 Thread kumar raja
I have got an idea I will construct (k-1) hash tables for the 2 to k array elements. Now starting at the 1st element in 1st array i will search for it in all the (k-1) hash tables in O((k-1)*1) time. So for n elements it would take O( n*(k-1)) time.. Is my approach correct,please correct me if

[algogeeks] Re: Hash Table

2011-10-25 Thread Don
It can be true if the hash table is used properly. If the table becomes too full or the hash function produces too many collisions it will not be constant time. So designing the hash system well remains very important. Don On Oct 25, 12:15 am, kumar raja rajkumar.cs...@gmail.com wrote: I have

Re: [algogeeks] Find all possible combination of integers for a given sum

2011-10-25 Thread Prem Krishna Chettri
Its a subset Manipulation Problem.. Very simple logic.. Can Use Recursion for even more simplicity.. Call Recursion one with that element and once wdout.. On 10/25/11, Meng Yan mengyan.fu...@gmail.com wrote: Hi, my question is given sum=N and combination constraint=M (the number of elements),

Re: [algogeeks] adobe question help

2011-10-25 Thread praveen raj
N=(N( (~0j) | (~(1i))) | (Mi) With regards, Praveen Raj DCE-IT 735993 praveen0...@gmail.com On Tue, Oct 25, 2011 at 11:46 AM, Bittu Sarkar bittu...@gmail.com wrote: N = (N | ((1(j-i+1)-1)i) (Mi); On 12 October 2011 01:22, prasad jondhale jondhale.pra...@gmail.comwrote: grt

Re: [algogeeks] Questions on Hashing ...Share ur ideas...

2011-10-25 Thread praveen raj
problem 4.. good question... With regards, Praveen Raj DCE-IT 3rd yr 735993 praveen0...@gmail.com On Tue, Oct 25, 2011 at 5:57 PM, kumar raja rajkumar.cs...@gmail.comwrote: Problem 1: Remove duplicate elements from an unsorted array of size N Problem 2: Find intersection of K unsorted

Re: [algogeeks] [SPOJ] ZSUM

2011-10-25 Thread Kunal Patil
Can you tell why (x * z * z) % MOD is different from (x * ( (z*z)%MOD) ) % MOD Again why ((x%MOD)*(z%MOD)*(z%MOD))%MOD is giving WA I thought of a simple examples like (100* 53*72) % 90 -- ((90+10)*53*72) % 90 -- (10*53*72)% 90 which is same as (100%90 * 53%90 * 72%90) % 90 Another

Re: [algogeeks] Search an element in an Infinite array

2011-10-25 Thread rahul sharma
@sharmila...wat r u saying??cant get u? On Tue, Oct 25, 2011 at 4:57 PM, sharmila saru sharmi99p...@gmail.comwrote: Give Idea 2 study for GATE... -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] [SPOJ] ZSUM

2011-10-25 Thread Aamir Khan
As far as modular arithmetic is concerned, (x * z *z )%MOD = (x *(z *z)%MOD)%MOD = ((x%MOD)*(z%MOD)*(z%MOD))%MOD But when you try to calculate *(x * z * z)%MOD*, the intermediate result of* (x * z * z) *overflows the integer limit and hence gives the wrong result. similarly, intermediate value

Re: [algogeeks] Questions on Hashing ...Share ur ideas...

2011-10-25 Thread SAMM
First of Happy Diwali 2 all. For question number 4, this can be done by using a chained hashing technique along with a valid/invalid bit which wil say it has been processed or not.. After insertion has been done in the hash table. For finding the unique pairs .. Iterate over the elements

Re: [algogeeks] Questions on Hashing ...Share ur ideas...

2011-10-25 Thread SAMM
On 10/26/11, SAMM somnath.nit...@gmail.com wrote: First of Happy Diwali 2 all. For question number 4, this can be done by using a chained hashing technique along with a valid/invalid bit which wil say it has been processed or not.. After insertion has been done in the hash table. For