From 02a3dfa18a94d844cf7fecfc15777fbe4db3eac5 Mon Sep 17 00:00:00 2001 From: prVraj Date: Sat, 28 Oct 2023 13:39:33 +0530 Subject: [PATCH 1/2] add : pull reaquest template --- .gtihub/pull_request_template.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .gtihub/pull_request_template.md diff --git a/.gtihub/pull_request_template.md b/.gtihub/pull_request_template.md new file mode 100644 index 0000000..3d3f18d --- /dev/null +++ b/.gtihub/pull_request_template.md @@ -0,0 +1,21 @@ + + +## Current behavior + + + +## Proposed changes + + + + +## Checks + + + +- [ ] All commits in this Pull Request are [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) and Verified by Github. + + \ No newline at end of file From 022c53cb1228daa6ff51ebaaf60f54dcbd0a1e00 Mon Sep 17 00:00:00 2001 From: prVraj Date: Sat, 28 Oct 2023 16:19:01 +0530 Subject: [PATCH 2/2] add : Hipsort to it --- .idea/.gitignore | 3 +++ .idea/JavaScriptONLY.iml | 8 +++++++ .../inspectionProfiles/profiles_settings.xml | 6 ++++++ .idea/misc.xml | 7 +++++++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 6 ++++++ DSA/Arrays/Hipsort.js | 21 +++++++++++++++++++ 7 files changed, 59 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/JavaScriptONLY.iml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 DSA/Arrays/Hipsort.js diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/JavaScriptONLY.iml b/.idea/JavaScriptONLY.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/JavaScriptONLY.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..8010bf9 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..867c8a7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/DSA/Arrays/Hipsort.js b/DSA/Arrays/Hipsort.js new file mode 100644 index 0000000..0da8eb6 --- /dev/null +++ b/DSA/Arrays/Hipsort.js @@ -0,0 +1,21 @@ +function heapSort(arr) { + // Build heap (rearrange array) + for (let i = Math.floor(arr.length / 2) - 1; i >= 0; i--) + heapify(arr, arr.length, i); + + // One by one extract an element from heap + for (let i = arr.length - 1; i > 0; i--) { + // Move current root to end + let temp = arr[0]; + arr[0] = arr[i]; + arr[i] = temp; + + // call max heapify on the reduced heap + heapify(arr, i, 0); + } + return arr; +} + +Array = [12, 11, 13, 5, 6, 7]; + +console.log(heapSort(Array));