Re: [algogeeks] Fwd: [ƒƒÖ]™ HaPpY NeW YeAr 2011

2010-12-31 Thread Thirupathi reddy Thumma
thank u,wish u the same

On Fri, Dec 31, 2010 at 11:27 PM, Piyush Verma <114piy...@gmail.com> wrote:

>
>
>
> *[image: happy-new-year-2011-5.jpg]*
> *
> *
> *Wish You A Happy And Prosperous New Year 2011*
> *--*
> *Raki*
>
>
>
> --
> *Piyush Verma*
> *MNNIT Allahabad*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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] Happy new year to every one.

2010-12-31 Thread Thirupathi reddy Thumma
Thank u,wish u the same ,have a great future.

On Sat, Jan 1, 2011 at 8:32 AM, rajeev kumar wrote:

> [image: HAPPY NEW YEAR 2011 GREETING CARDS.JPG]
>
>
> Thank You,
> Rajeev Kumar.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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: arrays

2010-12-31 Thread gupadhyaya
for each element i in A[n] do
map (A[n],i)

for each element j in B[n] do
index = B[n]
X[index] = map.get(index);

This will traverse both the array once, so O(n+n) = O(n) time.

On Dec 31, 1:44 pm, juver++  wrote:
> of course, we should keep pair - element and its initial position

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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] Fwd: [ƒƒÖ]™ HaPpY NeW YeAr 2011

2010-12-31 Thread Piyush Verma
*[image: happy-new-year-2011-5.jpg]*
*
*
*Wish You A Happy And Prosperous New Year 2011*
*--*
*Raki*



-- 
*Piyush Verma*
*MNNIT Allahabad*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Longest increasing subsequence

2010-12-31 Thread Nikhil Agarwal
https://groups.google.com/group/algogeeks/browse_thread/thread/b20cd8160a8e8f92?hl=en

On Fri, Dec 31, 2010 at 10:18 PM, Anand  wrote:

> @Nikhil,
>
> I searched through the group for the answer but didn't find one so I stated
> again.
>
>
> On Fri, Dec 31, 2010 at 1:39 AM, Nikhil Agarwal  > wrote:
>
>> I guess this has already been discussed here many times.Please check in
>> the group archives.
>>
>>
>> On Fri, Dec 31, 2010 at 2:14 PM, Anand  wrote:
>>
>>> Longest increasing subsequence using segment tree with O(nlogn)
>>>
>>>
>>> http://anandtechblog.blogspot.com/2010/12/longest-increasing-subsequence-using.html
>>>
>>>
>>> On Thu, Dec 30, 2010 at 11:27 PM, juver++  wrote:
>>>
 And of course simple binary search.

 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algoge...@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 algoge...@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.
>>>
>>
>>
>>
>> --
>> Thanks & Regards
>> Nikhil Agarwal
>> Senior Undergraduate
>> Computer Science & Engineering,
>> National Institute Of Technology, Durgapur,India
>> http://tech-nikk.blogspot.com
>> http://beta.freshersworld.com/communities/nitd
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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 algoge...@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.
>



-- 
Thanks & Regards
Nikhil Agarwal
Senior Undergraduate
Computer Science & Engineering,
National Institute Of Technology, Durgapur,India
http://tech-nikk.blogspot.com
http://beta.freshersworld.com/communities/nitd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: arrays

2010-12-31 Thread juver++
of course, we should keep pair - element and its initial position

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: DP Problem: minimum Cost

2010-12-31 Thread juver++
process bundles one by one, as for 0-1 knapsack problem.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Strings search problem

2010-12-31 Thread Akash Agrawal
http://tech-queries.blogspot.com/2010/12/finding-minimum-window-in-array-which.html

just use words in place of chars...


Regards,
Akash Agrawal
http://tech-queries.blogspot.com/


On Fri, Dec 31, 2010 at 11:00 AM, Davin  wrote:

> Find the area with less distance between words. Distance is measured
> words count in between two words.
>
> On Dec 30, 4:08 pm, 周翔  wrote:
> > "Distance is measured on number of words." what is your meaning ?  can
> you
> > explain it?
> >
> > 2010/12/29 Davin 
> >
> >
> >
> >
> >
> >
> >
> > > Given set of words, find an area of the text where these words are as
> > > close to each other as possible.
> > > Distance is measured on number of words.
> >
> > > e.g. for words [rat”, “jat”, “pat”] and text “rat stop the pat blah
> > > blah jat by pat jat tra la la” such area is “cat by mat bat”
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to algoge...@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 algoge...@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 algoge...@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: DP Problem: minimum Cost

2010-12-31 Thread Akash Agrawal
Hi,

Can u please explain. I couldn't get what do u mean by after processing K
bundles?

I wrote following code (which is inefficient) which is goving correct result
for 140. But how to get the value 1400.

#include
using namespace std;

//#define MAX 0x7FFF
int main()
{
int weight[] = {8, 20, 70, 130};
 int cost[] = {1025, 325, 475, 1050};
 int ans[10];
 for (int i=1; i< 1; i++)
ans[i] = 21474836;
 ans[0] = 0;
int i;
cout << ans[1250] << endl;
 for (i=1; i<10; i++)
{
for (int j=0; j<4; j++)
 {
if((i-weight[j]) >= 0)
{
 int cos = ans[i-weight[j]] + cost[j];
if (cos < ans[i])
{
  ans[i] = cos;
// cout << ans[i] << " " <=140 && ans[i] < INT_MAX)
break;
}
 cout << ans[i] << " " << i  DP[K][N] - minimal cost choosing N balls and after processing K bundles.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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: Longest increasing subsequence

2010-12-31 Thread Anand
@Nikhil,

I searched through the group for the answer but didn't find one so I stated
again.

On Fri, Dec 31, 2010 at 1:39 AM, Nikhil Agarwal
wrote:

> I guess this has already been discussed here many times.Please check in the
> group archives.
>
>
> On Fri, Dec 31, 2010 at 2:14 PM, Anand  wrote:
>
>> Longest increasing subsequence using segment tree with O(nlogn)
>>
>>
>> http://anandtechblog.blogspot.com/2010/12/longest-increasing-subsequence-using.html
>>
>>
>> On Thu, Dec 30, 2010 at 11:27 PM, juver++  wrote:
>>
>>> And of course simple binary search.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@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 algoge...@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.
>>
>
>
>
> --
> Thanks & Regards
> Nikhil Agarwal
> Senior Undergraduate
> Computer Science & Engineering,
> National Institute Of Technology, Durgapur,India
> http://tech-nikk.blogspot.com
> http://beta.freshersworld.com/communities/nitd
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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: arrays

2010-12-31 Thread Anand
@Wladimir

For creating binary search for the first array, we need to arrange it in
sorting order right? if we do so we will lose the
index information unless we store it in a structure of arrays.


On Thu, Dec 30, 2010 at 1:32 AM, Wladimir Tavares wrote:

> My two cents:
>
> You use bsearch in the first array for each element of second array!!
>
>
> Wladimir Araujo Tavares
> *Federal University of Ceará
>
> *
>
>
>
>
>
> On Wed, Dec 29, 2010 at 3:05 PM, siva viknesh wrote:
>
>> if we sort the first array along with the indexes ...in the next pass
>> we can directly print the indexes as result no
>> why should we do binary search in the next pass considering that
>> 2nd array is also sorted???
>>
>> On Dec 29, 11:38 am, Abioy Sun  wrote:
>> > Hello,
>> >
>> > 2010/12/29 Anand :
>> >
>> > > if I already have a structure indicating the position of the element
>> in the
>> > > array. Then why do we need to sort. Question is to provide index of
>> element
>> > > in O(nlogn).
>> >
>> > You do not have a structure before  preprocessing the data, whose
>> > complexity  is O(nlogn) via qsort. Once you zip the zip the two array,
>> > and sort the new array as @Wladimir and @juver++ mention, you can
>> > provide each certain element's index in O(logn) via bsearch.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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 algoge...@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 algoge...@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] puzzle

2010-12-31 Thread swayambhoo jain
See attached pdf for understanding the second part.

On Fri, Dec 31, 2010 at 10:24 AM, swayambhoo jain  wrote:

> Sorry I was wrong on the second question :
> Correct answer is : depending on the corner in which the ant is answers can
> be :
>
> sqrt( (3+5)^2 + 4^2 ) or sqrt( (4+5)^2 + 3^2 )
>
>
> On Fri, Dec 31, 2010 at 10:08 AM, swayambhoo jain <
> swayambhoo.j...@gmail.com> wrote:
>
>>  1) do two coin tosses :
>>
>> head , head --> 1st dessert
>> head , tail ---> 2nd dessert
>> tail , head ---> 3rd dessert
>>
>> if coin is biased... you can do in three coin tosses :
>> tail , head , head --> 1st dessert
>> head, tail , head --> 2nd dessert
>> head, head , tail --> 3rd dessert
>>
>> 2) sqrt(9+16+25) = 5sqrt(2)
>>
>> -swayambhoo
>>
>> On Fri, Dec 31, 2010 at 4:41 AM, bittu wrote:
>>
>>> At a restaurant, how can Veronica choose one out of three desserts
>>> with equal probability with the help of a coin? What if the coin is
>>> biased and the bias is unknown?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@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.
>>>
>>>
>>
>>
>> --
>> Swayambhoo jain,
>> Graduate Student, MSEE
>> Electrical and Computer Engineering Dept.
>> University of Minnesota, Twin Cities
>>
>
>
>
> --
> Swayambhoo jain,
> Graduate Student, MSEE
> Electrical and Computer Engineering Dept.
> University of Minnesota, Twin CitiesSorr
>



-- 
Swayambhoo jain,
Graduate Student, MSEE
Electrical and Computer Engineering Dept.
University of Minnesota, Twin Cities

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.



Untitled 1.pdf
Description: Adobe PDF document


Re: [algogeeks] puzzle

2010-12-31 Thread swayambhoo jain
Sorry I was wrong on the second question :
Correct answer is : depending on the corner in which the ant is answers can
be :

sqrt( (3+5)^2 + 4^2 ) or sqrt( (4+5)^2 + 3^2 )


On Fri, Dec 31, 2010 at 10:08 AM, swayambhoo jain  wrote:

>  1) do two coin tosses :
>
> head , head --> 1st dessert
> head , tail ---> 2nd dessert
> tail , head ---> 3rd dessert
>
> if coin is biased... you can do in three coin tosses :
> tail , head , head --> 1st dessert
> head, tail , head --> 2nd dessert
> head, head , tail --> 3rd dessert
>
> 2) sqrt(9+16+25) = 5sqrt(2)
>
> -swayambhoo
>
> On Fri, Dec 31, 2010 at 4:41 AM, bittu  wrote:
>
>> At a restaurant, how can Veronica choose one out of three desserts
>> with equal probability with the help of a coin? What if the coin is
>> biased and the bias is unknown?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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.
>>
>>
>
>
> --
> Swayambhoo jain,
> Graduate Student, MSEE
> Electrical and Computer Engineering Dept.
> University of Minnesota, Twin Cities
>



-- 
Swayambhoo jain,
Graduate Student, MSEE
Electrical and Computer Engineering Dept.
University of Minnesota, Twin CitiesSorr

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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] puzzle

2010-12-31 Thread swayambhoo jain
 1) do two coin tosses :

head , head --> 1st dessert
head , tail ---> 2nd dessert
tail , head ---> 3rd dessert

if coin is biased... you can do in three coin tosses :
tail , head , head --> 1st dessert
head, tail , head --> 2nd dessert
head, head , tail --> 3rd dessert

2) sqrt(9+16+25) = 5sqrt(2)

-swayambhoo

On Fri, Dec 31, 2010 at 4:41 AM, bittu  wrote:

> At a restaurant, how can Veronica choose one out of three desserts
> with equal probability with the help of a coin? What if the coin is
> biased and the bias is unknown?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>


-- 
Swayambhoo jain,
Graduate Student, MSEE
Electrical and Computer Engineering Dept.
University of Minnesota, Twin Cities

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: add two numbers using bitwise operators

2010-12-31 Thread rajeev kumar
Thanks to every for kind response

On Fri, Dec 31, 2010 at 6:38 AM, Dave  wrote:

> @Rajeev: When you add two one-bit quantities, you get a two-bit
> result:
> 0 + 0 = 00, 0 + 1 = 01, 1 + 0 = 01, and 1 + 1 = 10.
> Note that the leftmost bit of sum of the the single-bit quantities A
> and B, obeys the logic A & B, and the rightmost bit obeys A ^ B, where
> & is the logical AND operation and ^ is the logical eXclusive OR
> operation. When adding a multibit binary number, the leftmost bit
> carries into the next bit position. So the code you presented just
> does the multibit addition using the above two rules on all bits in
> parallel. The first two statements determine the results using the
> "leftmost bit" and "rightmost bit" rules above. If there are any
> carries, then they must be added to the next position to the left.
> Thus, shift the carries left one bit and repeat the addition process
> using the leftmost and rightmost bit rules again. Do this until there
> are no remaining carries. Hope this helps.
>
> Dave
>
> On Dec 31, 6:19 am, rajeev kumar  wrote:
> > Can any one tell me how to add two numbers using bitwise operators only.
> >
> > After spending so much time on googling,i found the below java code.But
> is
> > is confusing.
> > public class AddTwoNumbers {
> >
> > private static int myAdd(int a, int b)
> > {
> > int carry = a & b;
> > int result = a ^ b;
> > while(carry != 0)
> > {
> > int shiftedcarry = carry << 1;
> > carry = result & shiftedcarry;
> > result ^= shiftedcarry;
> > }
> > return result;
> > }
> >
> > public static void main(String[] args){
> >  System.out.println(myAdd(4, 5));
> > }
> >
> > }
> >
> > Please explain it.
> >
> > --
> > Thank You
> > Rajeev Kumar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>


-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: arrays

2010-12-31 Thread Wladimir Tavares
My two cents:

You use bsearch in the first array for each element of second array!!


Wladimir Araujo Tavares
*Federal University of Ceará

*




On Wed, Dec 29, 2010 at 3:05 PM, siva viknesh wrote:

> if we sort the first array along with the indexes ...in the next pass
> we can directly print the indexes as result no
> why should we do binary search in the next pass considering that
> 2nd array is also sorted???
>
> On Dec 29, 11:38 am, Abioy Sun  wrote:
> > Hello,
> >
> > 2010/12/29 Anand :
> >
> > > if I already have a structure indicating the position of the element in
> the
> > > array. Then why do we need to sort. Question is to provide index of
> element
> > > in O(nlogn).
> >
> > You do not have a structure before  preprocessing the data, whose
> > complexity  is O(nlogn) via qsort. Once you zip the zip the two array,
> > and sort the new array as @Wladimir and @juver++ mention, you can
> > provide each certain element's index in O(logn) via bsearch.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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] extendede hanoi problem

2010-12-31 Thread Umer Farooq
Can you elaborate the problem a little more? It has been stated in vague
manner.

On Fri, Dec 31, 2010 at 10:39 AM, sara  wrote:

> I Should Write A Recursive Program Of Extended Hanoi Tower. We Have
> A,B,C Like Before But There Is 2n Button. Odd Buttons In A And Even
> Buttons In B. For Example If N = 6 In A From Bottom To Up Is 1,3,5 (1
> Is The Largest) And In B 2,4,6. Plz Help Me?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>


-- 
Umer

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Longest increasing subsequence

2010-12-31 Thread Nikhil Agarwal
I guess this has already been discussed here many times.Please check in the
group archives.

On Fri, Dec 31, 2010 at 2:14 PM, Anand  wrote:

> Longest increasing subsequence using segment tree with O(nlogn)
>
>
> http://anandtechblog.blogspot.com/2010/12/longest-increasing-subsequence-using.html
>
>
> On Thu, Dec 30, 2010 at 11:27 PM, juver++  wrote:
>
>> And of course simple binary search.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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 algoge...@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.
>



-- 
Thanks & Regards
Nikhil Agarwal
Senior Undergraduate
Computer Science & Engineering,
National Institute Of Technology, Durgapur,India
http://tech-nikk.blogspot.com
http://beta.freshersworld.com/communities/nitd

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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

2010-12-31 Thread Paras Chhabra
Let's first simplify the problem and assume it's a cube of sides equal
to 3.
Just unflap one of the two vertical faces of the cube, that touch the
diametrically opposite point, so that this face is in the same plane
as the top face.
Now the start and end point are in the same plane. They are corners of
a rectangle with sides = 6 and 3. The diagonal is sqrt(36+9)
Now extend this logic to the cuboid.

On Dec 31, 3:46 pm, bittu  wrote:
> 2nd puzzle
>
> An ant has to crawl from one corner of a room to the diametrically
> opposite corner as quickly as possible. If the dimensions of the room
> are 3 x 4 x 5, what distance does the ant cover?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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

2010-12-31 Thread Dave
@Bittu. Unfold the room. Supposing that the 4x5 plane is the floor,
then the adjacent walls are 3x4 and 3x5:

++
||
||
++
||
++

or

++--+
||  |
||  |
++--+

The paths between opposite corners of the room map into paths from
opposite corners of these figures.
The shortest path in each figure is the diagonal. One is of length
sqrt(5^2 + 7^2) and the other is of length sqrt(4^2 + 8^2). The former
is the shorter.

Dave


On Dec 31, 4:46 am, bittu  wrote:
> 2nd puzzle
>
> An ant has to crawl from one corner of a room to the diametrically
> opposite corner as quickly as possible. If the dimensions of the room
> are 3 x 4 x 5, what distance does the ant cover?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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

2010-12-31 Thread Dave
@Anuj and Bittu: It is not necessary to know the bias. You can
simulate the flip of an unbiased coin with multiple flips of a biased
coin: Flip it twice. If the result is HT, consider it a Head. If the
result is TH, consider it a Tail. If the result is HH or TT, repeat
the process. It terminates with probability 1. Now use the resulting
Head or Tail in the procecure for deciding with a biased coin.

Dave

On Dec 31, 7:07 am, Anuj Kumar  wrote:
> in case the coin is not biased, we can flip the coin twice and define the
> rules as if {H,H} comes then ignore it i.e. dont take it as a flip and the 3
> other events would be valid onces and could occur with equal probabilities.
>
> In case of a biased coin please specify the probability of getting heads and
> that of getting tails.
>
>
>
>
>
> On Fri, Dec 31, 2010 at 4:11 PM, bittu  wrote:
> > At a restaurant, how can Veronica choose one out of three desserts
> > with equal probability with the help of a coin? What if the coin is
> > biased and the bias is unknown?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@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.
>
> --
> Anuj Kumar
> Third Year Undergraduate,
> Dept. of Computer Science and Engineering
> NIT Durgapur- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: add two numbers using bitwise operators

2010-12-31 Thread Dave
@Rajeev: When you add two one-bit quantities, you get a two-bit
result:
0 + 0 = 00, 0 + 1 = 01, 1 + 0 = 01, and 1 + 1 = 10.
Note that the leftmost bit of sum of the the single-bit quantities A
and B, obeys the logic A & B, and the rightmost bit obeys A ^ B, where
& is the logical AND operation and ^ is the logical eXclusive OR
operation. When adding a multibit binary number, the leftmost bit
carries into the next bit position. So the code you presented just
does the multibit addition using the above two rules on all bits in
parallel. The first two statements determine the results using the
"leftmost bit" and "rightmost bit" rules above. If there are any
carries, then they must be added to the next position to the left.
Thus, shift the carries left one bit and repeat the addition process
using the leftmost and rightmost bit rules again. Do this until there
are no remaining carries. Hope this helps.

Dave

On Dec 31, 6:19 am, rajeev kumar  wrote:
> Can any one tell me how to add two numbers using bitwise operators only.
>
> After spending so much time on googling,i found the below java code.But is
> is confusing.
> public class AddTwoNumbers {
>
>     private static int myAdd(int a, int b)
>     {
>         int carry = a & b;
>         int result = a ^ b;
>         while(carry != 0)
>         {
>             int shiftedcarry = carry << 1;
>             carry = result & shiftedcarry;
>             result ^= shiftedcarry;
>         }
>         return result;
>     }
>
>     public static void main(String[] args){
>          System.out.println(myAdd(4, 5));
>     }
>
> }
>
> Please explain it.
>
> --
> Thank You
> Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Interview question amazon

2010-12-31 Thread MAC
No , we had to find all the paths . Some paths could include the root .

On Tue, Dec 28, 2010 at 11:12 PM, yq Zhang  wrote:

> I think the original question says "Path can go from left subtree tree ,
> include root and go to right tree as well". This should mean the path must
> include the root.
>
>
> On Tue, Dec 28, 2010 at 4:52 AM, shanushaan 
> wrote:
>
>> Not clear what path you are referring to.
>>
>> Question. Should the path include root value always? (What is problem
>> with only left or only right path (not containing root))
>>   In your example for 16 one more path can be 0 1 5 10 as
>> well. Should algo return all the paths or just first one.
>>
>> On Dec 26, 10:08 pm, MAC  wrote:
>> > you are given a bst where each node has a int value , parent pointer ,
>> and
>> > left and right pointers , write a function to find a path with a given
>> sum
>> > value. Path can go from left subtree tree , include root and go to right
>> > tree as well . we need to find these paths also .
>> >
>> > 5
>> >1 10
>> > 0 2  6 11
>> >
>> > so to find 16 we say it is 1 to 5 to 10
>> >
>> > --
>> > thanks
>> > --mac
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@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 algoge...@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.
>



-- 
thanks
--mac

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: add two numbers using bitwise operators

2010-12-31 Thread Divesh Dixit
@rajeev
it is a Full Adder (digital electronics) .. code..

On Dec 31, 6:05 pm, Manmeet Singh  wrote:
> Go through gates in Electronics, code will be easy to visualize.
>
> On Fri, Dec 31, 2010 at 6:33 PM, juver++  wrote:
> > Yeah, add bits one by one from right to left, as for ordinary addition of
> > two numbers in 10-th radix
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@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 algoge...@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

2010-12-31 Thread Divesh Dixit
@vanadana
why are you calculating 3 complete... use minimized distance..
min.{ sqrt(4^2+x^2)+sqrt(3^2+(5-x)^2)};

so final answer is 8.6023144 units..

On Dec 31, 4:30 pm, Vandana Bachani  wrote:
> The ant needs to cover: 9.403 units. It will need to pass the diagonal of
> the side (4 by 5) and go up or down the side 3 units.
> 3+ sqrt(16+25)
>
> On Fri, Dec 31, 2010 at 4:16 PM, bittu  wrote:
>
> > 2nd puzzle
>
> > An ant has to crawl from one corner of a room to the diametrically
> > opposite corner as quickly as possible. If the dimensions of the room
> > are 3 x 4 x 5, what distance does the ant cover?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algoge...@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 algoge...@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] puzzle

2010-12-31 Thread Anuj Kumar
in case the coin is not biased, we can flip the coin twice and define the
rules as if {H,H} comes then ignore it i.e. dont take it as a flip and the 3
other events would be valid onces and could occur with equal probabilities.

In case of a biased coin please specify the probability of getting heads and
that of getting tails.

On Fri, Dec 31, 2010 at 4:11 PM, bittu  wrote:

> At a restaurant, how can Veronica choose one out of three desserts
> with equal probability with the help of a coin? What if the coin is
> biased and the bias is unknown?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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.
>
>


-- 
Anuj Kumar
Third Year Undergraduate,
Dept. of Computer Science and Engineering
NIT Durgapur

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: add two numbers using bitwise operators

2010-12-31 Thread Manmeet Singh
Go through gates in Electronics, code will be easy to visualize.

On Fri, Dec 31, 2010 at 6:33 PM, juver++  wrote:

> Yeah, add bits one by one from right to left, as for ordinary addition of
> two numbers in 10-th radix
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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: add two numbers using bitwise operators

2010-12-31 Thread juver++
Yeah, add bits one by one from right to left, as for ordinary addition of 
two numbers in 10-th radix

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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] add two numbers using bitwise operators

2010-12-31 Thread rajeev kumar
Can any one tell me how to add two numbers using bitwise operators only.

After spending so much time on googling,i found the below java code.But is
is confusing.
public class AddTwoNumbers {

private static int myAdd(int a, int b)
{
int carry = a & b;
int result = a ^ b;
while(carry != 0)
{
int shiftedcarry = carry << 1;
carry = result & shiftedcarry;
result ^= shiftedcarry;
}
return result;
}

public static void main(String[] args){
 System.out.println(myAdd(4, 5));
}

}


Please explain it.

-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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] Online Puzzle Championship..

2010-12-31 Thread AlgoBoy
Hi everybody,

College of engineering, Anna University is organizing an international
tech fest Kurukshetra and conducting an online event ENIGMA for those
who love to solve puzzles. It is sponsored by Ascent Education.
Exciting prizes to be won.

It will be held thrice and it is a 90 minute event.. For more details
log onto..

www.enigma.kurukshetra.org.in

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: puzzle

2010-12-31 Thread Vandana Bachani
The ant needs to cover: 9.403 units. It will need to pass the diagonal of
the side (4 by 5) and go up or down the side 3 units.
3+ sqrt(16+25)

On Fri, Dec 31, 2010 at 4:16 PM, bittu  wrote:

>
> 2nd puzzle
>
> An ant has to crawl from one corner of a room to the diametrically
> opposite corner as quickly as possible. If the dimensions of the room
> are 3 x 4 x 5, what distance does the ant cover?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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

2010-12-31 Thread bittu

2nd puzzle

An ant has to crawl from one corner of a room to the diametrically
opposite corner as quickly as possible. If the dimensions of the room
are 3 x 4 x 5, what distance does the ant cover?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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] puzzle

2010-12-31 Thread bittu
At a restaurant, how can Veronica choose one out of three desserts
with equal probability with the help of a coin? What if the coin is
biased and the bias is unknown?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Longest increasing subsequence

2010-12-31 Thread Anand
Longest increasing subsequence using segment tree with O(nlogn)

http://anandtechblog.blogspot.com/2010/12/longest-increasing-subsequence-using.html

On Thu, Dec 30, 2010 at 11:27 PM, juver++  wrote:

> And of course simple binary search.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@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 algoge...@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: Longest increasing subsequence

2010-12-31 Thread suhash
Another variation can be finding the longest subsequence such that the
'absolute'
difference between any 2 consecutive elements of the sequence you
choose is atmost 'k'. Here, query range is [a[i]-k,a[i]+k].

On Dec 31, 1:01 pm, suhash  wrote:
> @juver++: yeah! i get that! i thought the segment tree approach was
> worth mentioning because more general problems can be solved using
> this. eg:- Find the longest increasing subsequence such that the
> difference between any 2 consecutive elements of the sequence you
> choose is atmost 'k'. (Instead of querying in range [1,a[i]-1], just
> query in range[a[i]-k,a[i]-1]).
>
> On Dec 31, 12:27 pm, juver++  wrote:
>
> > And of course simple binary search.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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: Longest increasing subsequence

2010-12-31 Thread suhash
@juver++: yeah! i get that! i thought the segment tree approach was
worth mentioning because more general problems can be solved using
this. eg:- Find the longest increasing subsequence such that the
difference between any 2 consecutive elements of the sequence you
choose is atmost 'k'. (Instead of querying in range [1,a[i]-1], just
query in range[a[i]-k,a[i]-1]).

On Dec 31, 12:27 pm, juver++  wrote:
> And of course simple binary search.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@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.