[algogeeks] Re: puzzle

2011-09-23 Thread яαωαт Jee
^^ ans will be n*30 mins

On Sep 24, 8:40 am, яαωαт Jee  wrote:
> sum of GP..
> a=1
> common ratio=4
>
> sum is given=5.6 billion.. find n
> simple enough

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: puzzle

2011-09-23 Thread яαωαт Jee
sum of GP..
a=1
common ratio=4

sum is given=5.6 billion.. find n
simple enough

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Coding..........

2011-07-22 Thread яαωαт Jee
@ popli:  plz change ur email id..placement session will start soon.

On Jul 22, 8:32 pm, Gaurav Popli  wrote:
> an O(n) soln
> traveres the array...as you receive odd number put that index in
> queuewhen received an even numb check if queue is empty or
> not...if queue is empty the do nothing else swap with the head of the
> queue
>
> hope it worksit also maintains the stability of aarray...
>
>
>
>
>
>
>
> On Fri, Jul 22, 2011 at 6:39 PM, Kunal Patil  wrote:
> > @Sunny: Excellent explanation (& solution) !!
>
> > --
> > 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 options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread яαωαт Jee
sorry, for the previous post,
consider this...
iterate the string using variable i
'low' is another variable that stores the index of previous occurrence
of the character+1
initially, i=0 , low=0
max=i-low

"abcdedepoiuytu"
hashtable :
a= -1 , b= -1, . . . z = -1

a=0
b=1
c=2
d=3
e=4
now, d comes for the second time.. index value is 5 this time..it
check with the hash table..value there is a non negative no.(3)
max= i-low = 5-0=5
low= previous occurence of d+1(3+1=4), so low=4
value at d in hashtable is now=5

a=0
b=1
c=2
d=5
e=4 changes to e=6
i-lowmax.

plz check if this works, and if it doesn't..plz give the input for
which it fails.

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Largest substring with unique characters

2011-07-22 Thread яαωαт Jee
@khattri and khurana:
traverse the string once.
suppose the string is abcdeabcdeabcde
take a hashtable (initially set the items to -1) .now hash as per
khurana's idea till no duplicate occurs.Instead of marking 1. mark the
array index in the hashtable.
so in the hash table, we have
a=0 b=1 c=2 d=3 e=4
instead of 1s and 0s...
now 'a' comes again...it is non negative in the table..
max=current index(5) - a ki hash value(0)
max=5-0=5
change the hash table value of a to new value 5. repeat..
correct me if i am wrong.. m a rookie

-- 
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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.