@mahesh Gupta
Nice solution. Thank you. You have explained it well.
On Oct 4, 5:01 pm, Mukesh Gupta mukeshgupta.2...@gmail.com wrote:
The problem could be solved using xor logic. First take xor of all the
elements .Doing that we get a value which is xor of the two non repeating
elements(as
@Dave @Mukesh
yaa got it... so simple... i was needlessly making it complex
thankyou guys .
On Tue, Oct 5, 2010 at 2:09 AM, Dave dave_and_da...@juno.com wrote:
@Coolfrog$: It sounds like you think there are n items in each list,
but the problem statement says that the total number of
@saurabh:
For the base conversion problem, simulate long division in base B1 of
dividing the number by B2. The remainder is the rightmost digit of the
conversion. To get the next digit, divide the quotient from the first
long division by B2 to get the remainder. Repeat for successive digits
until
@Dave
1. if three sequence given are 2,3,4,5
17,20,31,50
6,9,10,15
while running we will get 2,3,4,5 as sequence no.1 vanishes form where to
choose next element. for heap . (algo.??)
2.
Loop until
@Coolfrog$: There must have been a communication gap.
The initial heap consists of the first element of each sequence: 2,
17, 6.
Looping, we output 2, then replace it in the heap with 3 and restore
the heap condition: 3, 17, 6.
Output 3, replace it with 4: 4, 17, 6.
Output 4, replace it with 5: 5,
For base conversion :
int convert(int n,int from,int to)
{
int ret=0,i=0;
while(n0)
{
ret=ret+(n%to)*pow(from,i++);
n/=to;
}
return ret;
}
Mukesh Gupta
Delhi Technological University
On Mon, Oct 4, 2010 at 11:20 PM, Dave dave_and_da...@juno.com wrote:
@Coolfrog$: There
@Dave
yes it help very much...i thank you for these...
but still one doubt
1.from first element of each sequence we have made a heap
2. now only n-1 element remains in all k seqences. total (= k*(n-1))
elememts
3.*loop is executed once for each output element = once for each
element in the
@coolfrog:
problem statement says total number of elements is n .so overall complexity
wud be O(n*logk) only. even i had the same doubt initially.
Mukesh Gupta
Delhi College of Engineering
On Tue, Oct 5, 2010 at 12:46 AM, coolfrog$
dixit.coolfrog.div...@gmail.comwrote:
@Dave
yes it help
@Coolfrog$: It sounds like you think there are n items in each list,
but the problem statement says that the total number of items in the
lists is n. In your example, n = 12.
Dave
On Oct 4, 2:16 pm, coolfrog$ dixit.coolfrog.div...@gmail.com
wrote:
@Dave
yes it help very much...i thank you for