A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

algorithm to find smallest two numbers from list

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    how many no.s are given??

  2. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    its a sequence of numbers from 1 to n distinct

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    use an array to store this numbers. compare the first element of the array with the rest. if any no becomes smaller than the first no. while checking then replace the first no with the smaller one and continue the checking the the new no. at last you will get the smallest no. at the first position.

  4. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    write algo that returns index of the first item that is less than its predecessor in sequence S1 ............. Sn, if s in nondecreasing order that algo returns the value 0

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    do u know C language?

  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    ya i know

  7. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    do u want the algo?

  8. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    yes

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    take c as a array. c={1st , 2nd,........nth} for (i=0:1<n:i++) { if (c(0)<=c(i)) c(0)=c(i); } printf("\n %f ",c(0));

  10. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i think it works

  11. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks i wll try ok

  12. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.