Re: [algogeeks] partitioning the array

2011-05-08 Thread NIKHIL JAIN
still not getting the correct output

-- 
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] موقع سكس شوب بالخليج

2011-05-08 Thread اميرة دبي




موقع سكس شوب بالخليج

كل من يبحث عن المتعة و الجنس الان اكبر موقع عربي لبيع السلع الجنسية


لكل من يبحث عن المتعة و السعادة
لكل من يبحث عن الاثارة و المصداقية
ليس لكم غير قطار الحب ايطاليا لبيع المنتجات الجنسية

موقع امن و رائع يبيع كل المنتجات المتعلقة بالجنس و الخاصة للشباب و
الازواج ومنها
العاب جنسية
ادوية جنسة
بطاقات القنوات الجنسية
افلام جنسية
كريمات وعطور
مقويات ومنشطات
و دمى السيلكون الكاملة
كما يوزع الكثير و الكثير من السلع و يقدم خدمة التعارف الجنسي الرائعة

اهم مميزات الشركة
وجود منتجاتها بالدول الخلجية والعربية و التسليم يد بيد او عبر عددت
انواع للشحن الخاصة
السرية و الامان و الاسعار المناسبة جدا
و ايضا صمعة الموقع و قدمه حيث له 10 سنوات في التعامل مع الدول العربية
مواقعهم دوما تتعرض للحجب و يمكنك الدخول لموقعهم عبر هذا الرابط
http://www.t5y2.com/it/temp_index.htm

وان وجدته محجوب ارسل لهم رسالة لهذا البريد و سيتم ارسال لك رابط مفتوح
ومعها بروكسي


trainlo...@gmail.com
تحياتي
بدور


اذا كانت معظم اجاباتك ب  غارقه 
رقيقه وحالمه ولك عالمك الخاص الذي ترفعين حوله أسوارا و أسلاكا شائكه
كثيرون لا يعلمون ان مزاجك رومنسي الى حد بعيد .. ليس بسبب اخفائك هذا
المزاج ولكن لانك تفضلين الوحدة و العزلة في كثير من الاحيان .. تتمتعين
باحساس فني عالي يسعدك رغم انه يضفي عليك شيئا من الغموض او يبعدك احيانا
عن الواقع
*نسبه مزاجك الرومنسي 80%
اذا كانت معظم اجاباتك ج  متوازنه 
تستطيعين ان تكوني بمزاج رومنسي في الليالي الهادئه الهانئه وبمزاج واقعي
في النهارات التي تتطلب اعمالا ومسؤوليات و تستطعين ان تطلقي احلامك
وخيالك كما تشائين و تكبحيها عند اللزوم
بصراحه واختصار انت متوازنه وسعيده بمزاجك المضبوط حسب ما هو مطلوب
* نسبه مزاجك الرومنسي 40 و70 %

-- 
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] Popular Puzzle of the week

2011-05-08 Thread Lavesh Rawat
*Hi,*
*
*
*Based on most comments, The popular puzzle of the last week is*

*http://dailybrainteaser.blogspot.com/2011/05/trick-brain-teaser-2-may.html?http://dailybrainteaser.blogspot.com/2011/05/trick-brain-teaser-2-may.html
lavesh=lavesh
*
*Please subscribe and follow this blog to show your liking to the blog.*

-- 
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: Cracking the IT interview: jump start your career with confidence

2011-05-08 Thread Gagan Khurana
same here, did anyone find a link to this book yet?
I couldn't find it anywhere. I am willing to buy an electronic copy of
this book if it's out there.
I need it asap. Please let me know.

Thanks a lot.

On Apr 26, 12:25 am, vamsi achyuth vamsiachy...@gmail.com wrote:
 mee++; :)

 On 25 April 2011 16:12, raj singh ankurkaku...@gmail.com wrote:







  mujhe bhi

   --
  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] Efficient Way to Detect Duplicate Document

2011-05-08 Thread sourabh jakhar
please elaborate
On Wed, May 4, 2011 at 4:20 PM, Sathaiah Dontula don.sat...@gmail.comwrote:

 hash on the each page and compare the hash value.


 Thanks  regards,
 Sathaiah Dontula


 On Tue, May 3, 2011 at 8:59 PM, bittu shashank7andr...@gmail.com wrote:

 suppose You have a billion urls, where each is a huge page. How do you
 detect the duplicate documents?
 on what  criteria you will detect it, what algorithm , approach ,
 whats will be the complexity of each approach
 as it has many application in computer science ...i would like to have
 some good discussion on this topic

 Lets Explohttp://www.facebook.com/rer All The Approach ???

 Thanks  Regrads
 Shashank
 CSE, BIT Mesra

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




-- 
SOURABH JAKHAR,(CSE)(3 year)
ROOM NO 167 ,
TILAK,HOSTEL
'MNNIT ALLAHABAD

The Law of Win says, Let's not do it your way or my way; let's do it the
best way.

-- 
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] Amazon Interview Question

2011-05-08 Thread AlgoBoy
Given an N arrays of size K each.. each of these K elements in the N
arrays are sorted, each of  these N*K elements are unique. Choose a
single element from each of the N arrays, from the chosen subset of N
elements. Subtract the minimum and maximum element. Now, this
difference should be least possible minimum.. Hope the problem is
clear :) :)

Sample:

N=3, K=3

N=1 :  6, 16, 67
N=2 :  11,17,68
N=3 :  10, 15, 100

here if 16, 17, 15 are chosen.. we get the minimum difference as
17-15=2.

-- 
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: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-05-08 Thread ArPiT BhAtNaGaR
dere is soln first person mail to first person on list n den the one who
gets to next  so since we all need it :P

On Fri, May 6, 2011 at 11:01 AM, vamsi achyuth vamsiachy...@gmail.comwrote:

 mail me++;


 On 6 May 2011 10:52, naresh kumar naresh.sac...@gmail.com wrote:

 Pleas mail to me also...
 naresh.sac...@gmail.com
 Thanks in advance


 On Fri, May 6, 2011 at 1:46 AM, Ashish Modi ashishrmod...@gmail.comwrote:

 Hello,
 Can  you please mail me ashishrmod...@gmail.com

 Thanks in advance

 --
 With Regards
 Ashish

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


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




-- 
Thanks  Regards

Arpit Bhatnagar
(Computer Engineering)
(MNIT JAIPUR)

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

2011-05-08 Thread Abhishek Goswami
can u please explain me in descriptive manner

On Sat, May 7, 2011 at 2:31 PM, Amir hossein Shahriari 
amir.hossein.shahri...@gmail.com wrote:

 @venkatesan : im not sure about that! this problem is different

 but we can do it in O(n^2)
 the DP1 can be built done in O(n^2) as in abhijith's solution
 also the DP2 can be built in O(n^2) too. instead of counting the min # of
 palindrome strings that can make the range of [low,high]
 count how many palindromes can make the range [0,x]
 this makes the dp2 array linear and the overall running time quadratic

 int minCuts(int x)
 {
 if(isPalin(0,x)) return 0;
 if(dp2[x]!=-1) return dp2[x];
 int ans=1e9;
 for(int i=1;ihigh;i++)
 if (isPalin(i,x))
 ans=min(ans,1+minCuts(i-1));
 return dp2[x]=ans;
 }


 On Sat, May 7, 2011 at 12:41 PM, venkatesan B 
 venkat_b_engin...@yahoo.co.in wrote:

 problem like to find largest palindrome in the string
 so, in O(n) time complexity to find largest palindrome in the string


 --
 *From:* hary rathor harry.rat...@gmail.com
 *To:* algogeeks@googlegroups.com
 *Sent:* Saturday, 7 May 2011 10:33 AM
 *Subject:* Re: [algogeeks]

 @venkatesan

 now you give the algorithm ... of O(n)
  --
 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.


  --
 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] Efficient Way to Detect Duplicate Document

2011-05-08 Thread rahul patil
calculate MD5 and then see if MD5 for 2 pages is equal.

On Sun, May 8, 2011 at 1:24 PM, sourabh jakhar sourabhjak...@gmail.comwrote:


 please elaborate
 On Wed, May 4, 2011 at 4:20 PM, Sathaiah Dontula don.sat...@gmail.comwrote:

 hash on the each page and compare the hash value.


 Thanks  regards,
 Sathaiah Dontula


 On Tue, May 3, 2011 at 8:59 PM, bittu shashank7andr...@gmail.com wrote:

 suppose You have a billion urls, where each is a huge page. How do you
 detect the duplicate documents?
 on what  criteria you will detect it, what algorithm , approach ,
 whats will be the complexity of each approach
 as it has many application in computer science ...i would like to have
 some good discussion on this topic

 Lets Explohttp://www.facebook.com/rer All The Approach ???


 Thanks  Regrads
 Shashank
 CSE, BIT Mesra

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




 --
 SOURABH JAKHAR,(CSE)(3 year)
 ROOM NO 167 ,
 TILAK,HOSTEL
 'MNNIT ALLAHABAD

 The Law of Win says, Let's not do it your way or my way; let's do it the
 best way.

  --
 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,
Rahul Patil

-- 
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: partitioning the array

2011-05-08 Thread anitesh
1.Add 0 to the array if the number of elements in the given array is
odd.
2.Count the frequency of each element or we can simply sort it.
3.If the frequency is even for any element then that element can be
distributed among two parts equally(say p1 and p2).
4.For the elements having odd frequency(f) NOT=1, we can still
distribute them by (f-1)/2 each into p1 and p2 leaving with only one
instance of each odd frequency elements.(say in set S)
5.Now we are left with to divide the elements of the set S into p1 and
p2(equal number of elements in each part) such that the difference of
sum of p1 and p2 is minimum.
6.say the sum of the elements of the set S is X and the number of
elements is N.
So,we need to check if we can have N/2 elements in S such that their
sum equals to X/2(if X is even;else (X-1)/2).
And if it is not equal then try for the closest value.
7.If we are able to find such a combination then the difference will
be 0(if X is even) or 1(if it is odd).
   if not then the minimum difference will be X-(2*sum of the N/2
elements(as close as possible to X/2)).

thanks,
Anitesh.

-- 
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: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-05-08 Thread UTKARSH SRIVASTAV
mail me also usrivastav...@gmail.com

On Sun, May 8, 2011 at 1:08 AM, ArPiT BhAtNaGaR 
arpitbhatnagarm...@gmail.com wrote:

 dere is soln first person mail to first person on list n den the one who
 gets to next  so since we all need it :P


 On Fri, May 6, 2011 at 11:01 AM, vamsi achyuth vamsiachy...@gmail.comwrote:

 mail me++;


 On 6 May 2011 10:52, naresh kumar naresh.sac...@gmail.com wrote:

 Pleas mail to me also...
 naresh.sac...@gmail.com
 Thanks in advance


 On Fri, May 6, 2011 at 1:46 AM, Ashish Modi ashishrmod...@gmail.comwrote:

 Hello,
 Can  you please mail me ashishrmod...@gmail.com

 Thanks in advance

 --
 With Regards
 Ashish

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


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




 --
 Thanks  Regards

 Arpit Bhatnagar
 (Computer Engineering)
 (MNIT JAIPUR)

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




-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 2nd Year
@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 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] Candy_splitting in GCJ

2011-05-08 Thread kumar anurag
find xor of all elements - if its equal to zeo then Case has solution
otherwise NO
for finding the soltuion just sort all the elements and find the (sum of all
-sum of smallest)..


On Sun, May 8, 2011 at 9:50 PM, Kunal Patil kp101...@gmail.com wrote:

 Can anybody tell me How to solve candy splitting problem appeared in Google
 Code Jam Qualification round?
 I know there is solution, if XOR of all elements comes to be zero.
 But i wasn't able to proceed from there as I couldn't think of way how to
 partition that elements.
 (I have read solutions from other contestants but as expected they are
 dirty for the one who doesn't know logic behind program)
 So plz help...

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




-- 
Kumar Anurag

-- 
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: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-05-08 Thread Prakash D IT @ CEG
mail me too plzz.. cegprak...@gmail.com



On Sun, May 8, 2011 at 10:00 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:

 mail me also usrivastav...@gmail.com


 On Sun, May 8, 2011 at 1:08 AM, ArPiT BhAtNaGaR 
 arpitbhatnagarm...@gmail.com wrote:

 dere is soln first person mail to first person on list n den the one who
 gets to next  so since we all need it :P


 On Fri, May 6, 2011 at 11:01 AM, vamsi achyuth vamsiachy...@gmail.comwrote:

 mail me++;


 On 6 May 2011 10:52, naresh kumar naresh.sac...@gmail.com wrote:

 Pleas mail to me also...
 naresh.sac...@gmail.com
 Thanks in advance


 On Fri, May 6, 2011 at 1:46 AM, Ashish Modi ashishrmod...@gmail.comwrote:

 Hello,
 Can  you please mail me ashishrmod...@gmail.com

 Thanks in advance

 --
 With Regards
 Ashish

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


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




 --
 Thanks  Regards

 Arpit Bhatnagar
 (Computer Engineering)
 (MNIT JAIPUR)

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




 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 2nd Year
 @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 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] spoj-lites

2011-05-08 Thread keyankarthi
this is my code
--

#includeiostream
#includevector
#includestring.h
using namespace std;
vectorint tbf(100,0),array(100,0);
//vector 'tbf' denotes tobeflipped
void make(int ptr,int b,int e)
{
if(b==e)
{
array[ptr]=0;
return;
}
int mid=(b+e)/2;
make(ptr*2,b,mid);
make(ptr*2+1,mid+1,e);
array[ptr]=array[2*ptr]+array[2*ptr+1];
//combine
}
int query(int ptr,int b,int e,int i,int j)
{
if(jb || ie)
return 0;
if(tbf[ptr]1)
{
array[ptr]=(e-b+1)-array[ptr];
tbf[2*ptr]+=tbf[ptr];
tbf[2*ptr+1]+=tbf[ptr];
tbf[ptr]=0;
}
if(b=i  e=j)
return array[ptr];
int mid=(b+e)/2;
int x=query(2*ptr,b,mid,i,j)+query(2*ptr+1,mid+1,e,i,j);
return x;
}
void update(int ptr,int b,int e,int i,int j)
{
if(jb || ie)
return;
if(tbf[ptr]1)
{
array[ptr]=(e-b+1)-array[ptr];
tbf[2*ptr]+=tbf[ptr];
tbf[2*ptr+1]+=tbf[ptr];
tbf[ptr]=0;
}
if(b=i  e=j)
{
array[ptr]=(e-b+1)-array[ptr];
tbf[2*ptr]+=1;
tbf[2*ptr+1]+=1;
tbf[ptr]=0;
return;
}
int mid=(b+e)/2;
update(2*ptr,b,mid,i,j);
update(2*ptr+1,mid+1,e,i,j);
if(!tbf[2*ptr]  !tbf[2*ptr+1])
array[ptr]=array[2*ptr]+array[2*ptr+1];
else if(tbf[ptr*2]  tbf[2*ptr+1])
array[ptr]=(mid-b+1-array[2*ptr])+(e-mid-array[2*ptr+1]);
else if(!tbf[2*ptr])
array[ptr]=array[2*ptr]+(e-mid-array[2*ptr+1]);
else
array[ptr]=(mid-b+1-array[2*ptr])+array[2*ptr+1];
}
int main()
{
int n,q,st,en,opt;
cinnq;
make(1,1,n);
for(int i=0;iq;i++)
{
cinoptsten;
//st++;
//en++;
if(opt==0)
update(1,1,n,st,en);
else
coutquery(1,1,n,st,en)\n;
   /* coutstate of the array[]\n\n;
for(int i=1;i=7;i++)
coutarray[i]\t;
cout\n;
cout\nstate of the tbf[]\n\n;
for(int i=1;i=7;i++)
couttbf[i]\t;
cout\n--\n;*/
}
}

getting WA..
help me debugging

-- 
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] Reuest for a book

2011-05-08 Thread ankit sablok
Please mail the book Data Structures and Algorithms in C by Mark
Allen Weiss to the following Id - ankit4...@gmail.com
if anyone has d book

-- 
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] Reuest for a book

2011-05-08 Thread Charles Turner

On 08/05/2011 23:32, ankit sablok wrote:

Please mail the book Data Structures and Algorithms in C by Mark
Allen Weiss to the following Id - ankit4...@gmail.com
if anyone has d book

Stop being an IDIOT requesting illegal copies of books on a public list. 
This is really irritating me now. Due to the amount of such requests, 
I'm seriously considering leaving this list. That would be a shame, 
since it sometimes contains interesting information about the topic I 
originally signed up to read about, Algorithms.


Yours sincerely,

Charles.

--
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] Reuest for a book

2011-05-08 Thread Prakash D IT @ CEG
@charles: think in his point of view.. everyone's needs are different

On Mon, May 9, 2011 at 4:26 AM, Charles Turner chtu...@gmail.com wrote:

  On 08/05/2011 23:32, ankit sablok wrote:

 Please mail the book Data Structures and Algorithms in C by Mark
 Allen Weiss to the following Id - ankit4...@gmail.com
 if anyone has d book


  Stop being an IDIOT requesting illegal copies of books on a public list.
 This is really irritating me now. Due to the amount of such requests, I'm
 seriously considering leaving this list. That would be a shame, since it
 sometimes contains interesting information about the topic I originally
 signed up to read about, Algorithms.

 Yours sincerely,

 Charles.

 --
 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: partitioning the array

2011-05-08 Thread anshu
Use KnapSack DP. suppose the sum of element = s and number of elements
= n make a 2-dimesnsional array of size n * ((s+1)/2); I think that
much hint is enough.

if we think little bit more we can optimize it also.

-- 
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: Candy_splitting in GCJ

2011-05-08 Thread Koduri Nataraj
kumar anurag anurag.it.jolly@... writes:

 
 
 find xor of all elements - if its equal to zeo then Case has solution 
otherwise NOfor finding the soltuion just sort all the elements and find the 
(sum of all -sum of smallest)..
 On Sun, May 8, 2011 at 9:50 PM, Kunal Patil kp101090-
re5jqeeqqe8avxtiumw...@public.gmane.org wrote:Can anybody tell me How to 
solve candy splitting problem appeared in Google Code Jam Qualification round?
 I know there is solution, if XOR of all elements comes to be zero.But i 
wasn't able to proceed from there as I couldn't think of way how to partition 
that elements.
 (I have read solutions from other contestants but as expected they are dirty 
for the one who doesn't know logic behind program)So plz help...
 
 
 
Nice and simple logic!!! Struggled for 2 hours... I didnt get this clue...




-- 
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: partitioning the array

2011-05-08 Thread Gaurav Aggarwal
@anshu
then shall we use the foll reccurence realation??

1i=n
S=(s+1)/2

f(i,S)= min( f(i-1, S),  f(i-1, S- ar[i])  )


On Mon, May 9, 2011 at 10:42 AM, anshu anshumishra6...@gmail.com wrote:

 Use KnapSack DP. suppose the sum of element = s and number of elements
 = n make a 2-dimesnsional array of size n * ((s+1)/2); I think that
 much hint is enough.

 if we think little bit more we can optimize it also.

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




-- 
Gaurav Aggarwal
SCJP

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