Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: method to return the position of the smallest item in an array

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default method to return the position of the smallest item in an array

    1. Complete the algorithm below for a method to return the position of the smallest item in array data with bounds 0..limit. What is the time complexity of this algorithm?

    positionOfSmallest(data[0..limit])

    1. set largest = data[0].
    2. set indexOfLargest = 0.
    3. set index = 1.





    happy if anyone can answer this questions as soon as possible

    thank you!!!!!!!


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Location
    Wales, Bangor & England, Warwickshire
    Posts
    820
    My Mood
    Cynical
    Thanks
    7
    Thanked 104 Times in 90 Posts

    Default Re: method to return the position of the smallest item in an array

    izzahmed,

    Please read, Announcements - What's Wrong With My Code? , we are not a homework service for you. You must show an attempt at completing the question and outline where you are stuck and what you do not understand.

    This question is very simple, and you should be able to work it out just by thinking about it. Rather than just copy pasting and hoping someone will complete it for you.


    Regards,
    Chris
    chris[at]javaprogrammingforums[dot]com

    Prifysgol Bangor University, North Wales

  3. #3
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,465
    My Mood
    Grumpy
    Thanks
    0
    Thanked 158 Times in 149 Posts

    Default Re: method to return the position of the smallest item in an array

    Quote Originally Posted by izzahmed View Post
    happy if anyone can answer this questions as soon as possible
    Done! I hope you're happy.
    Improving the world one idiot at a time!

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: method to return the position of the smallest item in an array

    Quote Originally Posted by izzahmed View Post
    1. Complete the algorithm below for a method to return the position of the smallest item in array data with bounds 0..limit. What is the time complexity of this algorithm?

    positionOfSmallest(data[0..limit])

    1. set largest = data[0].
    2. set indexOfLargest = 0.
    3. set index = 1.





    happy if anyone can answer this questions as soon as possible

    thank you!!!!!!!
    1. Turn on your PC.
    2. Think for a while about what you want to do.
    3. Try to write algorithm on a page
    4. Implement it.
    5. Try to run it.
    6. IF successful, good luck
    7. ELSE try to think or post here what are the errors.
    8. We will try to help you learning through those errors.
    9. You will learn and will get your problem solved.


    Was this the algorithm you wanted us to complete?

  5. #5
    Member
    Join Date
    Mar 2011
    Posts
    198
    My Mood
    Daring
    Thanks
    7
    Thanked 4 Times in 4 Posts

    Default Re: method to return the position of the smallest item in an array

    No need to be mean man lol
    He might be asking people to fix his code for him, It simply means his new to java.
    Just post a few booklets full of data for him to read

  6. #6
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: method to return the position of the smallest item in an array

    Quote Originally Posted by macko View Post
    No need to be mean man lol
    He might be asking people to fix his code for him, It simply means his new to java.
    Just post a few booklets full of data for him to read
    I was never mean....
    He wanted us to write an algorithm for him and i did that. I hope this algorithm will teach him some of the forum rules and learning rules too.

Similar Threads

  1. Doubling The Array Size And Randomizing Array Return
    By Pingu00 in forum What's Wrong With My Code?
    Replies: 18
    Last Post: June 27th, 2011, 10:50 AM
  2. Replies: 3
    Last Post: June 1st, 2011, 12:47 AM
  3. Search for min and max values as columns position in array
    By susieferrari in forum Java Theory & Questions
    Replies: 3
    Last Post: April 28th, 2011, 07:39 AM
  4. JComboBox selection not showing item from object array
    By oper125 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 24th, 2010, 05:31 AM
  5. drag item or insert item into new Jlabel in JPanel
    By qaromi in forum AWT / Java Swing
    Replies: 5
    Last Post: July 6th, 2010, 07:37 PM