Re: [algogeeks] Re: Algorithm page

2012-02-14 Thread rahul
@Wladimir, Nice articles. Thanks. Best Regards, Rahul. On Tue, Feb 14, 2012 at 5:05 AM, Wladimir Tavares wladimir...@gmail.comwrote: Hi Guys, I transfer some text for this blog. http://marathoncode.blogspot.com Some good posts:

Re: [algogeeks] Digest for algogeeks@googlegroups.com - 13 Messages in 5 Topics

2012-02-14 Thread Sudhakar Kalmari
algogeeks@googlegroups.com wrote: = Today's Topic Summary = Group: algogeeks@googlegroups.com Url:

[algogeeks] Re: [Combinatorics] count possible number of binary search trees, given number of nodes

2012-02-14 Thread WgpShashank
HI , consider that each value could be the root. Recursively find the size of the left and right subtrees. thats it . lets try for n=2 e.g. 1,2 there ways to select the root wither 1 or 2 , if u choose one , size of left subtree will be 0 size of right subtree will be 1 so , similarly

Re: [algogeeks] spoj

2012-02-14 Thread vickywiz
in 1 2 3 4 5 6...o/p ll b 5 -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/eWlM2oyysowJ. To post to this group, send email to algogeeks@googlegroups.com. To

[algogeeks] Re: count possible number of binary search trees, given number of nodes

2012-02-14 Thread Don
For a binary search tree the solution is called the Catalan Numbers. The formula is (2n)!/(n!(n+1)!) The first few terms are: 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190, 6564120420, 24466267020, 91482563640,

[algogeeks] Array Problem

2012-02-14 Thread TUSHAR
Given an array of size N having numbers in the range 0 to k where k=N, preprocess the array inplace and in linear time in such a way that after preprocessing you should be able to return count of the input element in O(1). Please give some idea !! Thanks.. -- You received this message

Re: [algogeeks] Array Problem

2012-02-14 Thread Kartik Sachan
if n is less than 10^6 hasing works fine ..and we count in O(1) time only -- 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

Re: [algogeeks] Array Problem

2012-02-14 Thread atul anand
@kartik : question says inplace . so using hashing would be violation... i dont think so it can be done if array is unsorted and with given restriction On Wed, Feb 15, 2012 at 10:05 AM, Kartik Sachan kartik.sac...@gmail.comwrote: if n is less than 10^6 hasing works fine ..and we count in

[algogeeks] Re: Array Problem

2012-02-14 Thread TUSHAR
That means,,,we have to sort the array first in O(n). Is there any way to sort the array inplace in 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

[algogeeks] Re: Array Problem

2012-02-14 Thread Pranav
Array 'A' contains N elements st A[i] =k N Now, Iterate over the array. Let k=A[i] If A[i] N then k=A[i] mod N go to A[k] and write A[k] = A[k] + N So, lets take a sample array of size 5: 1,2,1,0,4 i=0: k=A[i]=1; A[i] 5; A[1] = A[1] + 5 = A[1] = 7 = A = 1,7,1,0,4 i=1: k=A[i]=7; A[i] 5;

Re: [algogeeks] Re: Array Problem

2012-02-14 Thread atul anand
@amit : it is valid for comparison based model.. On Wed, Feb 15, 2012 at 12:05 PM, amrit harry dabbcomput...@gmail.comwrote: @tushar lower bound for sorting an array is nlogn. http://www.bowdoin.edu/~ltoma/teaching/cs231/fall11/Lectures/6-moresorting/sortLB.pdf On Wed, Feb 15, 2012 at