function mergeSort(array) {
if (array.length <= 1) {
return array;
}
const middleIndex = Math.floor(array.length / 2);
const leftArray = array.slice(0, middleIndex);
const rightArray = array.slice(middleIndex);
const sortedLeftArray = mergeSort(leftArray);
const sortedRightArray = mergeSort(rightArray);
return merge(sortedLeftArray, sortedRightArray);
}
function merge(leftArray, rightArray) {
let sortedArray = [];
let leftIndex = 0;
let rightIndex = 0;
while (leftIndex < leftArray.length && rightIndex < rightArray.length) {
if (leftArray[leftIndex] < rightArray[rightIndex]) {
sortedArray.push(leftArray[leftIndex]);
leftIndex++;
} else {
sortedArray.push(rightArray[rightIndex]);
rightIndex++;
}
}
return sortedArray
.concat(leftArray.slice(leftIndex))
.concat(rightArray.slice(rightIndex));
}
const array = [38, 27, 43, 3, 9, 82, 10];
const sortedArray = mergeSort(array);
console.log(sortedArray);
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
.progress-circle {
position: relative;
width: 150px;
height: 150px;
}
.progress-circle__circle {
width: 100%;
height: 100%;
border-radius: 50%;
background: conic-gradient(#76c7c0 var(--progress, 0%), #333 0%);
console