Tag: bubble sort java

Print the N longest lines in a file java

I got a full 100 score and 182ms execution time of their data set on the site so I consider the code to be working and effective. What I'm wondering is, is there something I can do to make this faster than it already is? Did I miss anything? Any other comments? Input: 2 Hello … Continue reading Print the N longest lines in a file java


bubble sort scala

/** blue sort*/ def Bluesort(array : Array[Int]): Array[Int] = { var flag = false for(i<- 0 until array.length -1) if(array(i+1) > array(i)){ //tang dan,giam dan > val tmp = array(i) array(i) = array(i+1) array(i+1) = tmp flag = true } // Repeat until we don't have anymore swaps if(flag) Bluesort(array) else array } def main(args: … Continue reading bubble sort scala