-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
gitmodules
Automated by Actions Bot. (#186)
Co-authored-by: Hamster [bot] <node_modules@hotmail.com>
- Loading branch information
Showing
4 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[submodule "TypeScript-Complete-Manual"] | ||
path = TypeScript-Complete-Manual | ||
url = https://github.com/offensive-vk/TypedScript.git | ||
[submodule "Python-Complete-Manual"] | ||
path = Python-Complete-Manual | ||
url = https://github.com/offensive-vk/Learn-Python.git |
Submodule Python-Complete-Manual
added at
894da7
Submodule TypeScript-Complete-Manual
added at
c09e55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Sorts an array of numbers using the QuickSort algorithm asynchronously. | ||
* @template T The type of the array, which must be an array of numbers. | ||
* @param arr The array of numbers to be sorted. | ||
* @returns A Promise that resolves to the sorted array if successful, or undefined if the input array is empty. | ||
*/ | ||
async function QuickSort<T extends Array<number>>(arr: T): Promise<Array<number> | void> { | ||
if(Array.isArray(arr)) { | ||
if(arr.length < 1) { | ||
console.log(`Array is Too Small to be Sorted.`); | ||
return; | ||
} | ||
else { | ||
let pivot: number = arr[0]; | ||
let smaller: Array<number> = []; | ||
let greater: Array<number> = []; | ||
for(let x = 1; x < arr.length; x++) { | ||
if(x <= pivot) { | ||
smaller.push(x); | ||
} | ||
if(x > pivot) { | ||
greater.push(x); | ||
} | ||
} | ||
return [...smaller, pivot, ...greater]; | ||
} | ||
} | ||
console.log(`\n Function Terminated. \n`) | ||
} | ||
|
||
( async() => { | ||
const test: Array<number> = [11, 90, 34, 44, 99, 21]; | ||
const Result = await QuickSort(test).then(res => console.log(res)); | ||
console.log(`The Results are here: ${Result}\n`); | ||
})(); |