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

2011-10-23 Thread Ankur Garg
Use Binary Search

start = 2^n-1 high =2^n where n=0,1

On Mon, Oct 24, 2011 at 12:28 AM, sunny agrawal wrote:

> hint 1: try to find 2 indexes i, j such that a[i] <= K <= a[j]
>
>
> On Sun, Oct 23, 2011 at 11:23 PM, Ankuj Gupta  wrote:
>
>> Given a sorted array of Infinite size, find an element ‘K’ in the
>> array without using extra memory in O (lgn) time
>>
>> --
>> 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.
>>
>>
>
>
> --
> Sunny Aggrawal
> B.Tech. V year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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.



Re: [algogeeks] choosing numbers

2011-10-23 Thread Piyush Kapoor
Suppose u choose ith element from the Kth set,then
dp[K][Sum]=sum(from i=0 to number of elements in the Kth set)
dp[K-1][Sum-(ith element of Kth set)]

On Sun, Oct 23, 2011 at 3:31 PM, cegprakash  wrote:

> hi i recently came across this problem..
>
> there are K sets
> each sets can contain n numbers from 0 to n
> we've to choose exactly one number from each set
> the sum of all the elements that we chose should be equal to P.
> we have to find how many such possibilities are there to choose so..
>
> for example
>
> assume there are 3 sets containing 1,2,3 elements in them
> so the first set contains 0 and 1
> second set contains 0,1 and 2
> third set contains 0,1,2 and 3
>
> assume P=2
>
> in this case there are 5 possibilities
>
> (0,0,2), (0,1,1), (0,2,0), (1,0,1), (1,1,0)
>
> i'm struggling for a DP solution!! help me out
>
> --
> 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.
>
>


-- 
*Regards,*
*Piyush Kapoor,*
*2nd year,CSE
IT-BHU*

-- 
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.



Re: [algogeeks] Re: ARTICULATION POINT ALGO

2011-10-23 Thread kartik sachan
yup but didn't get much out of 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 options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



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

2011-10-23 Thread Atul Singh
Do a binary Search between a[2**(k-1)] and a[2**(k)]

just find kth element greater than the item to be searched.



On Mon, Oct 24, 2011 at 12:28 AM, sunny agrawal wrote:

> hint 1: try to find 2 indexes i, j such that a[i] <= K <= a[j]
>
>
> On Sun, Oct 23, 2011 at 11:23 PM, Ankuj Gupta  wrote:
>
>> Given a sorted array of Infinite size, find an element ‘K’ in the
>> array without using extra memory in O (lgn) time
>>
>> --
>> 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.
>>
>>
>
>
> --
> Sunny Aggrawal
> B.Tech. V year,CSI
> Indian Institute Of Technology,Roorkee
>
>
>  --
> 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.
>



-- 
ATul Singh | Final Year  | Computer Science & Engineering | NIT Jalandhar

-- 
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: ARTICULATION POINT ALGO

2011-10-23 Thread Navneet
You can find it very easily on web. Did you tried it?

On Oct 23, 1:13 pm, kartik sachan  wrote:
> PLEASE ANY BODY CAN EXPLAIN ME ARTICULATION POINT ALGO IN DETAIL
> PLZ TAKE SOME EXAMPLE TOO
> --
>
> *WITH REGARDS,*
> *
> *
> *KARTIK SACHAN*
>
> *B.TECH 3rd YEAR*
> *COMPUTER SCIENCE AND ENGINEERING*
> *NIT ALLAHABAD*

-- 
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.



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

2011-10-23 Thread sunny agrawal
hint 1: try to find 2 indexes i, j such that a[i] <= K <= a[j]

On Sun, Oct 23, 2011 at 11:23 PM, Ankuj Gupta  wrote:

> Given a sorted array of Infinite size, find an element ‘K’ in the
> array without using extra memory in O (lgn) time
>
> --
> 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.
>
>


-- 
Sunny Aggrawal
B.Tech. V year,CSI
Indian Institute Of Technology,Roorkee

-- 
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] Search an element in an Infinite array

2011-10-23 Thread Ankuj Gupta
Given a sorted array of Infinite size, find an element ‘K’ in the
array without using extra memory in O (lgn) time

-- 
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] ARTICULATION POINT ALGO

2011-10-23 Thread kartik sachan
PLEASE ANY BODY CAN EXPLAIN ME ARTICULATION POINT ALGO IN DETAIL
PLZ TAKE SOME EXAMPLE TOO
-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
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] choosing numbers

2011-10-23 Thread cegprakash
hi i recently came across this problem..

there are K sets
each sets can contain n numbers from 0 to n
we've to choose exactly one number from each set
the sum of all the elements that we chose should be equal to P.
we have to find how many such possibilities are there to choose so..

for example

assume there are 3 sets containing 1,2,3 elements in them
so the first set contains 0 and 1
second set contains 0,1 and 2
third set contains 0,1,2 and 3

assume P=2

in this case there are 5 possibilities

(0,0,2), (0,1,1), (0,2,0), (1,0,1), (1,1,0)

i'm struggling for a DP solution!! help me out

-- 
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.