Skip to content

fResult/MyWebProject

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Web Project

xxxxxxxxxxx index.html xxxxxxxxxx
Markdown Icon

Feature

  • Feature xxx
  • Feature yyy
  • Feature zzz

Exam Code

object QuickSortFP extends App {

    // create an array of random 10m random ints
    
    val r = scala.util.Random
    val randomArray = (for (i <- 1 to 10000000) yield r.nextInt(10000)).toArray

    // do the sorting
    val sortedArray = quickSort(randomArray)

    // the fp/recursive algorithm
    def quickSort(xs: Array[Int]): Array[Int] = {
        if (xs.length <= 1) xs
        else {
            val pivot = xs(xs.length / 2)
            Array.concat(
                quickSort(xs filter (pivot >)),
                xs filter (pivot ==),
                quickSort(xs filter (pivot <)))
        }
    }
}

Credit

Sila Setthakan-anan

Educated by Code Camp 4
Create Example code => https://www.geeksforgeeks.org/quick-sort

About Author

My domain
My blog

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages