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.