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>