@Utkarsh:  In Yogesh's code assigning a[1] to largest and second_largest in
the beginning, -VE case will be handled.

On Mon, Sep 19, 2011 at 12:10 PM, asdqwe <ayushgoel...@gmail.com> wrote:

> @Yogesh:fails for negative numbers..
>
> (though I am also confused with the ques)
>
> On Sep 19, 10:38 am, Yogesh Yadav <medu...@gmail.com> wrote:
> > current position is index n (say)
> > largest=0;
> > second_largest=0;
> >
> > for(i=1;i<=n;i++)
> > {
> > if(a[i]>a[n])
> > {
> > if(a[i]>largest)
> > {
> > second_largest=largest;
> > largest=a[i];}
> >
> > elseif(a[i]>second_largest)
> > second_largest=a[i];
> >
> > }
> > }
> >
> > ....
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Sep 19, 2011 at 2:15 AM, sagar pareek <sagarpar...@gmail.com>
> wrote:
> > > Give some examples ,i m not getting ur question
> >
> > > On Mon, Sep 19, 2011 at 1:45 AM, UTKARSH SRIVASTAV <
> > > usrivastav...@gmail.com> wrote:
> >
> > >> how to find second largest element than current element in an array
> given
> > >> condition that we have to find that second largest element from index
> 1 to
> > >> the index of the current element
> >
> > >> --
> > >> *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 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
> > > SAGAR PAREEK
> > > 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.
>
>


-- 

*Sandeep Kumar,*
 ( Mobile +91-9866507368

*“I believe in smart work, Believe Me”*

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

Reply via email to