Skip to content

Commit

Permalink
Add gitmodules Automated by Actions Bot. (#186)
Browse files Browse the repository at this point in the history
Co-authored-by: Hamster [bot] <node_modules@hotmail.com>
  • Loading branch information
offensive-vk and TheHamsterBot committed Aug 5, 2024
2 parents 8ee770f + f4c9642 commit 97e22d1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
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
1 change: 1 addition & 0 deletions Python-Complete-Manual
Submodule Python-Complete-Manual added at 894da7
1 change: 1 addition & 0 deletions TypeScript-Complete-Manual
36 changes: 36 additions & 0 deletions TypeScript/QuickSort.ts
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`);
})();

0 comments on commit 97e22d1

Please sign in to comment.