Re: [algogeeks] Re: adobe

2012-07-03 Thread rahul ranjan
@abhishek its wrong as arr1 is just a pointer o int and sizeof(arr1)
will always be 4 bytes(size of a pointer) regardless of number of bytes
allocated to it on heap

On Tue, Jul 3, 2012 at 3:14 PM, Abhishek Sharma wrote:

> arr1 = (int *)malloc(sizeof(int) * ncols);// memory allocated for 1st
> row
> arr2 = (int **)malloc(sizeof(arr1) * nrows);
>
> I haven't tried it.So,please correct me if i am wrong
>
>
> On Mon, Jul 2, 2012 at 12:55 PM, Rishabh Agarwal wrote:
>
>>
>> nrows: number of rows
>> ncols: number of columns
>>
>> int **arra = (int **)malloc( sizeof(int*) * nrows );
>> int *ar = (int *)malloc( sizeof(int) * nrows * ncols );
>> for( int a = 0; a < nrows; a ++ ) {
>> arra[a] = ar + ncols * a;
>> }
>>
>> now index of array i and j can be accessed as arra[i][j]
>>
>>
>>
>> On Friday, June 29, 2012 4:46:18 PM UTC+5:30, rahul r. srivastava wrote:
>>>
>>> implement a 2d matrix using only 2 mallocs.
>>>
>>  --
>> 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/-/Pr2cEtta_LsJ.
>>
>> 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.
>>
>
>
>
> --
> Abhishek Sharma
> Under-Graduate Student,
> PEC University of Technology
>
>  --
> 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] adobe

2012-06-30 Thread rahul ranjan
i dont knw read it in some paper.. most prob developer.

On Sat, Jun 30, 2012 at 9:56 PM, rahul sharma wrote:

> these are asked for which profyl??developer or white box??
>
>
> On Sat, Jun 30, 2012 at 8:03 PM, Amol Sharma wrote:
>
>> @sarthak :
>> in your first solution aren't you using nrows+1 malloc's ?
>>
>> second solution is good using 1 malloc.
>> --
>>
>>
>> Amol Sharma
>> Final Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>
>>  
>> 
>>
>>
>>
>>
>>
>>
>> On Fri, Jun 29, 2012 at 5:35 PM, sarthak rai wrote:
>>
>>> 2 malloc():
>>> int **a=(int **)malloc(sizeof(int *)*nrows);
>>> for(i=0;i>> a[i]=(int *)malloc(sizeof(int)*ncols);
>>>
>>> using only 1 malloc:
>>> int **a=(int **)malloc(sizeof(int *)*nrows+(nrows*ncols)*(sizeof(int)));
>>> for(i=0;i>> {
>>> a[i]=(int*)(a+nrows+i*ncols);
>>>
>>> }
>>>
>>> On Fri, Jun 29, 2012 at 4:46 PM, rahul r. srivastava <
>>> rahul.ranjan...@gmail.com> wrote:
>>>
 implement a 2d matrix using only 2 mallocs.

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

-- 
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] Question asked in Amazon Online Test

2012-06-29 Thread rahul ranjan
oh bhai mere. kewal preorder use karke kaise tree bana dega???

On Fri, Jun 29, 2012 at 11:23 PM, amrit harry wrote:

> @bhaskar ur algo fails on this case (5+3)-(2+(3/6))
> -+53+2/36
> 63/2+35-+
> showing that 6/3 but actually it is 3/6
> so i think it could be done by folowing algo
> make a binary tree of given expression in O(n)  then do postorder
> traversal take O(n) so problem can be solved in O(n). and take O(2*n+1)
> space
>
> On Fri, Jun 29, 2012 at 9:13 PM, Bhaskar Kushwaha <
> bhaskar.kushwaha2...@gmail.com> wrote:
>
>> I think just reversing the prefix notation converts it to postfix notation
>>
>>
>> On Fri, Jun 29, 2012 at 7:46 PM, Gobind Kumar Hembram <
>> gobind@gmail.com> wrote:
>>
>>> Given an integer expression in a prefix format (i.e. the operator
>>> precedes the number it is operating on) ,  print the expression in the
>>> post fix format .
>>>
>>> Example: If the integer expression is in the prefix format is *+56-78,
>>> the postfix format expression is 56+78-*. Both of these
>>> correspond to the expression (5+6)*(7-8).
>>>
>>> --
>>> 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,
>> Bhaskar Kushwaha
>> Student
>> Final year
>> CSE
>> M.N.N.I.T.  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.
>>
>
>
>
> --
> Thanks & Regards
> Amritpal singh
>
>  --
> 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] problem with increment operator

2012-05-29 Thread rahul ranjan
it first calculates from right to left and then performs addition
so after a++ its still 4(with a promise to increment in next
statement). then ++a makes it 5. then further ++a makes it 6
now the addition phase comes into play value of a is 6 now so total
18 if it wud hav been a++ + a++ + a++ sum wud hav been 12
and for next statement 'a' wud hav been 7

On Wed, May 30, 2012 at 1:32 AM, Hassan Monfared wrote:

> I implemented ++ for a simple class and got 17.
> class A
> {
> public :
> int val;
> A(int v):val(v){}
>  int operator++()
> {
> cout <<"empty arg called\n";
>  return ++val;
> }
> int operator++(int x)
>  {
> cout < return val++;
>  }
> };
> --
> A b(4);
> cout <<++a + ++a +a++< 
> 17
> but  story is different for your sample.
> let me tell the fact with a simpler  problem :
> int b=4;
> cout << ++b + ++b ;
> will print 12 instead of 11!
> amazing huh ?
> what happens from right to left is :
> in the right statement  : b becomes 5:
> in the left statement : b becomes 6 ( now be is 6 in both sides !)
> so right_b + left_b = 6+6 = 12
>
> Regards
>
>
> On Tue, May 29, 2012 at 11:43 PM, Prateek Jain 
> wrote:
>
>> how is it 6?
>> ++a(5) + ++a(6) + a++(6) it shud be 17
>>
>>  --
>> 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] Re: storing URL's

2012-05-18 Thread rahul ranjan
rope data structure can be gud in such cases.. hashing may not be too
efficient as many url wud almost be same as mentioned by prakash. trie
is another option but i believe overhead in trie will be more...
correct me if i am wrong.

On Fri, May 18, 2012 at 11:33 AM, Ashish Goel  wrote:

> Tiger Tree Hash
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
>
> On Thu, May 17, 2012 at 11:16 PM, Prem Krishna Chettri  > wrote:
>
>> For the cases where Storing the Value is the only Concern and (Not the
>> Retrieval efficiency), I would Suggest Something called DFA Subset
>> minimization.. Google for it ... and after the final subset as said U can
>> use something called DAWG for the most Most Optimal solution..
>>
>>
>> On Thu, May 17, 2012 at 2:58 PM, Prakash D  wrote:
>>
>>> We can still improve this trie idea..
>>>
>>> say we have urls like
>>> www.google.com
>>> www.goodbye.com
>>> www.google.com/transliterate
>>> www.goodstrain.com/good
>>>
>>> we can subdivide everything under "www.goo"
>>> I mean we can store each character as a node in a trie and call it
>>> like a "URL dictionary"
>>>
>>>
>>> On Wed, May 16, 2012 at 5:43 PM, omega9 
>>> wrote:
>>> >
>>> >
>>> > On May 16, 10:33 am, atul anand  wrote:
>>> >> @amit :
>>> >>
>>> >> here is the reason :-
>>> >>
>>> >> each url sayhttp://www.geeksforgeeks.org
>>> >>
>>> >> you will hash following urlshttp://www.geeksforgeeks.orghttp://
>>> www.geeksforgeeks.org/archiveshttp://www.geeksforgeeks.org/archives/19248http://www.geeksforgeeks.org/archives/http://www.geeksforgeeks.org/archives/19221http://www.geeksforgeeks.org/archives/19290http://www.geeksforgeeks.org/archives/1876http://www.geeksforgeeks.org/archives/1763
>>> >>
>>> >> "http://www.geeksforgeeks.org"; is the redundant part in each url
>>> . it
>>> >> would unnecessary m/m to save all URLs.
>>> >>
>>> >> ok now say file have 20 million urls . .now what would you
>>> do.??
>>> >>
>>> >
>>> > I think the trie suggestion was good. Have each domain (with the
>>> > protocol part) as a node and then have the subsequent directory
>>> > locations as a hierarchy under 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.
>>> >
>>>
>>> --
>>> 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.