Re: [algogeeks] Casual: MS in US expenses

2013-06-25 Thread Jagannath Prasad Das
Thanks Varun.
Does it include everything(tution+hostel)?


On Tue, Jun 25, 2013 at 4:50 PM, Varun Nagpal wrote:

> Prepare to spend atleast 20 Lakhs
>
>
> On Tue, Jun 25, 2013 at 4:49 PM, Jagannath Prasad Das  > wrote:
>
>> Folks,
>>I suppose this is not the right blog to query about the aforementioned
>> subject, but i am of opinion that i can get a comprehensive reply to my
>> question. On an average how much money(approx) does it take somebody to do
>> a MS in US(including tution,hostel and miscellaneous) ?
>>
>> I suppose it is easy to get a RA in the university you study and that
>> helps in someway.
>>
>> Regards,
>> Jagannath
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to algogeeks+unsubscr...@googlegroups.com.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




[algogeeks] Casual: MS in US expenses

2013-06-25 Thread Jagannath Prasad Das
Folks,
   I suppose this is not the right blog to query about the aforementioned
subject, but i am of opinion that i can get a comprehensive reply to my
question. On an average how much money(approx) does it take somebody to do
a MS in US(including tution,hostel and miscellaneous) ?

I suppose it is easy to get a RA in the university you study and that helps
in someway.

Regards,
Jagannath

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] Adobe question

2013-06-25 Thread Jagannath Prasad Das
Is this not similar to knapsack problem?


On Fri, Jun 21, 2013 at 11:24 AM, Ravi Ranjan wrote:

> There is a Blank Paper Sheet, Given a list of characters and their sizes,
> for ex. A, P, O, N, Q with different font sizes and designs.
> Now we need to cut characters from given sheet of paper of all sizes
> atleast once. And also try to maxmize number of characters cut. Along with
> this, when you remove a character, rest paper is more or less like a rough
> sheet left. So we should try to minimize that rough sheet size as well.
> Write Algo for this. Provide Data Structure, Complexity of algorithm.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] c++ this pointer

2013-06-05 Thread Jagannath Prasad Das
I guess they are garbage values.


On Fri, May 31, 2013 at 3:41 PM, shubham saini wrote:

> #include
> using namespace std;
>
> class Test
> {
> private:
>   int x;
>   int y;
> public:
>   Test(int x = 0, int y = 0) { this->x = x; this->y = y; }
>   void setX(int a) { x = a; }
>   void setY(int b) { y = b; }
>   void destroy()  { delete this;
> cout<<"x="   }
>   void print() { cout << "x = " << x << " y = " << y << endl; }
> };
>
> int main()
> {
>   Test *obj=new Test();
>  (*obj).setX(10);
>  (*obj).setY(20);
>  (*obj).destroy();
>   (*obj).print();
>   return 0;
> }
>
> i created object dynamically yet how it is still able to print values of x
> & y even after deletion of object through 'this' .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to algogeeks+unsubscr...@googlegroups.com.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.




Re: [algogeeks] Pthread and Semaphore

2012-11-26 Thread Jagannath Prasad Das
Thanks all for the response.

I thought of constructing a conditional wait using semaphores as follows:
//global flag = 0.


void *text(void *arg)
{
int n = *(int*)arg;
while(flag != n)
{
sem_wait(&mutex);
internal_flag = 1;
}

if(internal_flag)
sem_post(&mutex);

.
//We can take a lock on this also.
flag++;
pthread_exit(0);
}

//Rest of the code for

On Mon, Nov 26, 2012 at 10:08 AM, Sachin Maheshwari <
sachin.maheshw...@gmail.com> wrote:

> Hi Jagannath,
>  pthread_join function call will suspend the execution of the current
> thread till the new thread (whose id you provide to this function) has
> completed.
>
> So in your example when you say pthread_join(tid[i],NULL), the current
> thread (ie the main thread) will remain suspended till thread created by
> you in the previous line pthread_create (with thread id tid[i]) completes.
>
> Regards,
> Sachin
>
>
> On Mon, Nov 26, 2012 at 9:46 AM, Jagannath Prasad Das  > wrote:
>
>> @Naveen: I didn't understand your point . Can you please throw more light
>> on join operation
>>
>> On Sun, Nov 25, 2012 at 10:47 PM, vIGNESH v wrote:
>>
>>> You can use mutex instead of semaphores if you need to execute only one
>>> case at a time.
>>>
>>> FROM,
>>>
>>> V.VIGNESH.
>>> M.Sc Theoretical Computer Science.
>>> PSG College of Technology
>>>
>>>
>>>
>>> On 25 November 2012 22:37, jagannath  wrote:
>>>
>>>>  Folks, I have one pthread question.I know that its not the right place
>>>> but i thought this is the right place to post this. Code snippet:
>>>> #include 
>>>> #include 
>>>>
>>>> #include  /* defines _POSIX_THREADS if pthreads are available
>>>> */
>>>> #ifdef _POSIX_THREADS
>>>> # include 
>>>> #endif
>>>>
>>>> #include 
>>>>
>>>> void *text(void *arg);
>>>>
>>>> int code[] = { 4, 6, 3, 1, 5, 0, 2 };
>>>>
>>>> int main()
>>>> {
>>>> int i;
>>>> pthread_t tid[7];
>>>>
>>>> for (i = 0; i < 7; i++)
>>>> {
>>>> pthread_create(&tid[i], NULL, text, (void*)&code[i]);
>>>> pthread_join(tid[i],NULL);
>>>> }
>>>>
>>>> return 0;
>>>> }
>>>>
>>>> void *text(void *arg)
>>>> {
>>>> int n = *(int*)arg;
>>>>
>>>> switch (n)
>>>> {
>>>> case 0:
>>>> printf("A semaphore S is an integer-valued variable which can take only
>>>> non-negative\n");
>>>> printf("values. Exactly two operations are defined on a
>>>> semaphore:\n\n");
>>>> break;
>>>>
>>>> case 1:
>>>> printf("Signal(S): If there are processes that have been suspended on
>>>> this semaphore,\n");
>>>> printf(" wake one of them, else S := S+1.\n\n");
>>>> break;
>>>>
>>>> case 2:
>>>> printf("Wait(S): If S>0 then S:=S-1, else suspend the execution of this
>>>> process.\n");
>>>> printf(" The process is said to be suspended on the semaphore S.\n\n");
>>>> break;
>>>>
>>>> case 3:
>>>> printf("The semaphore has the following properties:\n\n");
>>>> break;
>>>>
>>>> case 4:
>>>> printf("1. Signal(S) and Wait(S) are atomic instructions. In
>>>> particular, no\n");
>>>> printf(" instructions can be interleaved between the test that S>0 and
>>>> the\n");
>>>> printf(" decrement of S or the suspension of the calling
>>>> process.\n\n");
>>>> break;
>>>>
>>>> case 5:
>>>> printf("2. A semaphore must be given an non-negative initial
>>>> value.\n\n");
>>>> break;
>>>>
>>>> case 6:
>>>> printf("3. The Signal(S) operation must waken one of the suspended
>>>> processes. The\n");
>>>> printf(" definition does not specify which process will be
>>>> awakened.\n\n");
>>>> break;
>>>> }
>>>>
>>>> pthread_exit(0);
>>>> }
>>>>
>>>> The threads are not synchronized and therefore the text output is
>>>> garbled. How to add semaphores of POSIX to this program to synchronize the
>>>> threads.?
>>>>
>>>> primitives to rejig your memory:
>>>>
>>>> sem_init(), sem_wait(),sem_post(),sem_destroy().
>>>>
>>>> --
>>>>
>>>>
>>>>
>>>
>>>  --
>>>
>>>
>>>
>>
>>  --
>>
>>
>>
>
>
>
> --
> Regards,
> Sachin Maheshwari
> Cell phone: +91.7259917298
>
> "If we admit that human life can be ruled by reason; the possibility of
> life is destroyed." - Alexander Supertramp
>
> --
>
>
>

-- 




Re: [algogeeks] Pthread and Semaphore

2012-11-25 Thread Jagannath Prasad Das
@Naveen: I didn't understand your point . Can you please throw more light
on join operation

On Sun, Nov 25, 2012 at 10:47 PM, vIGNESH v  wrote:

> You can use mutex instead of semaphores if you need to execute only one
> case at a time.
>
> FROM,
>
> V.VIGNESH.
> M.Sc Theoretical Computer Science.
> PSG College of Technology
>
>
>
> On 25 November 2012 22:37, jagannath  wrote:
>
>>  Folks, I have one pthread question.I know that its not the right place
>> but i thought this is the right place to post this. Code snippet:
>> #include 
>> #include 
>>
>> #include  /* defines _POSIX_THREADS if pthreads are available
>> */
>> #ifdef _POSIX_THREADS
>> # include 
>> #endif
>>
>> #include 
>>
>> void *text(void *arg);
>>
>> int code[] = { 4, 6, 3, 1, 5, 0, 2 };
>>
>> int main()
>> {
>> int i;
>> pthread_t tid[7];
>>
>> for (i = 0; i < 7; i++)
>> {
>> pthread_create(&tid[i], NULL, text, (void*)&code[i]);
>> pthread_join(tid[i],NULL);
>> }
>>
>> return 0;
>> }
>>
>> void *text(void *arg)
>> {
>> int n = *(int*)arg;
>>
>> switch (n)
>> {
>> case 0:
>> printf("A semaphore S is an integer-valued variable which can take only
>> non-negative\n");
>> printf("values. Exactly two operations are defined on a semaphore:\n\n");
>> break;
>>
>> case 1:
>> printf("Signal(S): If there are processes that have been suspended on
>> this semaphore,\n");
>> printf(" wake one of them, else S := S+1.\n\n");
>> break;
>>
>> case 2:
>> printf("Wait(S): If S>0 then S:=S-1, else suspend the execution of this
>> process.\n");
>> printf(" The process is said to be suspended on the semaphore S.\n\n");
>> break;
>>
>> case 3:
>> printf("The semaphore has the following properties:\n\n");
>> break;
>>
>> case 4:
>> printf("1. Signal(S) and Wait(S) are atomic instructions. In particular,
>> no\n");
>> printf(" instructions can be interleaved between the test that S>0 and
>> the\n");
>> printf(" decrement of S or the suspension of the calling process.\n\n");
>> break;
>>
>> case 5:
>> printf("2. A semaphore must be given an non-negative initial
>> value.\n\n");
>> break;
>>
>> case 6:
>> printf("3. The Signal(S) operation must waken one of the suspended
>> processes. The\n");
>> printf(" definition does not specify which process will be
>> awakened.\n\n");
>> break;
>> }
>>
>> pthread_exit(0);
>> }
>>
>> The threads are not synchronized and therefore the text output is
>> garbled. How to add semaphores of POSIX to this program to synchronize the
>> threads.?
>>
>> primitives to rejig your memory:
>>
>> sem_init(), sem_wait(),sem_post(),sem_destroy().
>>
>> --
>>
>>
>>
>
>  --
>
>
>

-- 




Re: [algogeeks] Re: amazon ques

2011-12-27 Thread Jagannath Prasad Das
@shashank and @samm: Is the deletion and searching is o(1). I doubt

On Sat, Oct 1, 2011 at 6:30 PM, SAMM  wrote:

> Yaa it will work , but in case of deletion don't u think array will
> not as efficient as linked list becoz  array is Static we need to
> define the memory b4 hand..
>
> On 10/1/11, WgpShashank  wrote:
> > @All Why don't try with combination of* hash-table & Array* , It Will
> Work ,
> > try it out :P
> >
> >
> > Thanks
> > Shashank Mani
> > CSE, BIT Mesra
> >
> > --
> > 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/-/v_MplK3KzegJ.
> > 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.
> >
> >
>
>
> --
> Somnath 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] Re: function overloading query

2011-11-22 Thread Jagannath Prasad Das
What this means compiler looks for closest possible match ,then other
alternatives.In this func(char*) is executed if that is not there then
func(const char*) is executed.
Comment the func(char*) and check.There is no overloading in c as far i
know.

On Tue, Nov 22, 2011 at 10:11 PM, Jagannath Prasad Das
wrote:

> Run this one:
>
> #include
> void fun(const char *p)
> {
>   printf("const\n");
> }
> void fun(char *P)
> {
>   printf("simple\n");
> }
> int main(void)
> {
>   char str[] = "funcheck";
>   //const char str1[] =
> "constcheck";
>
>   fun(str);
>   fun(str);
>
> }
>
>
>
> On Tue, Nov 22, 2011 at 7:13 PM, MJ  wrote:
>
>> Hi
>> This type of function overloading works in c .
>> Execute following code and it will call function fun as per the
>> function parameter
>>
>> code snip-in
>> -
>> #include
>> void fun(const char *p)
>> {
>>printf("funsfsdafsf1\n");
>> }
>> void fun(char *P)
>> {
>>printf("fun2\n");
>> }
>> void main()
>> {
>>char str[] = "funcheck";
>>const char str1[] = "constcheck";
>>fun(str);
>>fun(str1);
>> }
>> -
>>
>> output
>> 
>> fun2
>> funsfsdafsf1
>> 
>>
>> Mayur
>>
>>
>> On Nov 21, 6:30 pm, Anil Arya  wrote:
>> > dudecompile using g++
>> >
>> > On 11/21/11, atul anand  wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > this is what i am getting after executing code meintion in the above
>> link.
>> >
>> > > (using gcc compiler )
>> >
>> > > temp.c:12: error: conflicting types for 'fun'
>> > > temp.c:7: error: previous definition of 'fun' was here
>> >
>> > > On Mon, Nov 21, 2011 at 3:09 PM, UTKARSH SRIVASTAV
>> > > wrote:
>> >
>> > >>http://www.ideone.com/JQFNh
>> > >> CHECK THE OUTPUT THERE IS NO AMBIGUITY BUT PLEASE EXPLAIN THE RESULTS
>> >
>> > >> On Sun, Nov 20, 2011 at 11:00 PM, Akash Coder
>> > >> wrote:
>> >
>> > >>> it wont work
>> >
>> > >>> even this wont
>> >
>> > >>> function(char a[])
>> > >>> function (char *)
>> > >>> coz the two forms are interchangeable
>> >
>> > >>> On Sun, Nov 20, 2011 at 10:12 PM, saurabh singh
>> > >>> wrote:
>> >
>> > >>>> wont work..Thre is no way compilers gonna guess which function
>> to
>> > >>>> call.The const qualifier only guarantees that the value at the
>> address
>> > >>>> wont
>> > >>>> be altered inside the function.That has nothing to do with calling,
>> >
>> > >>>> On Sun, Nov 20, 2011 at 9:50 PM, rahul vatsa
>> > >>>> wrote:
>> >
>> > >>>>> yes, it will work.
>> >
>> > >>>>> On Sun, Nov 20, 2011 at 9:12 PM, Akash Coder <
>> > >>>>> akash.coder.g...@gmail.com> wrote:
>> >
>> > >>>>>> no it wont work ... const is not a datatype. its  a qualifier
>> >
>> > >>>>>> On Sun, Nov 20, 2011 at 7:49 PM, rahul sharma <
>> rahul23111...@gmail.com
>> > >>>>>> > wrote:
>> >
>> > >>>>>>> void fun(char *)
>> > >>>>>>> void fun(const char *)
>> >
>> > >>>>>>> is this overloading works or these are same type of
>> arguments??
>> >
>> > >>>>>>> --
>> > >>>>>>> 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/grou

Re: [algogeeks] Re: function overloading query

2011-11-22 Thread Jagannath Prasad Das
Run this one:
#include
void fun(const char *p)
{
  printf("const\n");
}
void fun(char *P)
{
  printf("simple\n");
}
int main(void)
{
  char str[] = "funcheck";
  //const char str1[] =
"constcheck";

  fun(str);
  fun(str);
}



On Tue, Nov 22, 2011 at 7:13 PM, MJ  wrote:

> Hi
> This type of function overloading works in c .
> Execute following code and it will call function fun as per the
> function parameter
>
> code snip-in
> -
> #include
> void fun(const char *p)
> {
>printf("funsfsdafsf1\n");
> }
> void fun(char *P)
> {
>printf("fun2\n");
> }
> void main()
> {
>char str[] = "funcheck";
>const char str1[] = "constcheck";
>fun(str);
>fun(str1);
> }
> -
>
> output
> 
> fun2
> funsfsdafsf1
> 
>
> Mayur
>
>
> On Nov 21, 6:30 pm, Anil Arya  wrote:
> > dudecompile using g++
> >
> > On 11/21/11, atul anand  wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > this is what i am getting after executing code meintion in the above
> link.
> >
> > > (using gcc compiler )
> >
> > > temp.c:12: error: conflicting types for 'fun'
> > > temp.c:7: error: previous definition of 'fun' was here
> >
> > > On Mon, Nov 21, 2011 at 3:09 PM, UTKARSH SRIVASTAV
> > > wrote:
> >
> > >>http://www.ideone.com/JQFNh
> > >> CHECK THE OUTPUT THERE IS NO AMBIGUITY BUT PLEASE EXPLAIN THE RESULTS
> >
> > >> On Sun, Nov 20, 2011 at 11:00 PM, Akash Coder
> > >> wrote:
> >
> > >>> it wont work
> >
> > >>> even this wont
> >
> > >>> function(char a[])
> > >>> function (char *)
> > >>> coz the two forms are interchangeable
> >
> > >>> On Sun, Nov 20, 2011 at 10:12 PM, saurabh singh
> > >>> wrote:
> >
> >  wont work..Thre is no way compilers gonna guess which function
> to
> >  call.The const qualifier only guarantees that the value at the
> address
> >  wont
> >  be altered inside the function.That has nothing to do with calling,
> >
> >  On Sun, Nov 20, 2011 at 9:50 PM, rahul vatsa
> >  wrote:
> >
> > > yes, it will work.
> >
> > > On Sun, Nov 20, 2011 at 9:12 PM, Akash Coder <
> > > akash.coder.g...@gmail.com> wrote:
> >
> > >> no it wont work ... const is not a datatype. its  a qualifier
> >
> > >> On Sun, Nov 20, 2011 at 7:49 PM, rahul sharma <
> rahul23111...@gmail.com
> > >> > wrote:
> >
> > >>> void fun(char *)
> > >>> void fun(const char *)
> >
> > >>> is this overloading works or these are same type of
> arguments??
> >
> > >>> --
> > >>> 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.
> >
> >  --
> >  Saurabh Singh
> >  B.Tech (Computer Science)
> >  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.
> >
> > >> --
> > >> *UTKARSH SRIVASTAV
> > >> CSE-3
> > >> B-Tech 3rd 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

Re: [algogeeks] Time Complexity

2011-11-19 Thread Jagannath Prasad Das
I think any traversal has o(n) complexity as we traverse all the
nodes.There is no skipping of nodes.Very simple logic:)

On Sun, Nov 20, 2011 at 9:57 AM, tech coder wrote:

> @ sravanreddy001
> complexity is O(N^2) whether tree is balanced or not doesn't matter
> For each level it's visiting  elements. all elements upto n-1 level .
> i dont know from where u  got the concept of logn  ,  the code is not
> making any decision to go in left or right , it is going in left and right
> both , so how it is nlogn.
>
>
> On Sun, Nov 20, 2011 at 3:12 AM, sravanreddy001 
> wrote:
>
>> Its NlogN if balanced.. Else N^2
>>
>> For each element it's visiting at most log N elements.(assuming balanced)
>>
>> --
>> 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/-/hVQH5EtOfK4J.
>> 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*
> *"The Coder"*
>
> *"Life is a Game. The more u play, the more u win, the more u win , the
> more successfully u play"*
>
>  --
> 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] Facebook Online Question India

2011-11-10 Thread Jagannath Prasad Das
How many students they took and whats the offer?

On Thu, Nov 10, 2011 at 8:03 AM, rahul sharma wrote:

> facebook visit DCE???wats package???
>
>
> On Wed, Nov 9, 2011 at 9:22 PM, Decipher  wrote:
>
>> This question was asked by Facebook during their 2 hour online exam (Only
>> 1 question in 2 hour as per my junior) in DCE.
>>
>> Given a list of words wordlist on 1st line (no of words <= 100) and a
>> string qstr of len <= 1 million on 2nd line, print the index at qstr where
>> a continuous substring exists that contains all the given words in wordlist.
>>
>> Don't ask any further questions as I got this information from some
>> junior in my college.
>>
>> --
>> 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/-/JwSnPn-5WRUJ.
>> 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: heap memory

2011-11-07 Thread Jagannath Prasad Das
I think its same as the Virtual memory

On Mon, Nov 7, 2011 at 4:22 PM, Gene  wrote:

> I think you just said the same thing I did.
>
> I disagree.  As I said, you get an approximation with wrappers. You
> can track the amount of memory actually in use by the client program.
> For malloc/frees that don't return memory to the OS once allocated
> (this includes glibc in Linux), you can also track the size of the
> free list consisting of memory that was already malloc()'ed at least
> once. As I also said, you can't track what's in block overheads. I
> omitted that you can't track free list memory that has never been
> allocated.  Linux calls this the "trim threshold" and it's 128K by
> default. My experience is block overhead is about 8 bytes per block
> (unless you have turned on a debugging mode). So the wrapper normally
> gives a useful approximation.
>
> My main point was the function of sbrk() is OS-dependent.  I know
> malloc() _in Linux and Unix systems_ calls brk()/sbrk().  The article
> also talks about _how Linux glibc uses mmap()_ to allocate large
> chunks. Calls to mmap() do not affect the program break. Therefore
> sbrk(0) will not reflect these big blocks, so it's not a reliable way
> to estimate memory usage.
>
> Windows has a per process heap manager internal to the OS. So there is
> no sbrk(). There are other calls to query the amount of heap space in
> use.
>
> The documented way to get information about Linux memory usage is to
> read the special file /proc//statm.  See linux documentation for
> this.
>
> The documenated way to get information in Windows is
> GetProcessMemoryInfo().
>
> On Nov 6, 12:17 pm, himanshu kansal 
> wrote:
> > @Gene: since the article itself says that if the memory is allocated
> > through malloc, it will make some (less) sbrk calls to the system to
> > increase the allocated memory to the program.
> > then how can a wrapper function will do
> > the malloc internally will call the sbrk function and will increase the
> > allocated memorythe wrapper func would have know way of finding that
> > the memory has been increased
> > secondly, it will ignore the amount of chunk that would have been used
> for
> > bookkeeping.
> >
> > it cannot be done using wrapper function
> >
> >
> >
> >
> >
> > On Sun, Nov 6, 2011 at 3:18 AM, Gene  wrote:
> > > In C you can get close by wrapping malloc() and free() and maintaining
> > > your own total.  This will not capture the header within each
> > > malloc()'ed block.
> >
> > > You can also use a tool like valgrind .
> >
> > > The behavior of sbrk() is totally OS dependent, and sbrk() doesn't
> > > exist on e.g. Windows.  This method won't work reliably on Linux
> > > either.  Here is a pretty good article for details on Linux memory
> > > allocation:http://www.linuxjournal.com/article/6390?page=0,0
> >
> > > On Nov 5, 6:28 pm, himanshu kansal 
> > > wrote:
> > > > can we know the size of heap memory allocated to our program
> >
> > > > i think sbrk(0) will return the address of end of heap.
> > > > but how to find the start of heap so that we can calculate the size
> of
> > > > total heap memory allocated to our program
> >
> > > > is there any way possible
> >
> > > --
> > > 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
> >  Himanshu Kansal
> >Msc Comp. sc.
> > (University of Delhi)
>
> --
> 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] Finding Maximum subarray in a circle

2011-11-02 Thread Jagannath Prasad Das
seems to be a independent problemu can see maximum subarray problem


On Tue, Nov 1, 2011 at 11:54 PM, atul007  wrote:

> Assume that there are n numbers (some possibly negative) on a circle,
> and
> we wish to find the maximum contiguous sum along an arc of the circle.
> Give an
> efficient algorithm for solving this problem.
>
> --
> 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] DS QUESTION

2011-09-18 Thread Jagannath Prasad Das
@Amol:the answer u have given is for binary ..and thats catalan
number...recursive solution

On Sun, Sep 18, 2011 at 1:33 PM, Anup Ghatage  wrote:

> (2n)! / ((n+1)! + (n)!)
> Where n is the number of nodes.
> The above mentioned formula is for the n'th Catalan number.
>
> @all correct me if I am wrong
>
>
> On Sun, Sep 18, 2011 at 7:11 AM, Amol Sharma wrote:
>
>> 2nCn/(n+1) ..simple maths :)
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>   
>> 
>>
>>
>>
>>
>>
>> On Sun, Sep 18, 2011 at 12:37 PM, kartik sachan 
>> wrote:
>>
>>> given n nodes ,how many different possible tree can be formed??(not
>>> necessary that all are binary treeit could be any tree...)
>>>
>>>
>>> --
>>>
>>> *WITH REGARDS,*
>>> *
>>> *
>>> *KARTIK SACHAN*
>>>
>>> *B.TECH 3rd YEAR*
>>> *COMPUTER SCIENCE AND ENGINEERING*
>>> *NIT ALLAHABAD*
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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.
>>
>
>
>
> --
> Anup Ghatage
>
>  --
> 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] amazon

2011-08-25 Thread Jagannath Prasad Das
what do u folks think please reply

On Mon, Aug 22, 2011 at 11:43 PM, Jagannath Prasad Das
wrote:

> In formal arguments compiler comes to  know about the type of its
> arguments.
> In the actual parameter compiler also knows what is the type of parameter
> passed.
> Actually the type conversion takes place when the function is called at the
> runtime during assignment of actual to formal argument.
> So when the function is called ,first of all the the expression
> representing actual parameter is evaluated and a copy of it made/copy
> constructor is called incase of object passing.
>
>
> So i feel "both" is the answer
>
> cheers
> jagannath
>
>
> On Mon, Aug 22, 2011 at 10:28 PM, sukran dhawan wrote:
>
>> if u dont want messages pl unsubscribe from the group :)
>>
>>
>> On Mon, Aug 22, 2011 at 10:26 PM, raj Kumar > > wrote:
>>
>>> please dont send me messages
>>>
>>>  --
>>> 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] amazon

2011-08-22 Thread Jagannath Prasad Das
In formal arguments compiler comes to  know about the type of its arguments.
In the actual parameter compiler also knows what is the type of parameter
passed.
Actually the type conversion takes place when the function is called at the
runtime during assignment of actual to formal argument.
So when the function is called ,first of all the the expression representing
actual parameter is evaluated and a copy of it made/copy constructor is
called incase of object passing.


So i feel "both" is the answer

cheers
jagannath

On Mon, Aug 22, 2011 at 10:28 PM, sukran dhawan wrote:

> if u dont want messages pl unsubscribe from the group :)
>
>
> On Mon, Aug 22, 2011 at 10:26 PM, raj Kumar 
> wrote:
>
>> please dont send me messages
>>
>>  --
>> 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] Adobe Interview - 20/08/2011

2011-08-22 Thread Jagannath Prasad Das
for the stick prob is the stick length required?

On Mon, Aug 22, 2011 at 12:48 PM, Jagannath Prasad Das
wrote:

> i think find max and min of all time-stamps respectively
>
>
> On Mon, Aug 22, 2011 at 12:44 PM, saurabh agrawal wrote:
>
>> How did u solved :
>>
>> 3) There is a list containing the checkin and checkout time of every
>> person in a party . The checkin time is in ascending order while the
>> checkout is random .
>>
>> Eg:
>>
>>Check_inCheck_out
>>
>> Person 1 8.00  9.00
>>
>> Person 2 8.15  8.30
>>
>> Person 3 8.30  9.20
>>
>>
>>
>> On Mon, Aug 22, 2011 at 9:14 AM, Decipher  wrote:
>>
>>> Hi,
>>>
>>> This is my Adobe interview experience for freshers :
>>>
>>>  *Written Test:*
>>>
>>> Engineering   – 45 Minutes - Data Structures, Algorithms,
>>> Operating Systems
>>>
>>> C/C++  – 45 Minutes - C/C++ Fundamentals & Coding***
>>> *
>>>
>>> Aptitude– 45 Minutes – Quantitative & Analytical
>>>
>>> * *
>>>
>>> *On clearing the Test, 3 Technical Interviews + HR discussion on the
>>> same day.*
>>>
>>> *
>>> *
>>>
>>> *Interview 1: *
>>>
>>> 1) Insert an element in a linked list at the end , given the *start *
>>> pointer.
>>>
>>> 2) Write a function to Swap pointers .
>>>
>>> 3) There is a list containing the checkin and checkout time of every
>>> person in a party . The checkin time is in ascending order while the
>>> checkout is random .
>>>
>>> Eg:
>>>
>>>Check_inCheck_out
>>>
>>> Person 1 8.00  9.00
>>>
>>> Person 2 8.15  8.30
>>>
>>> Person 3 8.30  9.20
>>>
>>> and so on ...
>>> Now , give an optimized solution to find at what time the maximum number
>>> of people will be in the party . My solution - O(nlogn) time and O(n) space
>>> . He gave another O(nlogn) time and O(n) space solution .
>>>
>>> and some other questions that I can't recal ..
>>>
>>> *Interview 2:*
>>> 1) Base class contains 2 functions and Derived class (with Private
>>> Inheritance from Base) also contains 2 functions (same name as those in Base
>>> cass), then he asked me the effect by changing the Inheritance type and
>>>  making different functions virtual like - virtual func in Base then in
>>> Derived and then both .
>>>
>>> 2) Same question appended- A derived class *A* derived from Derived and
>>> Base , now
>>>
>>> A a = new A;
>>> Base *b =  a;
>>> Derived *d = a;
>>>
>>> b = d;
>>>
>>> and b = (Base *) d;
>>>
>>> then which functions can I call ?
>>>
>>> 3) Convert a tree into its mirror without using extra memory - O(1) space
>>> .
>>>
>>> 4) If an array is rotated a number of unknown times , then how to find an
>>> element in O(log n)
>>>
>>> 5) There are 3 sticks placed at right angles to each other and a sphere
>>> is placed between the sticks . Now another sphere is placed in the gap
>>> between the sticks and Larger sphere . Find the radius of smaller sphere in
>>> terms of radius of larger sphere .
>>>
>>> *This is as far I can remember so please don't ask any questions
>>> regarding it .*
>>>
>>>
>>>  --
>>> 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/-/K0ws20ht-pkJ.
>>> 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] Adobe Interview - 20/08/2011

2011-08-22 Thread Jagannath Prasad Das
i think find max and min of all time-stamps respectively

On Mon, Aug 22, 2011 at 12:44 PM, saurabh agrawal wrote:

> How did u solved :
>
> 3) There is a list containing the checkin and checkout time of every person
> in a party . The checkin time is in ascending order while the checkout is
> random .
>
> Eg:
>
>Check_inCheck_out
>
> Person 1 8.00  9.00
>
> Person 2 8.15  8.30
>
> Person 3 8.30  9.20
>
>
>
> On Mon, Aug 22, 2011 at 9:14 AM, Decipher  wrote:
>
>> Hi,
>>
>> This is my Adobe interview experience for freshers :
>>
>> *Written Test:*
>>
>> Engineering   – 45 Minutes - Data Structures, Algorithms,
>> Operating Systems
>>
>> C/C++  – 45 Minutes - C/C++ Fundamentals & Coding
>>
>> Aptitude– 45 Minutes – Quantitative & Analytical
>>
>> * *
>>
>> *On clearing the Test, 3 Technical Interviews + HR discussion on the same
>> day.*
>>
>> *
>> *
>>
>> *Interview 1: *
>>
>> 1) Insert an element in a linked list at the end , given the *start *
>> pointer.
>>
>> 2) Write a function to Swap pointers .
>>
>> 3) There is a list containing the checkin and checkout time of every
>> person in a party . The checkin time is in ascending order while the
>> checkout is random .
>>
>> Eg:
>>
>>Check_inCheck_out
>>
>> Person 1 8.00  9.00
>>
>> Person 2 8.15  8.30
>>
>> Person 3 8.30  9.20
>>
>> and so on ...
>> Now , give an optimized solution to find at what time the maximum number
>> of people will be in the party . My solution - O(nlogn) time and O(n) space
>> . He gave another O(nlogn) time and O(n) space solution .
>>
>> and some other questions that I can't recal ..
>>
>> *Interview 2:*
>> 1) Base class contains 2 functions and Derived class (with Private
>> Inheritance from Base) also contains 2 functions (same name as those in Base
>> cass), then he asked me the effect by changing the Inheritance type and
>>  making different functions virtual like - virtual func in Base then in
>> Derived and then both .
>>
>> 2) Same question appended- A derived class *A* derived from Derived and
>> Base , now
>>
>> A a = new A;
>> Base *b =  a;
>> Derived *d = a;
>>
>> b = d;
>>
>> and b = (Base *) d;
>>
>> then which functions can I call ?
>>
>> 3) Convert a tree into its mirror without using extra memory - O(1) space
>> .
>>
>> 4) If an array is rotated a number of unknown times , then how to find an
>> element in O(log n)
>>
>> 5) There are 3 sticks placed at right angles to each other and a sphere is
>> placed between the sticks . Now another sphere is placed in the gap between
>> the sticks and Larger sphere . Find the radius of smaller sphere in terms of
>> radius of larger sphere .
>>
>> *This is as far I can remember so please don't ask any questions
>> regarding it .*
>>
>>
>>  --
>> 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/-/K0ws20ht-pkJ.
>> 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] c++

2011-08-21 Thread Jagannath Prasad Das
folks during temporary object creation constructor is called
right..but constructor is called here only 2 times..
According to me,either copy constructor and constructor should have been
called 2 times both or constructor 4 times ..but its neither of
them...paradox

On Sun, Aug 21, 2011 at 9:46 PM, Abhishek Yadav
wrote:

> @jagannath: no its not i am totally confused.
>
>
> On Sun, Aug 21, 2011 at 5:57 PM, priya ramesh <
> love.for.programm...@gmail.com> wrote:
>
>> it is not an error.
>>
>> check this code: I compiled it
>>
>>
>> #include
>> using namespace std;
>>
>> class X
>> {
>> public:
>> X()
>> {
>> }
>> };
>> main(){
>>
>> }
>>
>> X fun()
>> {
>> return X();
>> }
>>
>>  --
>> 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: another q on ds!

2011-08-21 Thread Jagannath Prasad Das
Since long time i am not able to implement a min-stack where in const space
and const time ...
Folks please help meif it is solved then answer is the last
option

On Sun, Aug 21, 2011 at 9:15 PM, Dumanshu  wrote:

> first option is correct. Because we are not allowed to use any extra
> space.
>
> On Aug 21, 6:36 pm, priya ramesh 
> wrote:
> > A "Most efficient data structure" is designed to optimize the following
> > operations. Pop, Push, Min. The best possible time-complexities with no
> > extra space, respectively would be:
> >
> > ·  Pick one of the choices
> >
> > O(1), O(1), O(N)
> >
> > O(1), O(N), O(1)
> >
> > O(N), O(1), O(1)
> >
> > O(1), O(1), O(1)
>
> --
> 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] Math Quiz

2011-08-21 Thread Jagannath Prasad Das
A(OED)=1/4 A(OCB)  from similarity area relationship
A(OED)+A(ODC)=6;
A(ODC)+A(OCB)=12;
solve them
A(OED)=2 sq units

On Sun, Aug 21, 2011 at 12:06 PM, Greeshma  wrote:

> hey got it!
> the ans s 2 :)
>
> --
> 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/-/r4I_8-_6hy8J.
>
> 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] c++

2011-08-21 Thread Jagannath Prasad Das
Copy constructor should have been called two times!!1

On Sun, Aug 21, 2011 at 1:38 PM, Abhishek Yadav
wrote:

> what are you trying to say?...can you please explain?h
>
>
> On Sun, Aug 21, 2011 at 1:35 PM, JAIDEV YADAV  wrote:
>
>> try to use X b = a ; b.fun() ;
>>
>> On Sun, Aug 21, 2011 at 1:33 PM, Abhishek Yadav <
>> algowithabhis...@gmail.com> wrote:
>>
>>> ok...may be i forgot , can you please tell me correct code for the copy
>>> constructor..?
>>>
>>>
>>> On Sun, Aug 21, 2011 at 1:31 PM, JAIDEV YADAV  wrote:
>>>
 dude u haven't used copy constructor properly .. check it out again ...
 you are not copying actually ... thats it ...

 On Sun, Aug 21, 2011 at 12:53 PM, Abhishek Yadav <
 algowithabhis...@gmail.com> wrote:

> Check this code: the thing i couldn't understand is when the object is
> being returned neither the copy constructor is being called nor the
>  assignment operator overload is calledthen how the object is being
> copied into b. i don't think default copy constructor should be called if 
> i
> have made our own copy constructor???
> #include
> using namespace std;
> #include
>
> class X
> {
>   public:
>   int num;
> X(int a)
> {
> num=a;
>  cout<<"\n constructor";
> }
>
> X(const X& t)
>  {
> this->num=t.num;
> cout<<"\nCopy ";
>  }
>
> X operator=(const X& t)
> {
>  this->num =t.num;
> cout<<"\n Assigment   ";
> return t;
>  }
>
> X fun()
> {
>cout<<"\nin fun";
>return X(7);
>  }
>
> ~X()
> {
> cout<<"\ndestruct ";
>  }
>
> };
>
> int main()
> {
> {
> X a(1);
>X b=a.fun();
>cout<<"\n\n"< }
> getch();
> }
>
>
> On Sun, Aug 21, 2011 at 12:33 PM, Abhishek Yadav <
> algowithabhis...@gmail.com> wrote:
>
>> The code is correct..return X will make a temporary object and for
>> that a constructor and corresponding destructor will be called and that
>>  object is returned.
>>
>> On Sun, Aug 21, 2011 at 12:24 PM, Puneet Chawla <
>> puneetchawla...@gmail.com> wrote:
>>
>>> It will show error
>>>
>>> On Sun, Aug 21, 2011 at 12:21 PM, Sanjay Rajpal wrote:
>>>
 I think it will not be an error.

 This is because X() will create a temporary object, and when the
 object is returned in the function calling it, then default copy
 constructor will do bitwise copy of data members in the calling
 function.

 Correct me if m wrong.

 On 8/20/11, sachin sabbarwal  wrote:
 > class X()
 > {
 >
 > X()
 > {
 > }
 >
 >
 >
 > X fun()
 > {
 > return X();  //error or what?? because constructor never
 returns
 > anything so what this return statement will receive after
 executing x() and
 > what it will return??
 > }
 >
 >
 > };
 >
 > --
 > 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.
 >
 >


 --
 Sanju
 :)

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


>>>
>>>
>>> --
>>> With regards
>>>   
>>> Puneet Chawla
>>> Computer Engineering Student
>>> NIT Kurukshetra
>>>
>>>  --
>>> 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 e

Re: [algogeeks] Challenge

2011-08-20 Thread Jagannath Prasad Das
what does sorted row means???
is it
00011
0
1
0
where each row is sorted or among the rows also?
On Sun, Aug 21, 2011 at 9:51 AM, Sanjay Rajpal  wrote:

> hey see this array is not sorted, I forgot to mention this in my first
> post, but cleared this in subsequent posts that the rows in the array are
> sorted.
>
> Plz see above posts.
> Sanju
> :)
>
>
>
> On Sat, Aug 20, 2011 at 9:05 PM, Abhishek 
> wrote:
>
>> will this solution also work for..
>>
>> 
>> 0101
>> 1011
>> 11010100
>> 0100
>> 1001
>> 0111
>> 
>>
>> plz clear your logic bit more..
>>
>> --
>> 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/-/A8HrLEBIIF8J.
>>
>> 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] Amazon question

2011-08-20 Thread Jagannath Prasad Das
@naren:a[i] may exceed array limit.sigsegv error amy result


On Sat, Aug 20, 2011 at 9:08 PM, Naren s  wrote:

>
>
> On Sat, Aug 20, 2011 at 9:07 PM, Naren s  wrote:
>
>> for(i=0 to n)
>> {
>> if(a[abs(a[i])-1]>0)
>> a[abs(a[i])-1] = -a[abs(a[i])-1];
>> else
>> printf("%d",abs(a[i]));
>>
>> }
>>
>> space : o(n)
>> time : o(1)
>>
>>
>>
>> On Fri, Aug 19, 2011 at 12:45 AM, *$*  wrote:
>>
>>> How to find duplicate element (only one element is repeated) from an
>>> array of unsorted positive integers..
>>> time complexity .. O(n)
>>> space .. o(1).
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> *Narayanan S,*
>> B.E., C.S.E., (final year),
>> College Of Engineering Guindy,
>> Anna University,
>> Chennai-25.
>>
>>
>
>
> --
> *Narayanan S,*
> B.E., C.S.E., (final year),
> College Of Engineering Guindy,
> Anna University,
> Chennai-25.
>
>  --
> 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: Amazon question

2011-08-20 Thread Jagannath Prasad Das
Hi folks,
I just thought since the range of the  numbers is not known so can go
this way;
   1.We can find the max number in the array in o(n)=MAX say
   2.Then (MAX(MAX+1))/2-sum(a[1n]) of given
array=S=(a1+a2+.+an)-R
   3. MAX!/prod(a[1...n])=P=(a1*a2*..*an)/R
  where a1,a2..an are the nos apart from nos in the array execpt the
repeated number R from 1MAX
   4.AM>=GM we know this...
   (a1+a2+an)/n >= pow((a1*a2*.an),1/n)
=> k1+R/n >= pow((k2*R),1/n)
 I think computer is good enough to find R ...
Please correct me if i am wrong
cheers
JAGANNATH

On Sat, Aug 20, 2011 at 5:12 PM, aditya kumar
wrote:

> instead of that find sum of first n natural number sum ie (n(n+1))/2.;say
> NSum
> then find the sum of all elements of the array . say ASum
> ASUm - NSum = result (no repeated twice).
>
>
> On Fri, Aug 19, 2011 at 7:30 PM, Sanjay Rajpal 
> wrote:
>
>> :)
>>
>>
>> *Regards
>>
>> Sanju
>>
>> Happy to 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.
>>
>
>  --
> 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] C OUTPUT

2011-07-24 Thread Jagannath Prasad Das
depends on endianess of processor

On Mon, Jul 25, 2011 at 12:22 PM, aditya kumar  wrote:

> thnks all :)
> @rajeev : u are right dats y  *((char*)iPtr+2) will printf 0.
>
>
> On Mon, Jul 25, 2011 at 11:56 AM, ~*~VICKY~*~ wrote:
>
>> Consider the binary representation of 257 which is 10001
>>
>> which will be stored in little endain representation as least significant
>> eight bits + most significant eight bits as follows
>>
>> 0001 | 0001
>>
>> now iptr on casting to char will point to least significant eight bits
>> which is 1, when u increment iptr it refers to most sig 8 bits which is also
>> 1
>>
>> hence the o/p will be : 1 1
>>
>>
>> hope it helps!
>>
>> On Mon, Jul 25, 2011 at 11:41 AM, aditya kumar <
>> aditya.kumar130...@gmail.com> wrote:
>>
>>> main()
>>> {
>>> int i = 257;
>>> int *iPtr = &i;
>>> printf("%d %d", *((char*)iPtr), *((char*)iPtr+1) );
>>> }
>>>
>>> can any one explain me the o/p ??
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Cheers,
>>
>>   Vicky
>>
>>  --
>> 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: posix threads

2011-05-30 Thread jagannath prasad das
@anshu:thats means you say that pthreads are either kernel -level or
hybrid in nature
@lalit:mapping dependsfor user-level kernel isn't aware of
threads,m-m is for kernel-level ,m-n for hybrid
kinda
does anbody knows whether pthreads are user-level or hybrid?

On 5/30/11, anshu mishra  wrote:
> PS dont forget to bind ith thread with ith processor
>
> --
> 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] Amazon online test

2011-05-26 Thread jagannath prasad das
how to register for amazon ol exm .can  you plz mention ?

On Sun, Apr 24, 2011 at 6:46 PM, balaji a  wrote:

> yeah i did.,...there were two section
> Section 1 - some aptitude question + predicting output of a given program +
> some conceptual question(mainly in OS)
> Section 2- programming section...there were three questions
>1)given two sorted linked list u have to return the linked list
> which is the merged list of the first two and also is sorted.
> 2)given two Binary trees, u have to find whether the second is a
> sub tree of the first...
> 3)Given an array which contains integers(may contain thousands of
> elements), u have to write a program to find the second largest element of
> the group
>the first two u can run (i.e) u can check the outputbut
> the third u have to just write the code and u cant check the output
>
>
> On Sun, Apr 24, 2011 at 6:15 PM, JeanGrey wrote:
>
>> Has anyone attended amazon online test recently  ? what will be the
>> type of questions which will be asked?
>>
>> --
>> 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.
>>
>>
>
>
> --
> A.Balaji
>
>  --
> 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: debugging contest

2011-03-23 Thread jagannath prasad das
ascii values da...not 9

On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh  wrote:

> @cegprakash Relax shut down your computer for some time and switch on your
> i-pod.:)
>
> On Wed, Mar 23, 2011 at 8:39 PM, saurabh singh wrote:
>
>> @cegprakash Relax shut down your computer for some time and switch on your
>> i-pod.:)
>>
>>
>>
>> On Wed, Mar 23, 2011 at 8:37 PM, cegprakash  wrote:
>>
>>> now i got it.. first it checks whether it matches with any case. If it
>>> matches it starts executing from that case until it encounters a
>>> break.
>>> if it doesn't matches with any case then it starts executing from
>>> default and starts executing until a break.
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Saurabh Singh
>> B.Tech (Computer Science)
>> MNNIT ALLAHABAD
>>
>>
>>
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> 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.



Re: [algogeeks] Amazon Question

2011-03-03 Thread jagannath prasad das
@ankit sinha:i dont think the algo u wrote is o(logn).its o(N) i guess

On Thu, Mar 3, 2011 at 7:05 PM, Ankit Sinha  wrote:

> @sukhmeet, as per the question, there is a unique value which satisfy
> a[i] = i in the array and written code captures that only. Else we
> need to modify if we are interested in all such values which statisfy
> the said condition. And also in that case looping around bsearch will
> not be a good idea.. it will be better to go for simple loop in o(n)
> time as every time mid calculation is also costly. I agreed to Arpit
> view point and accordingly did coding as preetika needed as per arpit
> comments.
>
> Cheers!!
> Ankit
>
> On Thu, Mar 3, 2011 at 6:53 PM, sukhmeet singh 
> wrote:
> > what should be the answer for this:
> > if A={0,1,2,4,5}
> > 0 or 1 or 2
> > On Thu, Mar 3, 2011 at 6:26 PM, Ankit Sinha  wrote:
> >>
> >> Hi,
> >>
> >> Here is the code to do this using Bsearch in o(logn) time.
> >>
> >> int BsearchElemEqualIndex (int *a, int start, int end)
> >> {
> >>int mid = (((end - start) >> 1) + start);
> >>if (a[mid] == mid)
> >>return a[mid];
> >>else if (a[mid] != mid)
> >>{
> >>if (mid == start || mid == end)
> >>{
> >>return -1;
> >>}
> >>else
> >>{
> >>BsearchElemEqualIndex (a, start, mid);
> >>BsearchElemEqualIndex (a, mid + 1, end);
> >>}
> >>}
> >> }
> >>
> >> int _tmain(int argc, _TCHAR* argv[])
> >> {
> >>int a[SIZE] = {5,9,3,8,1,2,6,7};
> >>int x = BsearchElemEqualIndex (a, 0, SIZE);
> >>printf ("%d", x);
> >>system ("PAUSE");
> >>return 0;
> >> }
> >>
> >> Cheers,
> >> Ankit!!!
> >>
> >> On Thu, Mar 3, 2011 at 11:04 AM, Param10k 
> wrote:
> >> > There is a sorted array and you have to write a fn to find a number in
> >> > the array which satisfies
> >> >
> >> > A[i] = i ; where A is the array and i is the index...
> >> >
> >> > - Param
> >> > http://teknotron-param.blogspot.com/
> >> >
> >> > --
> >> > 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.



Re: [algogeeks] Re: Tough Problem of Probability ..Surely Will Stuck ..So Think More & More

2011-03-02 Thread jagannath prasad das
@rajesgeeks:i think probability of sucess of 2nd game is 2(x^2(1-x))+x^2
becoz as explained below:
1.HH...so success in 2 shots no need of 3rd one
2.HFH
3.FHH
where H-hit the hoop.
  F-failed to hit the hoop.

On Wed, Mar 2, 2011 at 7:20 PM, rajessge...@yahoo.com  wrote:

> let p be the probability
>
> second game success probability is
> 3*[x^2(1-x)]+x^2
>
> first game success probability is
> x
>
> find for which x ,3*[x^2(1-x)]+x^2 and for which x ,3*[x^2(1-x)]+x^2>x,this case game2 preffreed
>
>
>
>
> On Mar 2, 4:15 am, bittu  wrote:
> > You have a basketball hoop and someone says that you can play 1 of 2
> > games.
> > Game #1: You get one shot to make the hoop.
> > Game #2: You get three shots and you have to make 2 of 3 shots.
> > If p is the probability of making a particular shot, for which values
> > of p should you pick one game or the other?
> >
> > Thanks & Regards
> > Shashank
>
> --
> 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] extendible hashing

2011-02-17 Thread jagannath prasad das
@ashish goel:can you plz give the link

On Mon, Feb 14, 2011 at 9:00 AM, Ashish Goel  wrote:

> check on code.google.com
>
> a very nice code there, that i had picked 1 yr back...you may like to
> "find"
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
> On Wed, Feb 9, 2011 at 1:18 PM, jagannath  wrote:
>
>> i want to implement extendible hashing for may major project.so the
>> crux of the problem is to directly access the disk block without using
>> the undelying os file system interface.one idea which comes to my mind
>> is to build a virtual file system interface for my project but
>> currently i want to avoid that.so is there any API in unix or windows
>> which can do the job or is there any existing file system which uses
>> the extendible hashing in its implementation.please help its urgent.
>>
>> --
>> 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: question at K10

2011-02-15 Thread jagannath prasad das
void change()
{
   #define i i=10,n
}
this will do..

On Tue, Feb 15, 2011 at 11:33 PM, Rel Guzman Apaza wrote:

> Nothing... 10 in base 5   =   5 in base 10.
>
> void change(){
> printf(""); //...?
> }
>
> 2011/2/15 Don 
>
> A semicolon is valid in the middle of a line in C or C++.
>>
>> For instance, no one says that
>>
>> for(i = 0; i < 10; ++i)
>>
>> is three lines of code.
>>
>> Don
>>
>> On Feb 15, 11:31 am, jalaj jaiswal  wrote:
>> > after termination of semicolon , that will be considered a separate line
>> i
>> > guess
>> >
>> >
>> >
>> > On Tue, Feb 15, 2011 at 10:59 PM, Don  wrote:
>> > > void change()
>> > > {
>> > >  printf("10"); while(1) {}
>> > > }
>> >
>> > > On Feb 15, 10:17 am, Balaji S  wrote:
>> > > > Insert only one line in the function change() so that the output of
>> the
>> > > > program is 10.
>> > > > You are not allowed to use exit(). You are not allowed to edit the
>> > > function
>> > > > main() or to
>> > > > pass the parameter to change()
>> >
>> > > > void change()
>> > > > {
>> > > > // Code here}
>> >
>> > > > int main()
>> > > > {
>> > > > int i=5;
>> > > > change();
>> > > > printf(“%d” ,i);
>> > > > return 0;
>> >
>> > > > }
>> >
>> > > --
>> > > 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.
>> >
>> > --
>> > With Regards,
>> > *Jalaj Jaiswal* (+919019947895)
>> > Software developer, Cisco Systems
>> > B.Tech IIIT 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.
>

-- 
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] What is the error in the following function

2011-02-15 Thread jagannath prasad das
here start is pointing to string constant which is created in read-only
memory which can't be changed.so modifying it in the for loop causes
segmentation fault
declare it as a array type

On Tue, Feb 15, 2011 at 12:36 PM, rahul  wrote:

> char *start is const char *start, pointer to const char, u can't derefernce
> it and change it.
> take a char start[256].try this.
>
>
> On Tue, Feb 15, 2011 at 12:31 PM, dinesh bansal wrote:
>
>> Hi All,
>>
>> Can you please point me to the error in the following function. It gives
>> segmentation fault.
>>
>> int main()
>> {
>> char *start = "12.12.12.12.12976665176069214";
>> char *hex_buf = "65003a0a";
>> unsigned short i, j = 0;
>> int new_len2 = strlen(hex_buf);
>> for (i = 0; ((j+1) < new_len2); i+=2,j+=2)
>> {
>> start[i] = hex_buf[j];
>> start[i+1] = hex_buf[j+1];
>> }
>> }
>>
>> Thanks,
>> --
>> Dinesh Bansal
>> 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.
>>
>
>  --
> 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]

2011-02-13 Thread jagannath prasad das
1.Let the time taken to switch between user and kernel modes of execution be
t1
while the time taken to switch between two processes be t2. Which of the
following is TRUE?
(A) t1 > t2
(B) t1 = t2
(C) t1 < t2
(D) Nothing can be said about the relation between t1 and t2
2.Let P be a regular language and Q be a context free language such that Q ⊆
P.
(For example, let P be the language represented by the regular expression
p*q*
and Q be pnqn | n ∈ N ). Then which of the following is ALWAYS regular?
{
(A) P ∩ Q
}
(B) P − Q
(C) ∑ * − P
(D) ∑ * − Q
3.An algorithm to find the length of the longest monotonically increasing
sequence
of numbers in an array A 0 : n − 1 is given below.


Let Li denote the length of the longest monotonically increasing sequence
starting
at index i in the array
Initialize Ln-1 =1
For all i such that 0 ≤ i ≤ n − 2
Li =
{
1 + L i + 1 if A [i] < A [i + 1]
1
Otherwise
Finally the length of the longest monotonically increasing
Max (L 0 ,L1 ,...,Ln−1 ) . Which of the following statements is TRUE?
sequence
is
(A) The algorithm uses dynamic programming paradigm
(B) The algorithm has a linear complexity and uses branch and bound paradigm
(C) The algorithm has a non-linear polynomial complexity and uses branch and
bound paradigm
(D) The algorithm uses divide and conquer paradigm.
4.HTML (Hyper Text Markup Language) has language elements which permit
certain actions other than describing the structure of the web document.
Which
one of the following actions is NOT supported by pure HTML (without any
server
or client side scripting) pages?
(A) Embed web objects from different sites into the same page
(B) Refresh the page automatically after a specified interval
(C) Automatically redirect to another page upon download
(D) Display the client time as part of the page
GATE 2011 CS  please answer them


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

2011-02-11 Thread jagannath prasad das
i wanted the source code not this..anyway thanks..

On Sat, Feb 12, 2011 at 1:46 AM, Gene  wrote:

> This is a very lame question. Type "Berkeley DB" into Google. The 3rd
> listing is Berkeley DB downloads at Oracle:
>
> http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html
>
>
> Wouldn't it have been easier to do this than to write back to the group?
> It certainly would have been quicker.
>
>
> --
> 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] extendible hashing

2011-02-11 Thread jagannath prasad das
how to access berkley DB any source

On Fri, Feb 11, 2011 at 4:01 PM, jagannath prasad das
wrote:

> can u plz give the link or any source codes if possible.thanx in
> advance
>
>
> On Fri, Feb 11, 2011 at 6:35 AM, Gene  wrote:
>
>> If I remember correctly Berkeley DB uses an extensible hashing system or
>> did at one time.  This is not part of the OS API, but rather a library that
>> runs in user space.
>>
>> I've used the B-tree parts of Berkeley DB, though never the hash table.
>>  Performance and reliability have been extremely good in a product that's
>> running 24x7 on a server in 6 instances for 8 years now.  Never a hiccup.
>>
>>
>>
>>
>> --
>> 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] extendible hashing

2011-02-11 Thread jagannath prasad das
can u plz give the link or any source codes if possible.thanx in
advance

On Fri, Feb 11, 2011 at 6:35 AM, Gene  wrote:

> If I remember correctly Berkeley DB uses an extensible hashing system or
> did at one time.  This is not part of the OS API, but rather a library that
> runs in user space.
>
> I've used the B-tree parts of Berkeley DB, though never the hash table.
>  Performance and reliability have been extremely good in a product that's
> running 24x7 on a server in 6 instances for 8 years now.  Never a hiccup.
>
>
>
>
> --
> 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] extendible hashing

2011-02-09 Thread jagannath prasad das
guys someone help me out..its urgent

On Wed, Feb 9, 2011 at 1:18 PM, jagannath  wrote:

> i want to implement extendible hashing for may major project.so the
> crux of the problem is to directly access the disk block without using
> the undelying os file system interface.one idea which comes to my mind
> is to build a virtual file system interface for my project but
> currently i want to avoid that.so is there any API in unix or windows
> which can do the job or is there any existing file system which uses
> the extendible hashing in its implementation.please help its urgent.
>
> --
> 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: c programming question

2011-02-07 Thread jagannath prasad das
i also think the same as 14 and 15
On Mon, Feb 7, 2011 at 6:40 PM, tech rascal  wrote:

> @ anand: I didn't understand
> in printf, u r evaluating the values frm right to left n thn while
> printing, u hv to print the evaluated values, y u r again evaluating the
> values while u r printing frm left to right??
>
> as in,  u said-
>
> "Now it try to display the value from left to right which makes a++ as 13,
> then a has 14 and ++a as 14"
>
> so it has to beacc. to ua++ as 13, thn a as 14 and thn ++a shd b 15
> thn.
>
> On Mon, Feb 7, 2011 at 11:01 AM, jagannath prasad das  > wrote:
>
>> @juver:in f(a)+f(b) i guess f(a) is evaluated first because fucntion calls
>> are evaluated from left to right
>>
>>
>> On Mon, Feb 7, 2011 at 10:37 AM, Anand  wrote:
>>
>>> a++ when it gets printed. it is 13 and now it gets increment to 14. So
>>> now if you print a it will 14.
>>>
>>>
>>> On Sun, Feb 6, 2011 at 9:04 PM, jagannath prasad das <
>>> jpdasi...@gmail.com> wrote:
>>>
>>>> @anand:while printing post fix gave 13 but rest two why 14
>>>>
>>>> On Mon, Feb 7, 2011 at 10:28 AM, Anand  wrote:
>>>>
>>>>> int a=10,b;
>>>>> b=a++ + ++a; (Till here I think it is clear the value of a is 12 and b
>>>>> = 22)
>>>>> printf("%d,%d,%d,%d",b,a++,a,++a);   (Evaluate from right to left. So
>>>>> ++a makes the value of a as 13, then a  and then a++ which is post 
>>>>> increment
>>>>> still makes a as 13)
>>>>> Now it try to display the value from left to right which makes a++ as
>>>>> 13, then a has 14 and ++a as 14
>>>>>
>>>>> I hope it is clear.
>>>>>
>>>>>
>>>>> On Sun, Feb 6, 2011 at 8:40 PM, jagannath prasad das <
>>>>> jpdasi...@gmail.com> wrote:
>>>>>
>>>>>> ya i also want the explaination of gcc compiler output...thanx in
>>>>>> advance
>>>>>>
>>>>>> On Sun, Feb 6, 2011 at 10:13 AM, tech rascal >>>>> > wrote:
>>>>>>
>>>>>>> but can nybody explain why the output is coming like this on gcc
>>>>>>> compiler??
>>>>>>> On Sun, Feb 6, 2011 at 10:04 AM, Manish Verma <
>>>>>>> monsieur@gmail.com> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> i think juver has explained
>>>>>>>> On Feb 5, 9:34 pm, jagannath prasad das 
>>>>>>>> wrote:
>>>>>>>> > @manish:can you explain with the example of a specific compiler...
>>>>>>>> >
>>>>>>>> > On Sat, Feb 5, 2011 at 10:02 PM, jagannath prasad das
>>>>>>>> > wrote:
>>>>>>>> >
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > > @ankit:ans is 22 13 14 14 in gcc compiler.
>>>>>>>> >
>>>>>>>> > > On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma <
>>>>>>>> monsieur@gmail.com>wrote:
>>>>>>>> >
>>>>>>>> > >> answer will depend on your compiler.
>>>>>>>> >
>>>>>>>> > >> On Feb 5, 1:02 am, jagannath prasad das 
>>>>>>>> wrote:
>>>>>>>> > >> > *#include
>>>>>>>> > >> > void main(void)
>>>>>>>> > >> > {
>>>>>>>> > >> > int a=10,b;
>>>>>>>> > >> > b=a++ + ++a;
>>>>>>>> > >> > printf("%d,%d,%d,%d",b,a++,a,++a);
>>>>>>>> >
>>>>>>>> > >> > }
>>>>>>>> >
>>>>>>>> > >> > *what is the answer?how are the function parameters passed on
>>>>>>>> the stack?
>>>>>>>> >
>>>>>>>> > >> --
>>>>>>>> > >> You received this message because you are subscribed to the
>>>>>>>> Google Groups
>>>>>>>> > >> "Algorithm Geeks" group.
>>>>>>>> > >> To post 

Re: [algogeeks] array(amazon && microsoft)

2011-02-07 Thread jagannath prasad das
u can merge first two rows and proceed two at time.then slowly merge 4 at a
tym and so on.a recursive algo will do

On Mon, Feb 7, 2011 at 6:25 PM, Ashish Goel  wrote:

> yet to test...
> will download xcode to compile, not on linux or windows (:
>
> remote case of all both entries in last row or last col needs to be
> looked..
>
> int ai=1; int bi=0;int aj=0; int bj=1;
> int row = 0; int col=0;
> printf("%d \n", a[0][0]);
> while ((ai {
> if (arr[ai][aj] {
>printf("%d \n", a[ai][aj]);
>ai++;
>if (!(ai {
> ai=row+1;
> aj=++col;
> }
> }
> else
> {
>printf("%d \n", a[bi][bj]);
>bj++;
>if (!(bj {
> bi=++row;
> bj=col+1;
> }
> }
> }
>
>
>
>
>
>
>
>
>
> }
> Best Regards
> Ashish Goel
> "Think positive and find fuel in failure"
> +919985813081
> +919966006652
>
>
>
> On Mon, Feb 7, 2011 at 2:20 PM, jalaj jaiswal 
> wrote:
>
>> here is the counter example.. below every row is sorted and every column
>> is sorted
>>
>> 0 2 3 4
>> 0 3 4 5
>> 1 4 5 6
>> 2 5 6 7
>>
>>
>> On Mon, Feb 7, 2011 at 2:17 PM, Rajiv Podar wrote:
>>
>>> Printing in the normal order will print the sorted output. starting
>>> from Value[0][0] to value [m][n].
>>> OR
>>> Please provide a e.g. array which need to be printed if I am wrong.
>>>
>>> Thanks & Regards,
>>> Rajiv Podar
>>>
>>>
>>> On Mon, Feb 7, 2011 at 2:13 PM, jalaj jaiswal >> > wrote:
>>>
 You are given a array with rows sorted and column sorted. You have to
 print entire array in sorted order.



 --
 With Regards,
 *Jalaj Jaiswal* (+919019947895)
 Software developer, Cisco Systems
 Final Year Undergraduate,
 IIIT 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.
>>>
>>
>>
>>
>> --
>> With Regards,
>> *Jalaj Jaiswal* (+919019947895)
>> Software developer, Cisco Systems
>> Final Year Undergraduate,
>> IIIT 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.
>

-- 
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: C++ Riddle

2011-02-06 Thread jagannath prasad das
bit operation means what?

On Mon, Feb 7, 2011 at 12:00 PM, Rajiv Podar  wrote:

> @Dave: ++ and -- are arithmetic operations.
> @Jalaj: I agree with the above solution
>
>
> Thanks & Regards,
> Rajiv Podar
>
>
>
> On Mon, Feb 7, 2011 at 11:47 AM, jalaj jaiswal 
> wrote:
>
>> try this
>>
>> let nos be m & n
>>
>> char * p;
>> p=m;
>> int sum = (int)&p[n] ;
>>
>> sum is m+n  :)
>>
>>
>> On Mon, Feb 7, 2011 at 11:41 AM, Dave  wrote:
>>
>>> @Ricky: if increment and decrement operators are not considered
>>> arithmetic, try
>>>
>>> int sum(int m, int n)
>>> {
>>>while( m > 0 )
>>>{
>>>m--;
>>>n++;
>>>}
>>>while( m < 0 )
>>>{
>>>m++;
>>>n--;
>>>}
>>>return n;
>>> }
>>>
>>> On Feb 6, 11:49 pm, Ricky  wrote:
>>> > write the program to add two numbers without using arithmetic and bit
>>> > operation..
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> With Regards,
>> *Jalaj Jaiswal* (+919019947895)
>> Final Year Undergraduate,
>> IIIT 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.
>

-- 
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: Good question

2011-02-06 Thread jagannath prasad das
@rajiv:i guess obj is a pointer here

On Mon, Feb 7, 2011 at 10:51 AM, Rajiv Podar  wrote:

> Hi
> Try following code
>
> Suppose  we need to find size of variable *"obj"*
> int size = (char*)(obj +1 ) - (char*)(obj);
>
> *
> *Thanks & Regards,
> Ricky
>
>
>
> On Mon, Feb 7, 2011 at 12:19 AM, albert theboss 
> wrote:
>
>> using this macro
>>
>> size(X)  ((X*)0+1)
>>
>>
>>
>> if we give size(int)  it ll return 4.
>> size(double)  gives 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.
>>
>
>  --
> 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: c programming question

2011-02-06 Thread jagannath prasad das
@juver:in f(a)+f(b) i guess f(a) is evaluated first because fucntion calls
are evaluated from left to right

On Mon, Feb 7, 2011 at 10:37 AM, Anand  wrote:

> a++ when it gets printed. it is 13 and now it gets increment to 14. So now
> if you print a it will 14.
>
>
> On Sun, Feb 6, 2011 at 9:04 PM, jagannath prasad das 
> wrote:
>
>> @anand:while printing post fix gave 13 but rest two why 14
>>
>> On Mon, Feb 7, 2011 at 10:28 AM, Anand  wrote:
>>
>>> int a=10,b;
>>> b=a++ + ++a; (Till here I think it is clear the value of a is 12 and b =
>>> 22)
>>> printf("%d,%d,%d,%d",b,a++,a,++a);   (Evaluate from right to left. So ++a
>>> makes the value of a as 13, then a  and then a++ which is post increment
>>> still makes a as 13)
>>> Now it try to display the value from left to right which makes a++ as 13,
>>> then a has 14 and ++a as 14
>>>
>>> I hope it is clear.
>>>
>>>
>>> On Sun, Feb 6, 2011 at 8:40 PM, jagannath prasad das <
>>> jpdasi...@gmail.com> wrote:
>>>
>>>> ya i also want the explaination of gcc compiler output...thanx in
>>>> advance
>>>>
>>>> On Sun, Feb 6, 2011 at 10:13 AM, tech rascal 
>>>> wrote:
>>>>
>>>>> but can nybody explain why the output is coming like this on gcc
>>>>> compiler??
>>>>> On Sun, Feb 6, 2011 at 10:04 AM, Manish Verma 
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> i think juver has explained
>>>>>> On Feb 5, 9:34 pm, jagannath prasad das  wrote:
>>>>>> > @manish:can you explain with the example of a specific compiler...
>>>>>> >
>>>>>> > On Sat, Feb 5, 2011 at 10:02 PM, jagannath prasad das
>>>>>> > wrote:
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > > @ankit:ans is 22 13 14 14 in gcc compiler.
>>>>>> >
>>>>>> > > On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma <
>>>>>> monsieur@gmail.com>wrote:
>>>>>> >
>>>>>> > >> answer will depend on your compiler.
>>>>>> >
>>>>>> > >> On Feb 5, 1:02 am, jagannath prasad das 
>>>>>> wrote:
>>>>>> > >> > *#include
>>>>>> > >> > void main(void)
>>>>>> > >> > {
>>>>>> > >> > int a=10,b;
>>>>>> > >> > b=a++ + ++a;
>>>>>> > >> > printf("%d,%d,%d,%d",b,a++,a,++a);
>>>>>> >
>>>>>> > >> > }
>>>>>> >
>>>>>> > >> > *what is the answer?how are the function parameters passed on
>>>>>> the stack?
>>>>>> >
>>>>>> > >> --
>>>>>> > >> 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
>>

Re: [algogeeks] Re: c programming question

2011-02-06 Thread jagannath prasad das
@anand:while printing post fix gave 13 but rest two why 14

On Mon, Feb 7, 2011 at 10:28 AM, Anand  wrote:

> int a=10,b;
> b=a++ + ++a; (Till here I think it is clear the value of a is 12 and b =
> 22)
> printf("%d,%d,%d,%d",b,a++,a,++a);   (Evaluate from right to left. So ++a
> makes the value of a as 13, then a  and then a++ which is post increment
> still makes a as 13)
> Now it try to display the value from left to right which makes a++ as 13,
> then a has 14 and ++a as 14
>
> I hope it is clear.
>
>
> On Sun, Feb 6, 2011 at 8:40 PM, jagannath prasad das 
> wrote:
>
>> ya i also want the explaination of gcc compiler output...thanx in
>> advance
>>
>> On Sun, Feb 6, 2011 at 10:13 AM, tech rascal wrote:
>>
>>> but can nybody explain why the output is coming like this on gcc
>>> compiler??
>>> On Sun, Feb 6, 2011 at 10:04 AM, Manish Verma wrote:
>>>
>>>>
>>>> i think juver has explained
>>>> On Feb 5, 9:34 pm, jagannath prasad das  wrote:
>>>> > @manish:can you explain with the example of a specific compiler...
>>>> >
>>>> > On Sat, Feb 5, 2011 at 10:02 PM, jagannath prasad das
>>>> > wrote:
>>>> >
>>>> >
>>>> >
>>>> > > @ankit:ans is 22 13 14 14 in gcc compiler.
>>>> >
>>>> > > On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma <
>>>> monsieur@gmail.com>wrote:
>>>> >
>>>> > >> answer will depend on your compiler.
>>>> >
>>>> > >> On Feb 5, 1:02 am, jagannath prasad das 
>>>> wrote:
>>>> > >> > *#include
>>>> > >> > void main(void)
>>>> > >> > {
>>>> > >> > int a=10,b;
>>>> > >> > b=a++ + ++a;
>>>> > >> > printf("%d,%d,%d,%d",b,a++,a,++a);
>>>> >
>>>> > >> > }
>>>> >
>>>> > >> > *what is the answer?how are the function parameters passed on the
>>>> stack?
>>>> >
>>>> > >> --
>>>> > >> 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.
>

-- 
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: c programming question

2011-02-06 Thread jagannath prasad das
ya i also want the explaination of gcc compiler output...thanx in
advance

On Sun, Feb 6, 2011 at 10:13 AM, tech rascal wrote:

> but can nybody explain why the output is coming like this on gcc compiler??
>
> On Sun, Feb 6, 2011 at 10:04 AM, Manish Verma wrote:
>
>>
>> i think juver has explained
>> On Feb 5, 9:34 pm, jagannath prasad das  wrote:
>> > @manish:can you explain with the example of a specific compiler...
>> >
>> > On Sat, Feb 5, 2011 at 10:02 PM, jagannath prasad das
>> > wrote:
>> >
>> >
>> >
>> > > @ankit:ans is 22 13 14 14 in gcc compiler.
>> >
>> > > On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma > >wrote:
>> >
>> > >> answer will depend on your compiler.
>> >
>> > >> On Feb 5, 1:02 am, jagannath prasad das  wrote:
>> > >> > *#include
>> > >> > void main(void)
>> > >> > {
>> > >> > int a=10,b;
>> > >> > b=a++ + ++a;
>> > >> > printf("%d,%d,%d,%d",b,a++,a,++a);
>> >
>> > >> > }
>> >
>> > >> > *what is the answer?how are the function parameters passed on the
>> stack?
>> >
>> > >> --
>> > >> 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] Re: c programming question

2011-02-05 Thread jagannath prasad das
@manish:can you explain with the example of a specific compiler...

On Sat, Feb 5, 2011 at 10:02 PM, jagannath prasad das
wrote:

> @ankit:ans is 22 13 14 14 in gcc compiler.
>
>
> On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma wrote:
>
>> answer will depend on your compiler.
>>
>> On Feb 5, 1:02 am, jagannath prasad das  wrote:
>> > *#include
>> > void main(void)
>> > {
>> > int a=10,b;
>> > b=a++ + ++a;
>> > printf("%d,%d,%d,%d",b,a++,a,++a);
>> >
>> > }
>> >
>> > *what is the answer?how are the function parameters passed on the stack?
>>
>> --
>> 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: c programming question

2011-02-05 Thread jagannath prasad das
@ankit:ans is 22 13 14 14 in gcc compiler.

On Sat, Feb 5, 2011 at 7:24 PM, Manish Verma  wrote:

> answer will depend on your compiler.
>
> On Feb 5, 1:02 am, jagannath prasad das  wrote:
> > *#include
> > void main(void)
> > {
> > int a=10,b;
> > b=a++ + ++a;
> > printf("%d,%d,%d,%d",b,a++,a,++a);
> >
> > }
> >
> > *what is the answer?how are the function parameters passed on the stack?
>
> --
> 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] c programming question

2011-02-04 Thread jagannath prasad das
*#include
void main(void)
{
int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
}

*what is the answer?how are the function parameters passed on the stack?

-- 
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: Lookup in a table...

2010-11-15 Thread jagannath prasad das
i guess you dont require first hash at all.create a hash map
that maps a letter to a set of keys now once you have all your sets you can
just compare the input set with your the formed sets...

On Tue, Nov 16, 2010 at 8:51 AM, Gene  wrote:

> Your description is imprecise.  I guess you mean the answer is "B,"
> not "D" as you said.  The following may be based on an improper
> reading of your description.  For example I'm assuming that each
> letter maps to each int at most once.  And each set of ints maps to
> exactly one letter.
>
> Your method is on the right track, but you're missing the punch line.
>
> Read the input and use it to create a hash that maps letters to sets
> of integers.  As you read a pair n|X, add n to the set corresponding
> to the letter X.
>
> After you've read all the data, make a pass over the first hash to
> create a second hash that maps sets of integers to letters.
>
> Looking up sets in this will require O(k) where k is the length of the
> integer set being looked up, i.e. the cost of computing the hash
> function.
>
> Here is a little Perl program that does all this. Perl is not a great
> language choice because the only way to hash the integer sets is to
> convert to a string. Java and similar hash containers will let you do
> the hashing without a type conversion, which is more efficient.
>
> use strict;
>
> our $ltr_to_iset = {};
> our $iset_to_ltr = {};
>
> sub build_tables {
>while (<>) {
>my ($i, $ltr) = /(\d+)\|([a-z]+)/i;
>push @{$ltr_to_iset->{$ltr}}, int($i);
>}
>while ( my ($ltr, $iset) = each(%$ltr_to_iset) ) {
>$iset_to_ltr->{ join(",", sort { $a <=> $b } @$iset) } = $ltr;
>}
> }
>
> sub lookup {
>my $iset = shift;
>return $iset_to_ltr->{ join(",", sort { $a <=> $b } @$iset) };
> }
>
> sub main {
>build_tables;
>print lookup([2,1,4,3,5]) . "\n";
>print lookup([1,2,3,4,6]) . "\n";
> }
>
> main;
>
> genes-macbook-pro:Projects$ perl lu.pl < data.txt
> A
> B
>
>
> On Nov 15, 9:53 am, vaibhav agrawal  wrote:
> > Hello All,
> >
> > I have a problem, which needs to be solved for lesser time complexity.
> Here
> > it goes:
> >
> > There is a file having two columns: id and key as under:
> > 1|A
> > 2|A
> > 3|A
> > 4|A
> > 5|A
> > 1|B
> > 2|B
> > 3|B
> > 4|B
> > 6|B
> > and so on...
> >
> > Now, we want to lookup a bunch of ids(constant 5) to get a key, that
> means
> > if we lookup on id as {2,1,4,3,6}, then we should get return key as 'D'
> and
> > so on...
> >
> > I am proposing a solution for this as under:
> > Construct two hashes:
> > First hash(based on above data):(Hash Key=>Hash Set)
> > 1=>{A,B}
> > 2=>{A,B}
> > 3=>{A,B}
> > 4=>{A,B}
> > 5=>{A}
> > 6=>{B}
> >
> > Second hash(based on above data):(Hash Key=>Hash Set)
> > A=>{1,2,3,4,5}
> > B=>{1,2,3,4,6}
> >
> > Now, for the given example ids as {2,1,4,3,6}, we will start looking up
> > first element '2' into first hash, and got the list {A,B}, so the desired
> > key could be either A or B.
> > Now, let's consider A first using second hash, we got a list of ids
> > {1,2,3,4,5}, now match these ids with the inputted bunch(2,1,4,3,6},
> which
> > is not matching. Now consider B, which got list of ids as (1,2,3,4,6},
> which
> > matches with the input and hence the answer is B.
> >
> > Is there any way in which it can be further optimized for speed?
> >
> > Thanks,
> > Vaibhav
>
> --
> 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: tree Samsung Question

2010-11-15 Thread jagannath prasad das
linked representation...for k-ary trees use sibling and
lchild pntr...arrays can lead to memory wastage .Moreover arrays
have to be statically allocated

On Mon, Nov 15, 2010 at 2:32 AM, Ruturaj  wrote:

> Since its a data structure, we need to root the tree. Plus my
> suggestion will only work for directed trees. all children point to
> their parents.
>
> for a node i, if its parent is j a[i]=j
> a[root] = -1
>
> this can store a tree pretty fast.
>
>
> else normally we can use a linked list etc.
>
> On Nov 14, 11:53 pm, bittu  wrote:
> > which data structure is best & used to implmets the  tree
> >
> > Regards
> > Shashank
>
> --
> 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] Brain Teaser

2010-11-11 Thread jagannath prasad das
4 8 3 7
2 6 1 5

On Thu, Nov 11, 2010 at 5:57 PM, sunny agrawal wrote:

> @rohit
> 4 5 are  diagonally adjacent .
>
> On Thu, Nov 11, 2010 at 5:09 PM, Rohit Singhal 
> wrote:
>
>> 1 5 2 6
>>
>> - - - - - -
>>
>> 3 7 4 8
>>
>>
>> On Thu, Nov 11, 2010 at 3:16 PM, Abhilasha jain > > wrote:
>>
>>> solution is
>>> 5 1 6 2
>>> _ _ _ _
>>>
>>> 7 3 8 4
>>>
>>>
>>> On Thu, Nov 11, 2010 at 1:26 PM, Amod  wrote:
>>>
 We have a rectangle
 It is divided in eight parts by three vertical and one horizontal line

>>>
>>>
 so that there are 8 chambers.
 Now we have numbers from 1-8 to be filled in these chambers.
 Rule : No two consecutive numbers must be present either side to side
 or diagonal
 Invalid situation example
 Given 5 at position 2 then 4 cannot occur at any of the give position.
 4 5 4
 _ _ _ _

 4 4 4
 _ _ _ _

 --
 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.
>>>
>>
>>
>>
>> --
>> Rohit Singhal
>> B.Tech. Part-IV,
>> Department Of Electronics Engineering,
>> Centre of Advanced Studies,
>> Institute Of Technology, BHU
>>
>> --
>> 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.
>>
>
>
>
> --
> Sunny Aggrawal
> B-Tech IV year,CSI
> Indian Institute Of Technology,Roorkee
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to 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: please explain the output

2010-11-07 Thread jagannath prasad das
answer is 17i got in gcc comp

On Sun, Nov 7, 2010 at 7:23 PM, Piyush  wrote:

> C standard says that between two sequence points object's stored value can
> be modified only once ( by evaluation of expression),
> A sequence point occurs in following conditions:
> 1. at the end of full expression. ( the case for your answer)
> 2. at the && , || , ?: operators
> 3. at a function call (after the evaluation of all arguments i.e just
> before the actual call)
>
> Since the value of your variable is getting modified more than once between
> the two sequence points the result is undefined.
>
>
> On Sun, Nov 7, 2010 at 5:33 PM, siva viknesh wrote:
>
>> i compiled .. the answer is 17 !! ... its 5+5+7 ..evaluate from left
>> to right
>>
>> On Nov 6, 8:42 pm, bipul21  wrote:
>> > #include
>> > int main()
>> > {
>> >int a=5;
>> > a=a+(a++)+(++a);
>> > printf("%d",a);
>> > return 0;}
>> >
>> > answer is 19 but how??
>>
>> --
>> 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.