mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
Search/Sorts algoruthms : remove live code & console.log, leave examples as comments.
This commit is contained in:
@ -85,10 +85,10 @@ const Merge = (array, left, mid, right) => {
|
||||
/**
|
||||
* @example Test of Timsort functions.
|
||||
* Data is randomly generated.
|
||||
* Prints "RIGHT" if it works as expected,
|
||||
* Return "RIGHT" if it works as expected,
|
||||
* otherwise "FAULTY"
|
||||
*/
|
||||
(() => {
|
||||
const demo = () => {
|
||||
const size = 1000000
|
||||
const data = Array(size)
|
||||
for (let i = 0; i < size; i++) {
|
||||
@ -103,8 +103,10 @@ const Merge = (array, left, mid, right) => {
|
||||
}
|
||||
Timsort(data)
|
||||
if (isSorted(data)) {
|
||||
console.log('RIGHT')
|
||||
return 'RIGHT'
|
||||
} else {
|
||||
console.log('FAULTY')
|
||||
return 'FAULTY'
|
||||
}
|
||||
})()
|
||||
}
|
||||
|
||||
export { Timsort, demo }
|
||||
|
Reference in New Issue
Block a user