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 2 of 2

Thread: bubble sort timer

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    1
    My Mood
    Depressed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default bubble sort timer



    hi guys!
    Thus anyone know how to put timer in bubble sort using javascript???

    I am trying to make a timer for my sort but I can't make it. I don't know how to connect...

    heres my work..
    <html>
    <head>
      <title>sortBubble</title>
    </head>
    <script>
    <!-- Begin
    var myArray = new Array(102,201,3,517,77,345,68,234,8,9,4,517,6,0)
     
    function bubbleSort(ns,test) {
    ts=new Date();
      j=0;i=0;//test='>'
      //alert(myArray)
      //ns = myArray
     //
     
      alert("Sorted array: \n"+ns)
      alert("time to sort =\n"+(ts)+" milliseconds")
    }
    // End -->
    </script>
     
    <body onLoad="bubbleSort(myArray,'<');">
     
     
    </body>
    </html>
    Last edited by helloworld922; October 15th, 2011 at 11:14 AM.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: bubble sort timer

    Javascript is not Java, so I've moved this to a more appropriate forum.

    Also, please don't post duplicate threads of the same question. I deleted your other thread.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Bubble Sort help
    By baueml01 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: June 5th, 2011, 08:47 PM
  2. bubble sort and selection sort on strings
    By Sir Saula in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 3rd, 2010, 09:44 AM
  3. Javascript Bubble Sort
    By Fidelacchius in forum What's Wrong With My Code?
    Replies: 17
    Last Post: May 24th, 2010, 04:43 PM
  4. bubble sort timer problem
    By JavaNoob82 in forum Algorithms & Recursion
    Replies: 1
    Last Post: March 12th, 2010, 09:22 AM