From e39331d955d03573dfa54f1fe43e7690c2530f6a Mon Sep 17 00:00:00 2001 From: Ruturaj Dnyandev Ghumkar <83021083+ruturaj-gh@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:02:55 +0530 Subject: [PATCH 01/80] Create shell_sort.cpp added shell sort code --- shell_sort/shell_sort.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 shell_sort/shell_sort.cpp diff --git a/shell_sort/shell_sort.cpp b/shell_sort/shell_sort.cpp new file mode 100644 index 0000000..a4b1525 --- /dev/null +++ b/shell_sort/shell_sort.cpp @@ -0,0 +1,34 @@ +// Shell Sort in C++ programming + +#include +using namespace std; + +void shellSort(int array[], int n) { + + for (int interval = n / 2; interval > 0; interval /= 2) { + for (int i = interval; i < n; i += 1) { + int temp = array[i]; + int j; + for (j = i; j >= interval && array[j - interval] > temp; j -= interval) { + array[j] = array[j - interval]; + } + array[j] = temp; + } + } +} + +void printArray(int array[], int size) { + int i; + for (i = 0; i < size; i++) + cout << array[i] << " "; + cout << endl; +} + + +int main() { + int data[] = {9, 8, 3, 7, 5, 6, 4, 1}; + int size = sizeof(data) / sizeof(data[0]); + shellSort(data, size); + cout << "Sorted array: \n"; + printArray(data, size); +} From 501a08bf0902471507ababacaa286bf7b321c64c Mon Sep 17 00:00:00 2001 From: Nikhil Falke <76964639+Nikhil-2002@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:57:00 +0530 Subject: [PATCH 02/80] Update README.md --- README.md | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d279230..441dd7a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,62 @@ -# Programming_Hactoberfest23. -#Add issues by your choices.
-#Add codes in specific folders.
-#do not copy the code from anywhere..


-![723s3y5aujdvqn3x7w2h](https://github.com/Nikhil-2002/Programming_Hactoberfest23/assets/76964639/e05bccc4-a735-4322-81f5-6107cc282cf0) + +# Programs Projects Collections🔥 + +![image](https://user-images.githubusercontent.com/70385488/192114009-0830321a-d227-4a4d-8411-6c03b54d7ce6.png) + +
+ +[![Open Source Love](https://firstcontributions.github.io/open-source-badges/badges/open-source-v1/open-source.svg)](https://github.com/kishanrajput23/Hacktoberfest-2022) +Hacktober Badge +Star Badge +Contributions + +
+ + +### This repository aims to help code beginners with their first successful pull request and open source contribution. :partying_face: + +:star: Feel free to use this project to make your first contribution to an open-source project on GitHub. Practice making your first pull request to a public repository before doing the real thing! + +:star: Make sure to grab some cool swags during Hacktoberfest by getting involved in the open-source community. + +### This repository is open to all members of the GitHub community. Any member can contribute to this project! :grin: + +## What is Hacktoberfest? :thinking: +A month-long celebration from October 1st to October 31st presented by [Digital Ocean](https://hacktoberfest.digitalocean.com/) and [DEV Community](https://dev.to/) collaborated with [GitHub](https://github.com/blog/2433-celebrate-open-source-this-october-with-hacktoberfest) to get people involved in [Open Source](https://github.com/open-source). Create your very first pull request to any public repository on GitHub and contribute to the open-source developer community. + +[https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/) + +## Rules :fire: +To qualify for the __official limited edition Hacktoberfest shirt__, you must register [here](https://hacktoberfest.digitalocean.com/) and make four Pull Requests (PRs) between October 1-31, 2023 (in any time zone). PRs can be made to any public repository on GitHub, not only the ones with issues labeled Hacktoberfest. This year, the __first 40,000__ participants who complete Hacktoberfest can elect to receive one of two prizes: a tree planted in their name. + +## Steps to follow :scroll: + +### Tip : Complete this process in GitHub (in your browser) + +```mermaid +flowchart LR + Fork[Fork the project]-->branch[Create a New Branch] + branch-->Edit[Edit file] + Edit-->commit[Commit the changes] + commit -->|Finally|creatpr((Create a Pull Request)) + + ``` + + +Star the repository by pressing the topmost-right button to start your wonderful journey. + + + + +Made with [contributors-img](https://contributors-img.web.app). + + +## Help Contributing Guides :crown: + +We love to have `articles` and `codes` in different languages and the `betterment` of existing ones. + +Please discuss it with us first by creating a new issue. + +:tada: :confetti_ball: :smiley: _**Happy Contributing**_ :smiley: :confetti_ball: :tada: + +## Author 🙋‍♂️ : [Find Me Here](https://www.linkedin.com/in/nikhil-falke-1a3639200/) From 35cdd828a55164e43ed6ed0bb7a0d3517d331ab7 Mon Sep 17 00:00:00 2001 From: SRUJANA2199 <136368774+SRUJANA2199@users.noreply.github.com> Date: Sun, 1 Oct 2023 10:41:04 +0530 Subject: [PATCH 03/80] Create largestelement.c --- largestelement.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 largestelement.c diff --git a/largestelement.c b/largestelement.c new file mode 100644 index 0000000..55d370d --- /dev/null +++ b/largestelement.c @@ -0,0 +1,35 @@ +#include + +int main() { + int n; + + // Taking the size of the array from the user + printf("Enter the size of the array: "); + scanf("%d", &n); + + if (n <= 0) { + printf("Invalid size\n"); + return 1; // Exit the program with an error code + } + + int arr[n]; + + // Taking array elements as input from the user + printf("Enter the elements of the array:\n"); + for (int i = 0; i < n; ++i) { + scanf("%d", &arr[i]); + } + + // Finding the largest element + int max = arr[0]; + for (int i = 1; i < n; ++i) { + if (arr[i] > max) { + max = arr[i]; + } + } + + // Displaying the result + printf("The largest element in the array is: %d\n", max); + + return 0; +} From 8a4c79f6073db8046a48ee884fa8334e526e1d04 Mon Sep 17 00:00:00 2001 From: Piyush Gambhir <90608533+Piyush-Gambhir@users.noreply.github.com> Date: Sun, 1 Oct 2023 11:21:49 +0530 Subject: [PATCH 04/80] Added Program To Find Smallest Element in an Array --- .../Solution.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 find_the_smallest_element_in_an_array/Solution.java diff --git a/find_the_smallest_element_in_an_array/Solution.java b/find_the_smallest_element_in_an_array/Solution.java new file mode 100644 index 0000000..80b0907 --- /dev/null +++ b/find_the_smallest_element_in_an_array/Solution.java @@ -0,0 +1,25 @@ +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.print("Enter the number of elements in the array: "); + int n = scanner.nextInt(); + int[] arr = new int[n]; + System.out.println("Enter the elements of the array:"); + for (int i = 0; i < n; i++) { + arr[i] = scanner.nextInt(); + } + scanner.close(); + + int min = arr[0]; + + for (int i = 1; i < arr.length; i++) { + if (arr[i] < min) { + min = arr[i]; + } + } + + System.out.println("The smallest element in the array is: " + min); + } +} From db4cd2dcccd657d53ecaa9ae8438d111d1dd10f2 Mon Sep 17 00:00:00 2001 From: SRUJANA2199 <136368774+SRUJANA2199@users.noreply.github.com> Date: Sun, 1 Oct 2023 11:32:17 +0530 Subject: [PATCH 05/80] countingevenodd.c --- countingevenodd.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 countingevenodd.c diff --git a/countingevenodd.c b/countingevenodd.c new file mode 100644 index 0000000..eb43748 --- /dev/null +++ b/countingevenodd.c @@ -0,0 +1,34 @@ +#include + +int main() { + int size; + + // Input the size of the array + printf("Enter the size of the array: "); + scanf("%d", &size); + + // Input the elements of the array + printf("Enter the elements of the array:\n"); + int arr[size]; + for (int i = 0; i < size; i++) { + scanf("%d", &arr[i]); + } + + // Count even and odd numbers + int evenCount = 0; + int oddCount = 0; + + for (int i = 0; i < size; i++) { + if (arr[i] % 2 == 0) { + evenCount++; + } else { + oddCount++; + } + } + + // Display the counts + printf("Number of even elements: %d\n", evenCount); + printf("Number of odd elements: %d\n", oddCount); + + return 0; +} From 34e41e619dc47781502b17d35fbf8011e55da328 Mon Sep 17 00:00:00 2001 From: educationalgamer Date: Sun, 1 Oct 2023 13:21:08 +0530 Subject: [PATCH 06/80] Finding the Longest Palindrome in an Array i have added this issue please merge this --- .../Solution.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Finding_the_Longest_Palindrome_in_Array/Solution.java diff --git a/Finding_the_Longest_Palindrome_in_Array/Solution.java b/Finding_the_Longest_Palindrome_in_Array/Solution.java new file mode 100644 index 0000000..1bad848 --- /dev/null +++ b/Finding_the_Longest_Palindrome_in_Array/Solution.java @@ -0,0 +1,58 @@ +import java.util.*; + +class Main +{ + // Function to check if n is palindrome + static boolean isPalindrome(int n) + { + // Find the appropriate divisor + // to extract the leading digit + int divisor = 1; + while (n / divisor >= 10) + divisor *= 10; + + while (n != 0) { + int x = n / divisor; + int y = n % 10; + + // If first and last digits are + // not same then return false + if (x != y) + return false; + + // Removing the leading and trailing + // digits from the number + n = (n % divisor) / 10; + + // Reducing divisor by a factor + // of 2 as 2 digits are dropped + divisor = divisor / 100; + } + return true; + } + + // Function to find the largest palindromic number + static int largestPalindrome(int []A, int n) + { + int res = -1; + + for (int i = 0; i < n; i++) { // If a palindrome larger than the currentMax is found + if (A[i] > res && isPalindrome(A[i])) + res = A[i]; + } + + // Return the largest palindromic number from the array + return res; + } + + // Driver program + public static void main(String []args) + { + int []A = { 121, 2322, 54545, 999990 }; + int n = A.length; + + // print required answer + System.out.println(largestPalindrome(A, n)); + } + +} \ No newline at end of file From 33b8210b529da0ff76c1b852582ebc0c91680326 Mon Sep 17 00:00:00 2001 From: Sambhav Singla Date: Sun, 1 Oct 2023 17:46:44 +0530 Subject: [PATCH 07/80] issue resolved of removing duplicates from an array --- removingDuplicates/removeDupFromArray.cpp | 37 +++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 removingDuplicates/removeDupFromArray.cpp diff --git a/removingDuplicates/removeDupFromArray.cpp b/removingDuplicates/removeDupFromArray.cpp new file mode 100644 index 0000000..f001831 --- /dev/null +++ b/removingDuplicates/removeDupFromArray.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +#define int long long +#define MOD 1e9 + 7 +const long long N=10000005; + + +main() +{ + //Declare an array size; + int n; + cout<<"Size of an array: "; + cin>>n; + + //declare a set also as inserting into sets as it will remove the duplicates + + //declare an array of size n + + int a[n]; + + //unordered set for better time complexity + unordered_set sam; + cout<<"Elements of an array: "; + for(int i=0;i>a[i]; + sam.insert(a[i]); + } + + cout<<"Array without duplicates: "; + + for(int it:sam) + { + cout< Date: Sun, 1 Oct 2023 18:56:46 +0530 Subject: [PATCH 08/80] Issue resolved of finding that arrays are disjoint or not --- .vscode/settings.json | 5 ++++ findDisjoint/disjointOrNot.cpp | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 findDisjoint/disjointOrNot.cpp diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0cba2e6 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "iostream": "cpp" + } +} \ No newline at end of file diff --git a/findDisjoint/disjointOrNot.cpp b/findDisjoint/disjointOrNot.cpp new file mode 100644 index 0000000..c2374a3 --- /dev/null +++ b/findDisjoint/disjointOrNot.cpp @@ -0,0 +1,52 @@ +#include +using namespace std; +#define int long long +#define MOD 1000000007 +const long long N = 10000005; + +main() +{ + // Provide the size of array 1 and array 2 with their elements + int n, m; + cout << "Size of first array: "; + cin >> n; + cout << "Size of Second array: "; + cin >> m; + + // Initializing arrays + int a[n], b[m]; + + // Initializing sets for both arrays and a third set to combine them + unordered_set setA, setB, setC; + cout << "Elements of first array: "; + for (int i = 0; i < n; i++) + { + cin >> a[i]; + setA.insert(a[i]); + setC.insert(a[i]); + } + cout << "Elements of second array: "; + for (int i = 0; i < m; i++) + { + cin >> b[i]; + setB.insert(b[i]); + setC.insert(b[i]); + } + + // Comparing the sizes of sets to determine if they are disjoint + int sizeA = setA.size(); + int sizeB = setB.size(); + int sizeC = setC.size(); + + if (sizeA + sizeB == sizeC) + { + cout << "Yes, the arrays are disjoint" << endl; + } + + else + { + cout << "Arrays are not disjoint , they have some common values" << endl; + } + + return 0; +} From 5b8ddea5341afa405df95a273b3fbedd40fc2140 Mon Sep 17 00:00:00 2001 From: Mahesh Dudhe Date: Sun, 1 Oct 2023 19:56:30 +0530 Subject: [PATCH 09/80] added code of sum of array elements in cpp. --- array_sum.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 array_sum.cpp diff --git a/array_sum.cpp b/array_sum.cpp new file mode 100644 index 0000000..463e03c --- /dev/null +++ b/array_sum.cpp @@ -0,0 +1,22 @@ +#include + +int main() +{ + int n; + std::cout << "Enter the number of elements in the array: "; + std::cin >> n; + + int myArray[n]; + int arraySum = 0; + + std::cout << "Enter " << n << " elements, one at a time:\n"; + for (int i = 0; i < n; ++i) + { + std::cin >> myArray[i]; + arraySum += myArray[i]; + } + + std::cout << "Sum of elements in the array: " << arraySum << std::endl; + + return 0; +} From 5d2c5c59c7a1df9c72f136abcef939efeb8fcde5 Mon Sep 17 00:00:00 2001 From: Dikshant jha <122460149+dikshant182004@users.noreply.github.com> Date: Mon, 2 Oct 2023 16:36:26 +0530 Subject: [PATCH 10/80] Create finding_repeating_elements.c solved issue #7 .please have a look --- finding_repeating_elements.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 finding_repeating_elements.c diff --git a/finding_repeating_elements.c b/finding_repeating_elements.c new file mode 100644 index 0000000..189df3a --- /dev/null +++ b/finding_repeating_elements.c @@ -0,0 +1,45 @@ +#include + +int main() { + int size; + + // Taking the size of the array from the user + printf("Enter the size of the array: "); + scanf("%d", &size); + + if (size <= 0) { + printf("Invalid size\n"); + return 1; // Exit the program with an error code + } + + int arr[size]; + + // Taking array elements as input from the user + printf("Enter the elements of the array:\n"); + for (int i = 0; i < size; ++i) { + scanf("%d", &arr[i]); + } + + // Finding the Repeated elements + int i,j; + int No_of_repeated=0; + + for (i=0;i Date: Mon, 2 Oct 2023 18:54:25 +0530 Subject: [PATCH 11/80] Reverse_an_array_cpp_added --- Reverse_an_array/Reverse_an_array.cpp | 37 ++++++++++++++++++++++++++ Reverse_an_array/Reverse_an_array.exe | Bin 0 -> 44846 bytes 2 files changed, 37 insertions(+) create mode 100644 Reverse_an_array/Reverse_an_array.cpp create mode 100644 Reverse_an_array/Reverse_an_array.exe diff --git a/Reverse_an_array/Reverse_an_array.cpp b/Reverse_an_array/Reverse_an_array.cpp new file mode 100644 index 0000000..3ab9f15 --- /dev/null +++ b/Reverse_an_array/Reverse_an_array.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; +int main() +{ + //Take an array as input + cout<<"Size of array is: "; + int n; + cin>>n; + + //Declaring an array of size n + int arr[n]; + + //Taking the array from user + cout<<"Enter the array: "; + for(int i=0;i>arr[i]; + } + + //Reversing the entered array + for(int i=0;iR^L{LLeA0XwaD?lMl(4`QSsrOGqXpk}s1xfFDS3 zCYHNn+U(Z0Zfmzv+%DUUdCqgrJ@?)-C3p8QD`U)tGaP1YAFgz`_}@$a=|pkTwLeK> zdndmeMM| z8tHNmW5v=`R&(%5FWb!6Ef&U3v3My#vdm)XKq|&buxYp^<8WXPv4IhVz;i9sV6&zG zupVb3&Mcf!2jQh}=;$C2$;jI1Pwdf2d>aK{Zo^LC*m35Wak+fC6;%Y~w(3EG^q{tl zIyj!v#Q8c2{xnX)E5#Xg5Z=NJp$HfKSrif;=^b^rm@8-D;$<8XCIj~2yas0l&Zxu1 zl5-YjW^l+tYO_-~iQX8!Io^^bC}8Xm;hn`vceg|mx-s?$&j6VOtSqE&aN6RmN0%Vk;bdUcZ=m|iujXo1 z0~RF#sTaCJkW$t_r9dVj*tp)B1jC;Ls7JGb4s&R9qB$SEkxN0`LO)B^rTFbzgqomrTtK~ zpGl;2vWta6MCyz!lnl&Wc9)B(wzSaaAX(^Mh_NfJjg!g=Uj5+?7u%gk2ry?XiMrT7z^!6_t%emE6uPoE9Vn~aidDj~Y|T@3t)*e)9-Q1t|C zqV|U-14W&c7W#X->h0w}lii({HlMc@(5Xr20uZSQGReDa5ZHf8LOKzsbBRajm-E2; zV0M2G{2O)1=;0ZspkC;wW_yZqvYb}_b#r-mPU533*1cJ`e|XL(pwbgL&>kz%AjxFw za*%(97@x6`3;hs8H88Z>Bno!73Gr>yflb;9xLq9}73XQdl^of=n?bd%b4m)8*{Px} zZQptq3%|B&CYAIlw*ulurO8Bv3M?Sh(mpzD}285O8*_!tt4Qc?3t zxNx_3^qzay^+V0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ht(cI(jluZ(uwr%IFFoEAtW4AWdQ8OFO-GKWfS-jT5 z(zkePHl@RJ#`JpfI|6$OWf3WIJOxFi+|Zh%jvcCWSLMapU7l_VeOq){#>0u|_L#WK z>yb&{aouo>25(JUl)DH;#BV!dOFCLoF}bz2^odUETV(D;OF zk*Cq#Wm;qrJ`veComee4u>z6kz4$3gXnqvi$b8FlB9SRb@LkW5)R>xGSKO}gaR&R$ zVORC&9>H5e`-VZ|7uh^M!rzD~uq$^9Jvwk1Yp^>U?bOa&UXMbWNJgu6h~G63n|3vO z@!=zSYjM<%0FaMH*@sIuHXaw@qjg=oh%6E3g)|d83%Fs-)waFYRf`VPk+{g@s9#v% zJxBLfzCFG+X6Ry=eo}ysIQ-Wbc)jQkGZ8Vc;}~tq&%3R*`8^s9QW-xgAiQ6vP3tnI zafIUgU$T|G?i;lc>yfq?a=lwG;bwf-eWR-3%ev`l(|43Fr5*)3rVmjOE~2A8ZH%Zp znD|8kZY%THM2}L<4kEh1c)uZGG>o?VAYgDj$h_~8VZ|B~#OAK>6t ziu?)%7yd8vAAP`ujoUB~7~`!7I!ct8is%65aCZI>-J{?gaYs z-XJE;oQ}4xgcJP8hCbnGB%7N;JMGU%zg&zBip6A#v(bOhLoE7gcO3{pd|i}A{OCR% z86~lm@um)C6ZWNm=z2HX=>+K zl`_0t_)_FoNg@&598OKmM>mn$EUIeEjF;PH!U^o9 Date: Mon, 2 Oct 2023 21:03:39 +0530 Subject: [PATCH 12/80] Revert "Finding the Longest Palindrome in an Array" --- .../Solution.java | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 Finding_the_Longest_Palindrome_in_Array/Solution.java diff --git a/Finding_the_Longest_Palindrome_in_Array/Solution.java b/Finding_the_Longest_Palindrome_in_Array/Solution.java deleted file mode 100644 index 1bad848..0000000 --- a/Finding_the_Longest_Palindrome_in_Array/Solution.java +++ /dev/null @@ -1,58 +0,0 @@ -import java.util.*; - -class Main -{ - // Function to check if n is palindrome - static boolean isPalindrome(int n) - { - // Find the appropriate divisor - // to extract the leading digit - int divisor = 1; - while (n / divisor >= 10) - divisor *= 10; - - while (n != 0) { - int x = n / divisor; - int y = n % 10; - - // If first and last digits are - // not same then return false - if (x != y) - return false; - - // Removing the leading and trailing - // digits from the number - n = (n % divisor) / 10; - - // Reducing divisor by a factor - // of 2 as 2 digits are dropped - divisor = divisor / 100; - } - return true; - } - - // Function to find the largest palindromic number - static int largestPalindrome(int []A, int n) - { - int res = -1; - - for (int i = 0; i < n; i++) { // If a palindrome larger than the currentMax is found - if (A[i] > res && isPalindrome(A[i])) - res = A[i]; - } - - // Return the largest palindromic number from the array - return res; - } - - // Driver program - public static void main(String []args) - { - int []A = { 121, 2322, 54545, 999990 }; - int n = A.length; - - // print required answer - System.out.println(largestPalindrome(A, n)); - } - -} \ No newline at end of file From 52d7629a2aaedb895a3a96f23d400946affa80d5 Mon Sep 17 00:00:00 2001 From: Shiva Sankar Date: Mon, 2 Oct 2023 21:16:16 +0530 Subject: [PATCH 13/80] Longest palindrome subsequence length --- .../Solution.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 longest_palindrome_subsequence_length/Solution.java diff --git a/longest_palindrome_subsequence_length/Solution.java b/longest_palindrome_subsequence_length/Solution.java new file mode 100644 index 0000000..48b7870 --- /dev/null +++ b/longest_palindrome_subsequence_length/Solution.java @@ -0,0 +1,24 @@ +import java.util.*; + +public class Solution { + public int longestPalindromeSubseq(String s) { + int[][] dp = new int[s.length() + 1][s.length() + 1]; + Arrays.fill(dp[0], 0); + for (int i = 1; i <= s.length(); i++) { + dp[i][0] = 0; + for (int j = 1; j <= s.length(); j++) { + if (s.charAt(i - 1) == s.charAt(s.length() - j)) { + dp[i][j] = dp[i - 1][j - 1] + 1; + } else { + dp[i][j] = dp[i - 1][j] > dp[i][j - 1] ? dp[i - 1][j] : dp[i][j - 1]; + } + } + } + return dp[s.length()][s.length()]; + } + + public static void main(String[] args) { + Solution solver = new Solution(); + System.out.println(solver.longestPalindromeSubseq("bbbab")); + } +} \ No newline at end of file From b3158c4dced45266b735fb8f9cbb20c1ebe12c64 Mon Sep 17 00:00:00 2001 From: Nikhil Falke <76964639+Nikhil-2002@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:14:58 +0530 Subject: [PATCH 14/80] Create CONTRIBUTING.md --- CONTRIBUTING.md | 62 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6724cf1 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,62 @@ + +# Programming Projects Collections🔥 + +![image](https://user-images.githubusercontent.com/70385488/192114009-0830321a-d227-4a4d-8411-6c03b54d7ce6.png) + +
+ +[![Open Source Love](https://firstcontributions.github.io/open-source-badges/badges/open-source-v1/open-source.svg)](https://github.com/kishanrajput23/Hacktoberfest-2022) +Hacktober Badge +Star Badge +Contributions + +
+ + +### This repository aims to help code beginners with their first successful pull request and open source contribution. :partying_face: + +:star: Feel free to use this project to make your first contribution to an open-source project on GitHub. Practice making your first pull request to a public repository before doing the real thing! + +:star: Make sure to grab some cool swags during Hacktoberfest by getting involved in the open-source community. + +### This repository is open to all members of the GitHub community. Any member can contribute to this project! :grin: + +## What is Hacktoberfest? :thinking: +A month-long celebration from October 1st to October 31st presented by [Digital Ocean](https://hacktoberfest.digitalocean.com/) and [DEV Community](https://dev.to/) collaborated with [GitHub](https://github.com/blog/2433-celebrate-open-source-this-october-with-hacktoberfest) to get people involved in [Open Source](https://github.com/open-source). Create your very first pull request to any public repository on GitHub and contribute to the open-source developer community. + +[https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/) + +## Rules :fire: +To qualify for the __official limited edition Hacktoberfest shirt__, you must register [here](https://hacktoberfest.digitalocean.com/) and make four Pull Requests (PRs) between October 1-31, 2023 (in any time zone). PRs can be made to any public repository on GitHub, not only the ones with issues labeled Hacktoberfest. This year, the __first 40,000__ participants who complete Hacktoberfest can elect to receive one of two prizes: a tree planted in their name. + +## Steps to follow :scroll: + +### Tip : Complete this process in GitHub (in your browser) + +```mermaid +flowchart LR + Fork[Fork the project]-->branch[Create a New Branch] + branch-->Edit[Edit file] + Edit-->commit[Commit the changes] + commit -->|Finally|creatpr((Create a Pull Request)) + + ``` + + +Star the repository by pressing the topmost-right button to start your wonderful journey. + + + + +Made with [contributors-img](https://contributors-img.web.app). + + +## Help Contributing Guides :crown: + +We love to have `articles` and `codes` in different languages and the `betterment` of existing ones. + +Please discuss it with us first by creating a new issue. + +:tada: :confetti_ball: :smiley: _**Happy Contributing**_ :smiley: :confetti_ball: :tada: + +## Author 🙋‍♂️ : [Find Me Here](https://www.linkedin.com/in/nikhil-falke-1a3639200/) From 1596a52d3e987f26ea1e96ef3e0966bc34d51938 Mon Sep 17 00:00:00 2001 From: Akrati Verma <128223364+blindaks@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:15:05 +0530 Subject: [PATCH 15/80] Create Kadane's Algorithm.cpp --- Kadane's Algorithm.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Kadane's Algorithm.cpp diff --git a/Kadane's Algorithm.cpp b/Kadane's Algorithm.cpp new file mode 100644 index 0000000..e0ea9b5 --- /dev/null +++ b/Kadane's Algorithm.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +int main() +{ + int a[] = { -2, -3, 4, -1, -2, 1, 5, -3 }; + int n = sizeof(a) / sizeof(a[0]); + + // Kadane's algorithm + int max_so_far = INT_MIN, max_ending_here = 0; + + for (int i = 0; i < n; i++) { + max_ending_here = max_ending_here + a[i]; + if (max_so_far < max_ending_here) + max_so_far = max_ending_here; + + if (max_ending_here < 0) + max_ending_here = 0; + } +cout << "Maximum contiguous sum in the array is : "< Date: Tue, 3 Oct 2023 16:53:44 +0530 Subject: [PATCH 16/80] Added the folder and all executable files related to program --- count_Even_Odd/countEvenOdd.class | Bin 0 -> 1112 bytes count_Even_Odd/countEvenOdd.cpp | 27 +++++++++++++++++++++++++++ count_Even_Odd/countEvenOdd.exe | Bin 0 -> 44775 bytes count_Even_Odd/countEvenOdd.java | 24 ++++++++++++++++++++++++ count_Even_Odd/countEvenOdd.py | 18 ++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 count_Even_Odd/countEvenOdd.class create mode 100644 count_Even_Odd/countEvenOdd.cpp create mode 100644 count_Even_Odd/countEvenOdd.exe create mode 100644 count_Even_Odd/countEvenOdd.java create mode 100644 count_Even_Odd/countEvenOdd.py diff --git a/count_Even_Odd/countEvenOdd.class b/count_Even_Odd/countEvenOdd.class new file mode 100644 index 0000000000000000000000000000000000000000..603fd33a0c527fcadfedbde7235420837573e361 GIT binary patch literal 1112 zcmaJ=T~8B16g|`3?zFX(1uR$uEDF+swtn`3Dkh>tVsSMkn99@8j2Th3K2lx+s@^2Vp#JgLgB{c5CoqK1`J#+7wxnF)A9RqlPLJT2j9C{pK7!2mF z*c17NaJKW-)~>872IHRX*lLME%VamAh#<-li{l*Pr{Lv%Pst{s+zurrO97GX=AXB1 zN0n7uie_<`&P>EH2$Nx~De7|Bb*e(WwABuIo)V7oC^xg3?WPBHP_FH47h@R42*>$2 zk{D$e>BG;!TmESc$0s>Uk=+;uLxLm45U;u&M?Kz?j#aBM=*w{Zwi~}Ml+lJ_!tJtN>uA>q7~pd(o|X>D92@n(B>*btn7B$Rk>pO>_fd()AP#xW3<#ec-(~?Y%5ue;5td?tDg=O zSWL4B@^mY78Gm;uTy-4TUTz4_lOD${hS@WX_v?q_4#U*{q4co3&0`uDXbAi-M9+i9 zfb2L$le98g!}FiO-jl;{k*xpQ_oJ8yAU^afbQ%o6Gx_IOMGIRMJz`bDCKd?-!zyX_wWWncJ*6KP!dk&d8p-fGq*Hp*$Q5{!hg)wEJqWQw7zY|VFxcVA zw-4YGM;HJ;Vu<|7Ba8*UUsxz8EJrg5Dr62ESt@6N;zyM66bZb5iFJx!(e%8=DB6@g zMd&p26BNKXE^$mV78u|s#@P>qzLOdnt^_B{V3yVdopqI(zZTdWZqQzg;+wdQyGZ>8 DKv4?Y literal 0 HcmV?d00001 diff --git a/count_Even_Odd/countEvenOdd.cpp b/count_Even_Odd/countEvenOdd.cpp new file mode 100644 index 0000000..3c4e5ea --- /dev/null +++ b/count_Even_Odd/countEvenOdd.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; + +int main() { + // Initialize an array of integers + int arr[] = {2, 5, 8, 9, 12, 7, 6}; + + // Initialize counters for even and odd elements + int evenCount = 0; + int oddCount = 0; + + // Iterate through the array + for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) { + // Check if the current element is even + if (arr[i] % 2 == 0) { + evenCount++; + } else { // If it's not even, it's odd + oddCount++; + } + } + + // Print the counts of even and odd elements + cout << "Even count: " << evenCount << endl; + cout << "Odd count: " << oddCount << endl; + + return 0; +} diff --git a/count_Even_Odd/countEvenOdd.exe b/count_Even_Odd/countEvenOdd.exe new file mode 100644 index 0000000000000000000000000000000000000000..4ea07602fdde22fb345c645272dd929b78198e85 GIT binary patch literal 44775 zcmeHw3w%`7x$oLD6EcvHNgyaH>R^L{LP#(m*idJZOdgV#nS_Uen~+RMBrlUafDa@% z6U)BS^rSuZ)^o1C2Z}wH_IRv4^+Z~&4FnUkR3oKIi}j#Vofz6us~EsK_y4W6_w3o3 zg!cBH-|yVtZTBxbd#`VO>wB$lee1FJUQ>2wFS9bnY&atk#tz_0hl~He^uI1-r(FBP z6!y&2pUyoXmHu>Ybz@Vfv%RBjb4P89v#z$awM}tu@;N*Ft9vNwjiekZ=n;*J2Hp zIt_r0IFoTM#~E`FUgoCGP6CmPteyVFA6>+^N$}-1>;jG*XMq`)%a>nOO;B#DUfhr# zRJSn)$5Wa)Unjx$;3T|qoG}OCEzTB-aM7PeCgG9ZF^7w}@)j>y!66YcU_Z`la8}`r zIb19?Z*fjGhb*Q#JB5?zjnkXsEnSKX#*Pr)S)7E|fivddc*}0#5Mf#%6CO9Ffe1bF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#knz)CHM9eD^H zu!qqBQ>UyqK$_L+I>-M$?Iim079|GDoQ}4FN6{M-l-MCpJV~9m`G+@9N~<}e_Zk;7 zO#N}EzfJFsFF67-PjPhK+CZMm{-*|hll+oJv?U>S|E0}Z_<0l6k*Uw1Z4~JThOv*Z z7<6$#_21nPE5q9C1YwUal~SJ(8w;YnD|Q^-(y460_7PBCj~ZKi9j(4*>?&3ZU~G_x zX*t@{TfJK|yeF=Ai~igUcX3n`dck<5jMgE1FZ$ylx+TYja8q^DWK$b`RgW7PbK6Wh z(7kkgnsf*-z88)AZ4$i!MSnHrQXQo}N Date: Tue, 3 Oct 2023 17:54:00 +0530 Subject: [PATCH 17/80] factorial in c --- factorial.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 factorial.c diff --git a/factorial.c b/factorial.c new file mode 100644 index 0000000..f1598c9 --- /dev/null +++ b/factorial.c @@ -0,0 +1,21 @@ +#include +int main() +{ + int number,fact=1; + printf("Enter the number to find the factorial:"); + scanf("%d",&number); + if(number<0) + { + printf("\n the entered number is negative.there is no factorial for given number!!"); + } + if(number==0||number==1) + { + printf("\n the entered numbers's factorial is 1."); + } + for(int i=1;i<=number;i++) + { + fact=fact*i; + } + printf("\n the factorial of the entered number%d is:%d",number,fact); + return 0; +} \ No newline at end of file From 49ad20e5e719f0ca8b6f3da61b90a576d692098a Mon Sep 17 00:00:00 2001 From: NayanPrakash11 <69430088+NayanPrakash11@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:35:39 +0530 Subject: [PATCH 18/80] Create turtle.py turtle game to moving turtle using arrow keys. --- turtle.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 turtle.py diff --git a/turtle.py b/turtle.py new file mode 100644 index 0000000..02d5317 --- /dev/null +++ b/turtle.py @@ -0,0 +1,59 @@ +import turtle + +# Create the game window +wn = turtle.Screen() +wn.title("Turtle Game") +wn.bgcolor("white") + +# Create the player turtle +player = turtle.Turtle() +player.shape("turtle") +player.color("blue") +player.speed(0) +player.penup() +player.goto(0, 0) +player.direction = "stop" + +# Functions to control the player's movement +def move_up(): + player.direction = "up" + +def move_down(): + player.direction = "down" + +def move_left(): + player.direction = "left" + +def move_right(): + player.direction = "right" + +# Keyboard bindings +wn.listen() +wn.onkeypress(move_up, "Up") +wn.onkeypress(move_down, "Down") +wn.onkeypress(move_left, "Left") +wn.onkeypress(move_right, "Right") + +# Main game loop +while True: + wn.update() + + # Move the player + if player.direction == "up": + y = player.ycor() + player.sety(y + 20) + + if player.direction == "down": + y = player.ycor() + player.sety(y - 20) + + if player.direction == "left": + x = player.xcor() + player.setx(x - 20) + + if player.direction == "right": + x = player.xcor() + player.setx(x + 20) + +# Close the game window when done (unreachable in this example) +wn.mainloop() From 671262f3a49150c18f812de575ae569aa0c67123 Mon Sep 17 00:00:00 2001 From: musaibbatghar <111275468+musaibbatghar@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:31:58 +0530 Subject: [PATCH 19/80] Add files via upload --- InsertionSort.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 InsertionSort.java diff --git a/InsertionSort.java b/InsertionSort.java new file mode 100644 index 0000000..1760a10 --- /dev/null +++ b/InsertionSort.java @@ -0,0 +1,30 @@ +public class InsertionSort { + public static void insertionSort(int array[]) { + int n = array.length; + for (int j = 1; j < n; j++) { + int key = array[j]; + int i = j-1; + while ( (i > -1) && ( array [i] > key ) ) { + array [i+1] = array [i]; + i--; + } + array[i+1] = key; + } + } + + public static void main(String a[]){ + int[] arr1 = {9,14,3,2,43,11,58,22}; + System.out.println("Before Insertion Sort"); + for(int i:arr1){ + System.out.print(i+" "); + } + System.out.println(); + + insertionSort(arr1);//sorting array using insertion sort + + System.out.println("After Insertion Sort"); + for(int i:arr1){ + System.out.print(i+" "); + } + } +} \ No newline at end of file From d001c45d5c261cdaf517f17e0cfc4726fe9d23f3 Mon Sep 17 00:00:00 2001 From: musaibbatghar <111275468+musaibbatghar@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:32:55 +0530 Subject: [PATCH 20/80] Add files via upload --- BubbleSort.java | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 BubbleSort.java diff --git a/BubbleSort.java b/BubbleSort.java new file mode 100644 index 0000000..64753a5 --- /dev/null +++ b/BubbleSort.java @@ -0,0 +1,35 @@ +public class BubbleSort { + static void bubbleSort(int[] arr) { + int n = arr.length; + int temp = 0; + for(int i=0; i < n; i++){ + for(int j=1; j < (n-i); j++){ + if(arr[j-1] > arr[j]){ + //swap elements + temp = arr[j-1]; + arr[j-1] = arr[j]; + arr[j] = temp; + } + + } + } + + } + public static void main(String[] args) { + int arr[] ={3,60,35,2,45,320,5}; + + System.out.println("Array Before Bubble Sort"); + for(int i=0; i < arr.length; i++){ + System.out.print(arr[i] + " "); + } + System.out.println(); + + bubbleSort(arr);//sorting array elements using bubble sort + + System.out.println("Array After Bubble Sort"); + for(int i=0; i < arr.length; i++){ + System.out.print(arr[i] + " "); + } + + } +} \ No newline at end of file From 1a85c8332c5ba27a37f434cc85af0a5e1833c84e Mon Sep 17 00:00:00 2001 From: musaibbatghar <111275468+musaibbatghar@users.noreply.github.com> Date: Tue, 3 Oct 2023 20:20:03 +0530 Subject: [PATCH 21/80] Create Knapsack.py --- Knapsack.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Knapsack.py diff --git a/Knapsack.py b/Knapsack.py new file mode 100644 index 0000000..74fad6a --- /dev/null +++ b/Knapsack.py @@ -0,0 +1,32 @@ +# A naive recursive implementation of 0-1 Knapsack Problem + +# Returns the maximum value that can be put in a knapsack of +# capacity W +def knapSack(W, wt, val, n): + + # Base Case + if n == 0 or W == 0 : + return 0 + + # If weight of the nth item is more than Knapsack of capacity + # W, then this item cannot be included in the optimal solution + if (wt[n-1] > W): + return knapSack(W, wt, val, n-1) + + # return the maximum of two cases: + # (1) nth item included + # (2) not included + else: + return max(val[n-1] + knapSack(W-wt[n-1], wt, val, n-1), + knapSack(W, wt, val, n-1)) + +# end of function knapSack + +# To test above function +val = [60, 100, 120] +wt = [10, 20, 30] +W = 50 +n = len(val) +print knapSack(W, wt, val, n) + +# This code is contributed by Nikhil Kumar Singh From eeb8dbfe708da6ab8eac6a1cfad47098ab383973 Mon Sep 17 00:00:00 2001 From: Dikshant jha <122460149+dikshant182004@users.noreply.github.com> Date: Tue, 3 Oct 2023 21:07:33 +0530 Subject: [PATCH 22/80] Create reverse_an_array.c @hactoberfest i have made the program for reversing the array .so kindly see it and plz merge it. @ hactoberfest @hactoberfest-accepted --- reverse_an_array.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 reverse_an_array.c diff --git a/reverse_an_array.c b/reverse_an_array.c new file mode 100644 index 0000000..476c3b1 --- /dev/null +++ b/reverse_an_array.c @@ -0,0 +1,43 @@ +#include + +int main() { + int size; + + // Taking the size of the array from the user + printf("Enter the size of the array: "); + scanf("%d", &size); + + if (size <= 0) { + printf("Invalid size\n"); + return 1; // Exit the program with an error code + } + + int arr[size]; + + // Taking array elements as input from the user + printf("Enter the elements of the array:\n"); + for (int i = 0; i < size; ++i) { + scanf("%d", &arr[i]); + } + + // initializing the start and end position of an array. + int start=0; + int end=size-1; + + // Reversing the array + while(start Date: Tue, 3 Oct 2023 23:22:07 +0530 Subject: [PATCH 23/80] Fixed- Added DSU and Trie DataStructure --- Disjoint Set Union/DisjointSetUnion.cpp | 145 ++++++++++++++++++++++++ Trie/Trie.cpp | 120 ++++++++++++++++++++ 2 files changed, 265 insertions(+) create mode 100644 Disjoint Set Union/DisjointSetUnion.cpp create mode 100644 Trie/Trie.cpp diff --git a/Disjoint Set Union/DisjointSetUnion.cpp b/Disjoint Set Union/DisjointSetUnion.cpp new file mode 100644 index 0000000..097dc1d --- /dev/null +++ b/Disjoint Set Union/DisjointSetUnion.cpp @@ -0,0 +1,145 @@ +#include +using namespace std; + +/* + Disjoint Set Union is a data structure that is used to find dynamic set + of connected elements(pairwise or through a chained pairwise relation). + + The algorithm is used to find the connected components in a graph network, + flow network, etc. + + The data structure maintains two arrays :- + 1. parent + 2. rank (Here we are doing union by rank) + + There are 3 main fucntionalities in this data structure:- + + 1. MAKE_SET() ---> initialises the data-structures, parent[node]=node + initially and rank of all nodes = 0. + + + 2. FIND_SET(node) ---> Finds the representative element of the set where + node belongs + + 3. UNION(x,y) ----> Joins the nodes x and y based on the rank of the + parent of x and y. Say, parent of x is p_x and parent of y is p_y. + + Then if, + + a. rank[p_x]>rank[p_y] ---> Make parent[p_y]=p_x ; No change in rank + + b. rank[p_y]>rank[p_x] ---> Make parent[p_x]=p_y; No change in rank + + c. rank[p_x]=rank[p_y] ---> Make parent[p_y]=p_x; Increment rank[p_x] by 1 + + For n operations the amortised time complexity to do union operations is + O(alpha); where alpha is the inverse ackermann function. + +*/ + +class DSU +{ +private: + vector parent; // stores the representative element of the set + vector rank; // stores the rank of the nodes(parent of nodes to be specific) + int connectedComponents; + +public: + DSU(int); // Similiar to MAKE_SET(); initialises the data structure + int findParent(int); // Similar to FIND_SET(node); Finds representative element of the set where node belongs + void unionByRank(int, int); // Similiar to UNION(x,y) + int numberOfConnectedComponents(); // Utility function to track the number of connected components as the graph grows +}; + +/* + @param - Total number of nodes in the graph + @return - void +*/ + +DSU::DSU(int n) +{ + this->rank.resize(n, 0); // Consider 0 based indexing + this->parent.resize(n); + this->connectedComponents = n; // initally all are disconnected + for (int i = 0; i < n; i++) + { + this->parent[i] = i; + } +} + +/* + @param - node + @return - parent/representative element of node +*/ + +int DSU::findParent(int node) +{ + if (node == this->parent[node]) + { + return node; + } + return this->parent[node] = this->findParent(this->parent[node]); +} + +/* + @param - node x and nodex y whose union is to be done + @return - void +*/ + +void DSU::unionByRank(int x, int y) +{ + int parent_x = this->findParent(x); + int parent_y = this->findParent(y); + if (parent_x == parent_y) + { + return; + } + if (this->rank[parent_x] > this->rank[parent_y]) + { + this->parent[parent_y] = parent_x; + } + else if (this->rank[parent_x] < this->rank[parent_y]) + { + this->parent[parent_x] = parent_y; + } + else + { + this->parent[parent_y] = parent_x; + this->rank[parent_x]++; + } + this->connectedComponents--; +} + +/* + @param - nil + @return - Returns the number of connected components in the graph +*/ +int DSU::numberOfConnectedComponents() +{ + return this->connectedComponents; +} + +/* Main Function to test the DSU datastructure */ + +int main() +{ + DSU obj(6); // Nodes are 0,1,2,3,4,5 + cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; + cout << "Joining nodes 1 and 2\n"; + obj.unionByRank(1, 2); + cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; + cout << "Joining nodes 1 and 0\n"; + obj.unionByRank(1, 0); + cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; + cout << "Joining nodes 1 and 5\n"; + obj.unionByRank(1, 5); + cout << "Parent of node 0 is : " << obj.findParent(0) << "\n"; + cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; + cout << "Joining nodes 3 and 2\n"; + obj.unionByRank(3, 2); + cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; + cout << "Joining nodes 4 and 2\n"; + obj.unionByRank(4, 2); + cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; + return 0; +} \ No newline at end of file diff --git a/Trie/Trie.cpp b/Trie/Trie.cpp new file mode 100644 index 0000000..e999fd8 --- /dev/null +++ b/Trie/Trie.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +using namespace std; + +/* + A trie or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. + There are various applications of this data structure, such as autocomplete and spellchecker. + Some nuanced dynamic programming problems also use the trie data-structure to reduce its time complexity + + A trie Data-Structure maintains a node which can have atmost n-children(here it is 26 - total numbers of lowercase letters) + This forms a deeply nested tree which where each node can have atmost n children. + +*/ + +class TrieNode +{ +public: + bool isComplete; + TrieNode *children[26]; + TrieNode() + { + isComplete = false; // by default + memset(children, '\0', sizeof(children)); + } +}; + +class Trie +{ +public: + TrieNode *root; + Trie() + { + root = new TrieNode(); + } + + void insert(string word) + { + TrieNode *node = root; + for (auto ch : word) + { + int index = ch - 'a'; + if (node->children[index] == NULL) + { + node->children[index] = new TrieNode(); + } + node = node->children[index]; + } + node->isComplete = true; + } + + bool search(string word) + { + TrieNode *node = root; + for (auto ch : word) + { + int index = ch - 'a'; + if (node->children[index] == NULL) + return false; + node = node->children[index]; + } + return node->isComplete; + } + + bool startsWith(string prefix) + { + TrieNode *node = root; + for (auto ch : prefix) + { + int index = ch - 'a'; + if (node->children[index] == NULL) + return false; + node = node->children[index]; + } + return true; + } +}; + +/* Main function to test the working of trie */ +int main() +{ + Trie *obj = new Trie(); + obj->insert("AppleBee"); + obj->insert("Fardeen"); + obj->insert("Friendship"); + cout << "The given words inserted are: AppleBee, Fardeen, Friendship\n"; + if (obj->search("Friend")) + { + cout << "Friend was inserted in trie\n"; + } + else + { + cout << "Friend was not inserted in trie\n"; + } + if (obj->startsWith("Friend")) + { + cout << "Friend is a valid prefix\n"; + } + else + { + cout << "Friend is not a valid prefix\n"; + } + if (obj->startsWith("Far")) + { + cout << "Far is a valid prefix\n"; + } + else + { + cout << "Far is not a valid prefix\n"; + } + if (obj->search("AppleBee")) + { + cout << "AppleBee was inserted in trie\n"; + } + else + { + cout << "Applebee was not inserted in trie\n"; + } + return 0; +} \ No newline at end of file From fc2f8b4353dc405f38937a6136f8f76243122bac Mon Sep 17 00:00:00 2001 From: Yash Gaikwad <81979500+Yash493@users.noreply.github.com> Date: Wed, 4 Oct 2023 00:16:58 +0530 Subject: [PATCH 24/80] Create Reverse_Array.java Reversing an Array in java Using Recursion --- Reverse_an_array/Reverse_Array.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Reverse_an_array/Reverse_Array.java diff --git a/Reverse_an_array/Reverse_Array.java b/Reverse_an_array/Reverse_Array.java new file mode 100644 index 0000000..5467e90 --- /dev/null +++ b/Reverse_an_array/Reverse_Array.java @@ -0,0 +1,29 @@ +import java.util.Scanner; + +public class Main +{ + static void reverseRecursive(int arr[], int start, int end) + { + if (start >= end) + return; + + int temp = arr[start]; + arr[start] = arr[end]; + arr[end] = temp; + + // recursive call to swap arr[start+1] & arr[end-1] + reverseRecursive(arr, start + 1, end - 1); + } + public static void main(String args[]) + { + + int arr[] = {10, 20, 30, 40, 50}; + + int n=arr.length; + int start = 0, end = n-1; + reverseRecursive(arr, start, end); + + for(int i=0; i Date: Wed, 4 Oct 2023 11:22:29 +0530 Subject: [PATCH 25/80] binary search added --- binarySearch.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 binarySearch.cpp diff --git a/binarySearch.cpp b/binarySearch.cpp new file mode 100644 index 0000000..8d9d008 --- /dev/null +++ b/binarySearch.cpp @@ -0,0 +1,41 @@ +// C++ program to implement iterative Binary Search +// Time Complexity: O(log N) +// Auxiliary Space: O(1) +#include +using namespace std; + +// An iterative binary search function. +int binarySearch(int arr[], int l, int r, int x) +{ + while (l <= r) { + int m = l + (r - l) / 2; + + // Check if x is present at mid + if (arr[m] == x) + return m; + + // If x greater, ignore left half + if (arr[m] < x) + l = m + 1; + + // If x is smaller, ignore right half + else + r = m - 1; + } + + // If we reach here, then element was not present + return -1; +} + +// Driver code +int main(void) +{ + int arr[] = { 2, 3, 4, 10, 40 }; + int x = 10; + int n = sizeof(arr) / sizeof(arr[0]); + int result = binarySearch(arr, 0, n - 1, x); + (result == -1) + ? cout << "Element is not present in array" + : cout << "Element is present at index " << result; + return 0; +} From b538c1a02655a2b9b482f25df4bbe1836add3ace Mon Sep 17 00:00:00 2001 From: Ankita <115339717+AnkitaGupta2002@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:09:31 +0530 Subject: [PATCH 26/80] Kadane's algorithm --- Kadane's algorithm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Kadane's algorithm diff --git a/Kadane's algorithm b/Kadane's algorithm new file mode 100644 index 0000000..5ac0539 --- /dev/null +++ b/Kadane's algorithm @@ -0,0 +1,22 @@ +#include +#include + +int kadanesAlgorithm(std::vector& nums) { + int maxEndingHere = nums[0]; + int maxSoFar = nums[0]; + + for (int i = 1; i < nums.size(); i++) { + maxEndingHere = std::max(nums[i], maxEndingHere + nums[i]); + maxSoFar = std::max(maxSoFar, maxEndingHere); + } + + return maxSoFar; +} + +int main() { + std::vector nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4}; + int maxSum = kadanesAlgorithm(nums); + std::cout << "Maximum subarray sum: " << maxSum << std::endl; + + return 0; +} From 061e5329cd4e0aa6b435a25c60fb9dfa9f3e7621 Mon Sep 17 00:00:00 2001 From: Deepanshi <56440331+gargdeepanshi@users.noreply.github.com> Date: Wed, 4 Oct 2023 15:40:36 +0530 Subject: [PATCH 27/80] Create rotateimage.cpp code for rotate image --- rotateimage.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 rotateimage.cpp diff --git a/rotateimage.cpp b/rotateimage.cpp new file mode 100644 index 0000000..c58b4cc --- /dev/null +++ b/rotateimage.cpp @@ -0,0 +1,12 @@ +public: + void rotate(vector>& matrix) { + int row = matrix.size(); + for(int i=0;i Date: Wed, 4 Oct 2023 19:58:35 +0530 Subject: [PATCH 28/80] Added_count_frequency_of_array_items.cpp here is the code for count frequency of array elements in c++ programming language. --- count_frequency_of_array_items.cpp | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 count_frequency_of_array_items.cpp diff --git a/count_frequency_of_array_items.cpp b/count_frequency_of_array_items.cpp new file mode 100644 index 0000000..e4514aa --- /dev/null +++ b/count_frequency_of_array_items.cpp @@ -0,0 +1,63 @@ +// CPP program to count frequencies of array items✅ + + + +#include +using namespace std; + +void countFreq(int arr[], int n) +{ + // Mark all array elements as not visited + vector visited(n, false); + + // Traverse through array elements and + // count frequencies + + for (int i = 0; i < n; i++) { + + // Skip this element if already processed + + if (visited[i] == true) + continue; + + // Count frequency + int count = 1; + for (int j = i + 1; j < n; j++) { + if (arr[i] == arr[j]) { + visited[j] = true; + count++; + } + } + cout << arr[i] << " " << count << endl; + } +} + +//Main code +int main() +{ + int arr[] = { 10, 20, 20, 10, 10, 20, 5, 20 }; + int n = sizeof(arr) / sizeof(arr[0]); + countFreq(arr, n); + return 0; +} + // Complexity Analysis: + + // Time Complexity : O(n2) + // Auxiliary Space : O(n) +// Output + +// 10 3 +// 20 4 +// 5 1 + +// Examples: + +// Input : arr[] = {20, 20, 10, 10, 20, 5, 20} +// Output : 10 2 + // 20 4 + // 5 1 + +// Input : arr[] = {10,20} +// Output : 10 1 + // 20 1 + From cb7652c9e631515684de8e1140a1a9bed9d39162 Mon Sep 17 00:00:00 2001 From: Mahi Yadav <95998757+Mahi5902@users.noreply.github.com> Date: Wed, 4 Oct 2023 20:11:32 +0530 Subject: [PATCH 29/80] Create Count_number_of_subarray_having_given_xor.cpp here is my code in c++ for count number of subarray having given xor. here i have explained my approach with time complexity and space complexity . also explained examples for better understanding --- Count_number_of_subarray_having_given_xor.cpp | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Count_number_of_subarray_having_given_xor.cpp diff --git a/Count_number_of_subarray_having_given_xor.cpp b/Count_number_of_subarray_having_given_xor.cpp new file mode 100644 index 0000000..3fd268c --- /dev/null +++ b/Count_number_of_subarray_having_given_xor.cpp @@ -0,0 +1,74 @@ +// A simple C++ Program to count all subarrays having +// XOR of elements as given value m +// Given an array of integers arr[] and a number m, count the number of subarrays having XOR of their elements as m. +#include +using namespace std; + +// Simple function that returns count of subarrays +// of arr with XOR value equals to m +long long subarrayXor(int arr[], int n, int m) +{ + long long ans = 0; // Initialize ans + + // Pick starting point i of subarrays + for (int i = 0; i < n; i++) { + int xorSum = 0; // Store XOR of current subarray + + // Pick ending point j of subarray for each i + for (int j = i; j < n; j++) { + // calculate xorSum + xorSum = xorSum ^ arr[j]; + + // If xorSum is equal to given value, + // increase ans by 1. + if (xorSum == m) + ans++; + } + } + return ans; +} + +// MAIN program to test above function +int main() +{ + int arr[] = { 4, 2, 2, 6, 4 }; + int n = sizeof(arr) / sizeof(arr[0]); + int m = 6; + + cout << "Number of subarrays having given XOR is " + << subarrayXor(arr, n, m); + return 0; +} +// output +// Number of subarrays having given XOR is 4 +// Time Complexity: O(n2) +// Auxiliary Space: O(1) +// APPROACH +// 1) Initialize ans as 0. +// 2) Compute xorArr, the prefix xor-sum array. +// 3) Create a map mp in which we store count of +// all prefixes with XOR as a particular value. +// 4) Traverse xorArr and for each element in xorArr +// (A) If m^xorArr[i] XOR exists in map, then +// there is another previous prefix with +// same XOR, i.e., there is a subarray ending +// at i with XOR equal to m. We add count of +// all such subarrays to result. +// (B) If xorArr[i] is equal to m, increment ans by 1. +// (C) Increment count of elements having XOR-sum +// xorArr[i] in map by 1. +// 5) Return ans. + +// EXAMPLE: +// Input : arr[] = {4, 2, 2, 6, 4}, m = 6 +// Output : 4 +// Explanation : The subarrays having XOR of +// their elements as 6 are {4, 2}, +// {4, 2, 2, 6, 4}, {2, 2, 6}, +// and {6} + +// Input : arr[] = {5, 6, 7, 8, 9}, m = 5 +// Output : 2 +// Explanation : The subarrays having XOR of +// their elements as 5 are {5} +// and {5, 6, 7, 8, 9} From 3bd8ab8a6751c6755f2a48e21907ee896215b27e Mon Sep 17 00:00:00 2001 From: Saksham Porwal Date: Wed, 4 Oct 2023 21:20:38 +0530 Subject: [PATCH 30/80] Create BinarySearch.cpp --- BinarySearch.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 BinarySearch.cpp diff --git a/BinarySearch.cpp b/BinarySearch.cpp new file mode 100644 index 0000000..884c628 --- /dev/null +++ b/BinarySearch.cpp @@ -0,0 +1,39 @@ +// C++ program to implement iterative Binary Search +#include +using namespace std; + +// An iterative binary search function. +int binarySearch(int arr[], int l, int r, int x) +{ + while (l <= r) { + int m = l + (r - l) / 2; + + // Check if x is present at mid + if (arr[m] == x) + return m; + + // If x greater, ignore left half + if (arr[m] < x) + l = m + 1; + + // If x is smaller, ignore right half + else + r = m - 1; + } + + // If we reach here, then element was not present + return -1; +} + +// Driver code +int main(void) +{ + int arr[] = { 2, 3, 4, 10, 40 }; + int x = 10; + int n = sizeof(arr) / sizeof(arr[0]); + int result = binarySearch(arr, 0, n - 1, x); + (result == -1) + ? cout << "Element is not present in array" + : cout << "Element is present at index " << result; + return 0; +} From 448d641404ae8a862d65b8adca7cb185a1f35a78 Mon Sep 17 00:00:00 2001 From: hrushi2003 Date: Wed, 4 Oct 2023 22:04:13 +0530 Subject: [PATCH 31/80] added oddEvenCount in javaScript --- count_Even_Odd/countEvenOdd.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 count_Even_Odd/countEvenOdd.js diff --git a/count_Even_Odd/countEvenOdd.js b/count_Even_Odd/countEvenOdd.js new file mode 100644 index 0000000..e69de29 From 72966e74a08fe7adac5385a21a66e70173e95f3a Mon Sep 17 00:00:00 2001 From: vaishnavin01 <107188328+vaishnavin01@users.noreply.github.com> Date: Wed, 4 Oct 2023 23:42:01 +0530 Subject: [PATCH 32/80] Merge sort with better time complexity --- MergeSort/MergeSort.java | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 MergeSort/MergeSort.java diff --git a/MergeSort/MergeSort.java b/MergeSort/MergeSort.java new file mode 100644 index 0000000..9d13109 --- /dev/null +++ b/MergeSort/MergeSort.java @@ -0,0 +1,47 @@ + + +public class MergeSort { + public static void mergesort(int arr[],int si,int ei){ + if(si>=ei){ + return; + } + int mid=si+(ei-si)/2; + mergesort(arr, si, mid); + mergesort(arr, mid+1, ei); + merge(arr,si,mid,ei); + } + public static void merge(int arr[], int si, int mid, int ei) { + int temp[] = new int[ei - si + 1]; + int i = si; + int j = mid + 1; + int k = 0; + while (i <= mid && j <= ei) { + if (arr[i] < arr[j]) { + temp[k] = arr[i]; + i++; + k++; + } else { + temp[k] = arr[j]; + j++; + k++; + } + } + while (i <= mid) { + temp[k++] = arr[i++]; + } + while (j <= ei) { + temp[k++] = arr[j++]; + } + for (k = 0, i = si; k < temp.length; k++, i++) { + arr[i] = temp[k]; + } + } + + public static void main(String[] args) { + int arr[]={6,3,9,5,2,8}; + mergesort(arr,0,5); + for(int ele :arr){ + System.out.print(ele+" "); + } + } +} From cb2011a28180da15a7f4da21396326015d4893a9 Mon Sep 17 00:00:00 2001 From: Legend015 Date: Thu, 5 Oct 2023 10:18:56 +0530 Subject: [PATCH 33/80] added the program which contain so many operation on bits(bit manipulation) --- BIT_MANIPULATION.cpp | 79 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 BIT_MANIPULATION.cpp diff --git a/BIT_MANIPULATION.cpp b/BIT_MANIPULATION.cpp new file mode 100644 index 0000000..c3ca914 --- /dev/null +++ b/BIT_MANIPULATION.cpp @@ -0,0 +1,79 @@ +#include +using namespace std; +int getbit(int n, int pos) +{ + return ((n & (1 << pos)) != 0); +} +int setbit(int n, int pos) +{ + return (n | (1 << pos)); +} +int clearbit(int n, int pos) +{ + int mask = ~(1 << pos); + return (n & mask); +} +int updatebit(int n, int pos, int value) +{ + int mask = ~(1 << pos); + n = (n & mask); + return (n | (value << pos)); +} +int main() +{ + cout << "ENTER THE KEY AS PER YOUR TASK:" << endl; + int n; + bool check = true; + while (check) + { + int a, pos; + cout << "\n1)ENTER 1 FOR CHECKING WHICH BIT IS PRESENT AT THAT POSITION" << endl; + cout << "2)ENTER 2 FOR SETTING A BIT ON THAT POSITION" << endl; + cout << "3)ENTER 3 FOR SETTING BIT TO ZERO ON THAT POSITION" << endl; + cout << "4)ENTER 4 FOR UPDATE BIT ON THAT POSITION" << endl; + cout << "5)ENTER 5 FOR EXIT" << endl; + cin>>n; + switch (n) + { + case 1: + cout << "ENTER THE NO: "; + cin >> a; + cout << "ENTER THE POSITION WHERE YOU WANT TO CHECK: "; + cin >> pos; + cout << "THE BIT AT "<> a; + cout << "ENTER THE POSITION WHERE YOU WANT TO SET A BIT: "; + cin >> pos; + cout << "NO AFTER SETTING A BIT IS "<> a; + cout << "ENTER THE POSITION WHERE YOU WANT TO CLEAR A BIT: "; + cin >> pos; + cout << "NEW NO IS "<> a; + cout << "ENTER THE POSITION WHERE YOU WANT TO CHANGE: "; + cin >> pos; + bool bit; + cout<<"ENTER THE BIT TO WHICH YOU WANT TO CHANGE: "; + cin>>bit; + cout <<"NEW NO IS "<< updatebit(a, pos, bit); + break; + case 5: + check = false; + break; + default: + cout << "YOU ENTER WRONG KEY.." << endl; + break; + } + } + + return 0; +} \ No newline at end of file From 2bc52f58755ab450804e29afc23e5931e9611e0b Mon Sep 17 00:00:00 2001 From: Piyush Gambhir <90608533+Piyush-Gambhir@users.noreply.github.com> Date: Thu, 5 Oct 2023 12:57:50 +0530 Subject: [PATCH 34/80] Added Java Program To Count Even and Odd Numbers --- .../Solution.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 count_number_of_odd_even_elements/Solution.java diff --git a/count_number_of_odd_even_elements/Solution.java b/count_number_of_odd_even_elements/Solution.java new file mode 100644 index 0000000..c7e5852 --- /dev/null +++ b/count_number_of_odd_even_elements/Solution.java @@ -0,0 +1,29 @@ +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + // Read the size of the array + System.out.print("Enter the size of the array: "); + int n = sc.nextInt(); + + int[] arr = new int[n]; + System.out.println("Enter the elements of the array:"); + for (int i = 0; i < n; i++) { + arr[i] = sc.nextInt(); + } + + int countOdd = 0; + int countEven = 0; + for (int i = 0; i < n; i++) { + if (arr[i] % 2 == 0) { + countEven++; + } else { + countOdd++; + } + } + System.out.println("Number of odd elements: " + countOdd); + System.out.println("Number of even elements: " + countEven); + } +} From 86b36aab314dc09558760523031d25106b385bed Mon Sep 17 00:00:00 2001 From: Piyush Gambhir <90608533+Piyush-Gambhir@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:02:49 +0530 Subject: [PATCH 35/80] Added Java Program to Sort Elements of an Array --- sort_elements_of_array/Solution.java | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 sort_elements_of_array/Solution.java diff --git a/sort_elements_of_array/Solution.java b/sort_elements_of_array/Solution.java new file mode 100644 index 0000000..5a0935e --- /dev/null +++ b/sort_elements_of_array/Solution.java @@ -0,0 +1,31 @@ +import java.util.Arrays; +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner input = new Scanner(System.in); + System.out.print("Enter the size of the array: "); + int n = input.nextInt(); + int[] arr = new int[n]; + System.out.println("Enter the elements of the array:"); + for (int i = 0; i < n; i++) { + arr[i] = input.nextInt(); + } + System.out.println("Original array: " + Arrays.toString(arr)); + bubbleSort(arr); + System.out.println("Sorted array: " + Arrays.toString(arr)); + } + + public static void bubbleSort(int[] arr) { + int n = arr.length; + for (int i = 0; i < n - 1; i++) { + for (int j = 0; j < n - i - 1; j++) { + if (arr[j] > arr[j + 1]) { + int temp = arr[j]; + arr[j] = arr[j + 1]; + arr[j + 1] = temp; + } + } + } + } +} From a87168554ed5c1fc69b72e29305e9a1c7d6d4994 Mon Sep 17 00:00:00 2001 From: aarth01 <124595906+aarth01@users.noreply.github.com> Date: Fri, 6 Oct 2023 20:16:40 +0530 Subject: [PATCH 36/80] Create smallest element in array.c --- smallest element in array.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 smallest element in array.c diff --git a/smallest element in array.c b/smallest element in array.c new file mode 100644 index 0000000..6a4f575 --- /dev/null +++ b/smallest element in array.c @@ -0,0 +1,26 @@ +#include +int findSmallest(int arr[], int n) { + if (n <= 0) { + printf("Array is empty.\n"); + return -1; // Return an indicator for an error or empty array + } + int smallest = arr[0]; + for (int i = 1; i < n; i++) { + if (arr[i] < smallest) { + smallest = arr[i]; + } + } + + return smallest; +} + +int main() { + // Example usage + int array[] = {4, 2, 8, 1, 6}; + int size = sizeof(array) / sizeof(array[0]); + int smallest = findSmallest(array, size); + if (smallest != -1) { + printf("The smallest element in the array is: %d\n", smallest); + } + return 0; +} From 359c5116f664b69776031b7944e68c52c6da03a3 Mon Sep 17 00:00:00 2001 From: Chirag Chandel <94798593+Chiragchandel2000@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:40:59 +0530 Subject: [PATCH 37/80] Create To find longest palindrome in a array --- To find longest palindrome in a array | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 To find longest palindrome in a array diff --git a/To find longest palindrome in a array b/To find longest palindrome in a array new file mode 100644 index 0000000..e01c651 --- /dev/null +++ b/To find longest palindrome in a array @@ -0,0 +1,45 @@ +#include +#include + +// Function to find the longest palindrome subarray +std::vector findLongestPalindromeSubarray(const std::vector& arr) { + int n = arr.size(); + std::vector longestPalindromeSubarray; + + for (int i = 0; i < n; i++) { + for (int j = i; j < n; j++) { + bool isPalindrome = true; + for (int left = i, right = j; left < right; left++, right--) { + if (arr[left] != arr[right]) { + isPalindrome = false; + break; + } + } + + if (isPalindrome && (j - i + 1) > longestPalindromeSubarray.size()) { + longestPalindromeSubarray = std::vector(arr.begin() + i, arr.begin() + j + 1); + } + } + } + + return longestPalindromeSubarray; +} + +int main() { + std::vector arr = {1, 2, 3, 4, 3, 5, 6, 7, 7, 6, 5}; + + // Find the longest palindrome subarray + std::vector longestPalindromeSubarray = findLongestPalindromeSubarray(arr); + + if (longestPalindromeSubarray.empty()) { + std::cout << "No palindrome subarray found." << std::endl; + } else { + std::cout << "Longest palindrome subarray: "; + for (int num : longestPalindromeSubarray) { + std::cout << num << " "; + } + std::cout << std::endl; + } + + return 0; +} From f7c58ebab50e4bd9b407d71d6cd18477bc845133 Mon Sep 17 00:00:00 2001 From: Chirag Chandel <94798593+Chiragchandel2000@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:49:47 +0530 Subject: [PATCH 38/80] Create To find all repeating elements in an array. --- To find all repeating elements in an array. | 48 +++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 To find all repeating elements in an array. diff --git a/To find all repeating elements in an array. b/To find all repeating elements in an array. new file mode 100644 index 0000000..a0d155d --- /dev/null +++ b/To find all repeating elements in an array. @@ -0,0 +1,48 @@ +#include +#include +#include + +// Function to find repeating elements in an integer array +std::vector findRepeatingElements(const std::vector& arr) { + std::vector result; + std::unordered_set seen; + + for (int num : arr) { + if (seen.find(num) != seen.end()) { + // If the number is already in the set, it's a duplicate + result.push_back(num); + } else { + // Otherwise, add it to the set + seen.insert(num); + } + } + + return result; +} + +int main() { + int n; + std::cout << "Enter the number of elements in the array: "; + std::cin >> n; + + std::vector arr(n); + + std::cout << "Enter the elements of the array: "; + for (int i = 0; i < n; i++) { + std::cin >> arr[i]; + } + + std::vector repeatingElements = findRepeatingElements(arr); + + if (repeatingElements.empty()) { + std::cout << "No repeating elements found in the array." << std::endl; + } else { + std::cout << "Repeating elements in the array: "; + for (int num : repeatingElements) { + std::cout << num << " "; + } + std::cout << std::endl; + } + + return 0; +} From e6d4f97f291354ceba40657dc25b4b40c57cc0a7 Mon Sep 17 00:00:00 2001 From: Chirag Chandel <94798593+Chiragchandel2000@users.noreply.github.com> Date: Fri, 6 Oct 2023 22:53:31 +0530 Subject: [PATCH 39/80] Create To check if two arrays are disjoint or not --- To check if two arrays are disjoint or not | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 To check if two arrays are disjoint or not diff --git a/To check if two arrays are disjoint or not b/To check if two arrays are disjoint or not new file mode 100644 index 0000000..5d7df07 --- /dev/null +++ b/To check if two arrays are disjoint or not @@ -0,0 +1,57 @@ +#include +#include +#include + +// Function to check if two arrays are disjoint +bool areArraysDisjoint(const std::vector& arr1, const std::vector& arr2) { + std::unordered_set set1; + + // Add elements from the first array to the set + for (int num : arr1) { + set1.insert(num); + } + + // Check if any element in the second array is present in the set + for (int num : arr2) { + if (set1.find(num) != set1.end()) { + // A common element is found, so the arrays are not disjoint + return false; + } + } + + // No common elements were found, so the arrays are disjoint + return true; +} + +int main() { + int n1, n2; + std::cout << "Enter the number of elements in the first array: "; + std::cin >> n1; + + std::vector arr1(n1); + + std::cout << "Enter the elements of the first array: "; + for (int i = 0; i < n1; i++) { + std::cin >> arr1[i]; + } + + std::cout << "Enter the number of elements in the second array: "; + std::cin >> n2; + + std::vector arr2(n2); + + std::cout << "Enter the elements of the second array: "; + for (int i = 0; i < n2; i++) { + std::cin >> arr2[i]; + } + + bool isDisjoint = areArraysDisjoint(arr1, arr2); + + if (isDisjoint) { + std::cout << "The two arrays are disjoint." << std::endl; + } else { + std::cout << "The two arrays are not disjoint." << std::endl; + } + + return 0; +} From 138e8df442c13c520992d2885e321021b52ddcad Mon Sep 17 00:00:00 2001 From: ayushiGautam-0110 <147130427+ayushiGautam-0110@users.noreply.github.com> Date: Sat, 7 Oct 2023 10:10:31 +0530 Subject: [PATCH 40/80] Create Pairwise swap elements of a linked list --- Pairwise swap elements of a linked list | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Pairwise swap elements of a linked list diff --git a/Pairwise swap elements of a linked list b/Pairwise swap elements of a linked list new file mode 100644 index 0000000..f08b947 --- /dev/null +++ b/Pairwise swap elements of a linked list @@ -0,0 +1,64 @@ +#include +using namespace std; + +// Definition for singly-linked list. +struct Node { + int data; + Node* next; + Node(int x) : data(x), next(nullptr) {} +}; + +class Solution { +public: + Node* pairWiseSwap(Node* head) { + if (head == nullptr || head->next == nullptr) { + return head; + } + + Node* prev = head; + Node* curr = head->next; + head = curr; // New head after swapping + + while (true) { + Node* nextNode = curr->next; + curr->next = prev; // Swapping nodes + + if (nextNode == nullptr || nextNode->next == nullptr) { + prev->next = nextNode; + break; + } + + prev->next = nextNode->next; // Connecting previous swapped pair to the next pair + prev = nextNode; // Moving the prev pointer to the end of the current pair + curr = prev->next; // Moving the curr pointer to the start of the next pair + } + + return head; + } +}; + +// Function to print the linked list +void printList(Node* head) { + while (head != nullptr) { + cout << head->data << " "; + head = head->next; + } + cout << endl; +} + +int main() { + Node* head = new Node(1); + head->next = new Node(2); + head->next->next = new Node(3); + head->next->next->next = new Node(4); + + Solution obj; + cout << "Original Linked List: "; + printList(head); + + Node* newHead = obj.pairWiseSwap(head); + cout << "Linked List after pairwise swapping: "; + printList(newHead); + + return 0; +} From 624623c10aceba67ce05287f1e9207239e2a4ac9 Mon Sep 17 00:00:00 2001 From: Utkarsh Trivedi <104593332+UtkarshTrivedi2934@users.noreply.github.com> Date: Sun, 8 Oct 2023 10:41:14 +0530 Subject: [PATCH 41/80] Create KahnsAlgo.cpp For Topological sort in Graphs --- KahnsAlgo.cpp | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 KahnsAlgo.cpp diff --git a/KahnsAlgo.cpp b/KahnsAlgo.cpp new file mode 100644 index 0000000..e8cad78 --- /dev/null +++ b/KahnsAlgo.cpp @@ -0,0 +1,93 @@ +//{ Driver Code Starts +#include +using namespace std; + +// } Driver Code Ends +class Solution +{ + public: + //Function to return list containing vertices in Topological order. + vector topoSort(int V, vector adj[]) + { + queue q; + vector ans; + + vector indegree(V,0); + + for(int i = 0;i &res, vector adj[]) { + + if(V!=res.size()) + return 0; + + vector map(V, -1); + for (int i = 0; i < V; i++) { + map[res[i]] = i; + } + for (int i = 0; i < V; i++) { + for (int v : adj[i]) { + if (map[i] > map[v]) return 0; + } + } + return 1; +} + +int main() { + int T; + cin >> T; + while (T--) { + int N, E; + cin >> E >> N; + int u, v; + + vector adj[N]; + + for (int i = 0; i < E; i++) { + cin >> u >> v; + adj[u].push_back(v); + } + + Solution obj; + vector res = obj.topoSort(N, adj); + + cout << check(N, res, adj) << endl; + } + + return 0; +} +// } Driver Code Ends From 918603daf49b55a2acbf5a166f1a7953b4ee8dbc Mon Sep 17 00:00:00 2001 From: Swayams Bisoyi Date: Sun, 8 Oct 2023 11:36:27 +0530 Subject: [PATCH 42/80] Create searchInRotArray.java --- searchInRotArray.java | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 searchInRotArray.java diff --git a/searchInRotArray.java b/searchInRotArray.java new file mode 100644 index 0000000..93dc525 --- /dev/null +++ b/searchInRotArray.java @@ -0,0 +1,33 @@ +// path -> use two pointers , keep a track of mid value , check condition , update mid value , return answer + + + + +class Solution { + public int search(int[] nums, int target) { + int left = 0; + int right = nums.length - 1; + + while (left <= right) { + int mid = (left + right) / 2; + + if (nums[mid] == target) { + return mid; + } else if (nums[mid] >= nums[left]) { + if (nums[left] <= target && target <= nums[mid]) { + right = mid - 1; + } else { + left = mid + 1; + } + } else { + if (nums[mid] <= target && target <= nums[right]) { + left = mid + 1; + } else { + right = mid - 1; + } + } + } + + return -1; + } +} From fca750b2f0e7bccaaf77b341f5b43a2f6332d316 Mon Sep 17 00:00:00 2001 From: Syeda Nida Fathima <143437787+nida242004@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:12:17 +0530 Subject: [PATCH 43/80] Create longest_palindrome_in_array --- longest_palindrome_in_array | 1 + 1 file changed, 1 insertion(+) create mode 100644 longest_palindrome_in_array diff --git a/longest_palindrome_in_array b/longest_palindrome_in_array new file mode 100644 index 0000000..07e887c --- /dev/null +++ b/longest_palindrome_in_array @@ -0,0 +1 @@ +//code to be updated From d4abf43c0c3207a4edb270be4934aca1aef1ccf2 Mon Sep 17 00:00:00 2001 From: Syeda Nida Fathima <143437787+nida242004@users.noreply.github.com> Date: Sun, 8 Oct 2023 16:19:48 +0530 Subject: [PATCH 44/80] Update longest_palindrome_in_array code to find the longest palindrome in an array added --- longest_palindrome_in_array | 46 ++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/longest_palindrome_in_array b/longest_palindrome_in_array index 07e887c..e4ac858 100644 --- a/longest_palindrome_in_array +++ b/longest_palindrome_in_array @@ -1 +1,45 @@ -//code to be updated +#include +#include + +bool isPalindrome(int n) { + int reversed = 0; + int original = n; + + while (n > 0) { + int digit = n % 10; + reversed = reversed * 10 + digit; + n /= 10; + } + + return original == reversed; +} + +int largestPalindrome(const std::vector& arr) { + int currentMax = -1; + + for (int i = 0; i < arr.size(); i++) { + if (arr[i] > currentMax && isPalindrome(arr[i])) { + currentMax = arr[i]; + } + } + + return currentMax; +} + +int main() { + int A[] = {1, 232, 54545, 999991}; + int n = sizeof(A) / sizeof(A[0]); + + std::vector arr(A, A + n); + + int largestPalin = largestPalindrome(arr); + + if (largestPalin != -1) { + std::cout << "The largest palindrome in the array is: " << largestPalin << std::endl; + } else { + std::cout << "No palindrome found in the array." << std::endl; + } + + return 0; +} + From e66a67fd4d8c78e0b34bd05f3716960f0f165723 Mon Sep 17 00:00:00 2001 From: Aheri7 <87425148+Aheri7@users.noreply.github.com> Date: Sun, 8 Oct 2023 17:32:51 +0530 Subject: [PATCH 45/80] Create Pigeonhole Sort I have added the code of pigeonhole sort in cpp, pls verify and merge it. --- Pigeonhole Sort | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Pigeonhole Sort diff --git a/Pigeonhole Sort b/Pigeonhole Sort new file mode 100644 index 0000000..0eda01c --- /dev/null +++ b/Pigeonhole Sort @@ -0,0 +1,54 @@ +/* C++ program to implement Pigeonhole Sort */ +#include +using namespace std; + +/* Sorts the array using pigeonhole algorithm */ +void pigeonholeSort(int arr[], int n) +{ + // Find minimum and maximum values in arr[] + int min = arr[0], max = arr[0]; + for (int i = 1; i < n; i++) + { + if (arr[i] < min) + min = arr[i]; + if (arr[i] > max) + max = arr[i]; + } + int range = max - min + 1; // Find range + + // Create an array of vectors. Size of array + // range. Each vector represents a hole that + // is going to contain matching elements. + vector holes[range]; + + // Traverse through input array and put every + // element in its respective hole + for (int i = 0; i < n; i++) + holes[arr[i]-min].push_back(arr[i]); + + // Traverse through all holes one by one. For + // every hole, take its elements and put in + // array. + int index = 0; // index in sorted array + for (int i = 0; i < range; i++) + { + vector::iterator it; + for (it = holes[i].begin(); it != holes[i].end(); ++it) + arr[index++] = *it; + } +} + +// Driver program to test the above function +int main() +{ + int arr[] = {8, 3, 2, 7, 4, 6, 8}; + int n = sizeof(arr)/sizeof(arr[0]); + + pigeonholeSort(arr, n); + + printf("Sorted order is : "); + for (int i = 0; i < n; i++) + printf("%d ", arr[i]); + + return 0; +} From 9ccb0da65fe63e05cd77001d07cc5648264d35e1 Mon Sep 17 00:00:00 2001 From: anuj-kashyap <116073648+anuj-kashyap@users.noreply.github.com> Date: Mon, 9 Oct 2023 11:28:18 +0530 Subject: [PATCH 46/80] Create if a number is an Armstrong Number --- if a number is an Armstrong Number.java | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 if a number is an Armstrong Number.java diff --git a/if a number is an Armstrong Number.java b/if a number is an Armstrong Number.java new file mode 100644 index 0000000..7f811c3 --- /dev/null +++ b/if a number is an Armstrong Number.java @@ -0,0 +1,26 @@ +import java.util.Scanner; + +public class ArmstrongNumber { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + System.out.print("Enter a number: "); + int number = scanner.nextInt(); + scanner.close(); + + int originalNumber = number; + int numDigits = String.valueOf(number).length(); + int sum = 0; + + while (number > 0) { + int digit = number % 10; + sum += Math.pow(digit, numDigits); + number /= 10; + } + + if (sum == originalNumber) { + System.out.println(originalNumber + " is an Armstrong number."); + } else { + System.out.println(originalNumber + " is not an Armstrong number."); + } + } +} From c700ef08f6d4b29c4db345bd66ec63375b1d5d63 Mon Sep 17 00:00:00 2001 From: ss987 <98395295+ss987@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:09:01 +0530 Subject: [PATCH 47/80] Create rotate_array_right.cpp --- rotate.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 rotate.cpp diff --git a/rotate.cpp b/rotate.cpp new file mode 100644 index 0000000..e0fe0b0 --- /dev/null +++ b/rotate.cpp @@ -0,0 +1,45 @@ +#include +#include +#include +using namespace std; + +void rotate(vector& nums, int k) { + k = k % nums.size(); + reverse(nums.begin(), nums.end() - k); + reverse(nums.end() - k, nums.end()); + reverse(nums.begin(), nums.end()); +} + +int main() { + vector nums; + int n, k; + + cout << "Enter the number of elements in the array: "; + cin >> n; + + cout << "Enter " << n << " elements: "; + for (int i = 0; i < n; ++i) { + int num; + cin >> num; + nums.push_back(num); + } + + cout << "Enter the number of positions to rotate to the right: "; + cin >> k; + + cout << "Original Array: "; + for (const auto& num : nums) { + cout << num << " "; + } + cout << endl; + + rotate(nums, k); + + cout << "Array after rotating by " << k << " positions to the right: "; + for (const auto& num : nums) { + cout << num << " "; + } + cout << endl; + + return 0; +} From 0926837f43ebad076b49c470beee6f800394784e Mon Sep 17 00:00:00 2001 From: Rahul Sinha <87859957+rahul12043@users.noreply.github.com> Date: Wed, 11 Oct 2023 19:56:53 +0530 Subject: [PATCH 48/80] Create CheckEvenandOddInArray.cpp --- CheckEvenandOddInArray.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 CheckEvenandOddInArray.cpp diff --git a/CheckEvenandOddInArray.cpp b/CheckEvenandOddInArray.cpp new file mode 100644 index 0000000..53f3dd4 --- /dev/null +++ b/CheckEvenandOddInArray.cpp @@ -0,0 +1,35 @@ +#include +using namespace std; + +int main(){ + +int size; +cout<<"Enter Size of Array: "; +cin>>size; + +int arr[size]; + +cout<<" Enter Elements in the array: "; + +for(int i=0; i>arr[i]; +} + +cout<<" Even elements: "; + +for(int i=0; i Date: Wed, 11 Oct 2023 22:14:58 +0530 Subject: [PATCH 49/80] added C scripts of Dynamic Programming --- Greedy_Knapsack.c | 60 ++++++++++++++++++++++++++++++++++ LCS.c | 57 ++++++++++++++++++++++++++++++++ SCS.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 200 insertions(+) create mode 100644 Greedy_Knapsack.c create mode 100644 LCS.c create mode 100644 SCS.c diff --git a/Greedy_Knapsack.c b/Greedy_Knapsack.c new file mode 100644 index 0000000..dab1245 --- /dev/null +++ b/Greedy_Knapsack.c @@ -0,0 +1,60 @@ +#include +#include + +// Structure to represent an item +struct Item { + int weight; + int value; +}; + +// Function to compare items by their value-to-weight ratio +int compare(const void* a, const void* b) { + double ratioA = ((struct Item*)a)->value / (double)((struct Item*)a)->weight; + double ratioB = ((struct Item*)b)->value / (double)((struct Item*)b)->weight; + return (ratioB > ratioA) - (ratioB < ratioA); +} + +// Greedy Knapsack Algorithm +void knapsack(struct Item items[], int n, int capacity) { + // Sort items by their value-to-weight ratio in descending order + qsort(items, n, sizeof(struct Item), compare); + + int currentWeight = 0; // Current weight in the knapsack + double totalValue = 0.0; // Total value in the knapsack + + // Loop through the sorted items + for (int i = 0; i < n; i++) { + if (currentWeight + items[i].weight <= capacity) { + // Include the whole item as it fits in the knapsack + currentWeight += items[i].weight; + totalValue += items[i].value; + } else { + // Include a fraction of the item to fill the knapsack + int remainingCapacity = capacity - currentWeight; + totalValue += (items[i].value / (double)items[i].weight) * remainingCapacity; + break; // Knapsack is full + } + } + + printf("Maximum value in the knapsack: %.2lf\n", totalValue); +} + +int main() { + int n, capacity; + + printf("Enter the number of items: "); + scanf("%d", &n); + printf("Enter the knapsack capacity: "); + scanf("%d", &capacity); + + struct Item items[n]; + + printf("Enter the weight and value of each item:\n"); + for (int i = 0; i < n; i++) { + scanf("%d %d", &items[i].weight, &items[i].value); + } + + knapsack(items, n, capacity); + + return 0; +} diff --git a/LCS.c b/LCS.c new file mode 100644 index 0000000..6939309 --- /dev/null +++ b/LCS.c @@ -0,0 +1,57 @@ +//Script to find the largest common subsequence +#include +#include + +int max(int a, int b) { + return (a > b) ? a : b; +} + +void lcs(char *X, char *Y, int m, int n) { + int L[m + 1][n + 1]; + + // Build the LCS matrix + for (int i = 0; i <= m; i++) { + for (int j = 0; j <= n; j++) { + if (i == 0 || j == 0) + L[i][j] = 0; + else if (X[i - 1] == Y[j - 1]) + L[i][j] = L[i - 1][j - 1] + 1; + else + L[i][j] = max(L[i - 1][j], L[i][j - 1]); + } + } + + // Find the LCS length + int length = L[m][n]; + + // Create an array to store the LCS + char lcs[length + 1]; + lcs[length] = '\0'; + + int i = m, j = n; + while (i > 0 && j > 0) { + if (X[i - 1] == Y[j - 1]) { + lcs[length - 1] = X[i - 1]; + i--; + j--; + length--; + } else if (L[i - 1][j] > L[i][j - 1]) + i--; + else + j--; + } + + printf("Longest Common Subsequence: %s\n", lcs); +} + +int main() { + char X[] = "AGGTAB"; + char Y[] = "GXTXAYB"; + + int m = strlen(X); + int n = strlen(Y); + + lcs(X, Y, m, n); + + return 0; +} diff --git a/SCS.c b/SCS.c new file mode 100644 index 0000000..c93cc41 --- /dev/null +++ b/SCS.c @@ -0,0 +1,83 @@ +//Script to find the Shortest COmmon Subsequence +#include +#include + +int max(int a, int b) { + return (a > b) ? a : b; +} + +int shortestCommonSupersequenceLength(char X[], char Y[]) { + int m = strlen(X); + int n = strlen(Y); + + int dp[m + 1][n + 1]; + + for (int i = 0; i <= m; i++) { + for (int j = 0; j <= n; j++) { + if (i == 0) + dp[i][j] = j; + else if (j == 0) + dp[i][j] = i; + else if (X[i - 1] == Y[j - 1]) + dp[i][j] = 1 + dp[i - 1][j - 1]; + else + dp[i][j] = 1 + max(dp[i - 1][j], dp[i][j - 1]); + } + } + + return dp[m][n]; +} + +void printSCS(char X[], char Y[]) { + int m = strlen(X); + int n = strlen(Y); + int SCSLength = shortestCommonSupersequenceLength(X, Y); + char SCS[SCSLength + 1]; + + int i = m, j = n, k = SCSLength; + + while (i > 0 && j > 0) { + if (X[i - 1] == Y[j - 1]) { + SCS[k - 1] = X[i - 1]; + i--; + j--; + k--; + } else if (dp[i - 1][j] > dp[i][j - 1]) { + SCS[k - 1] = X[i - 1]; + i--; + k--; + } else { + SCS[k - 1] = Y[j - 1]; + j--; + k--; + } + } + + while (i > 0) { + SCS[k - 1] = X[i - 1]; + i--; + k--; + } + + while (j > 0) { + SCS[k - 1] = Y[j - 1]; + j--; + k--; + } + + SCS[SCSLength] = '\0'; + + printf("Shortest Common Supersequence: %s\n", SCS); +} + +int main() { + char X[] = "ABCBDAB"; + char Y[] = "BDCABA"; + + int SCSLength = shortestCommonSupersequenceLength(X, Y); + printf("Length of Shortest Common Supersequence: %d\n", SCSLength); + + printSCS(X, Y); + + return 0; +} From 49b59057a49713c8ceb30b555fc795b704470bfa Mon Sep 17 00:00:00 2001 From: Subrat <110958990+Subrat29@users.noreply.github.com> Date: Thu, 12 Oct 2023 01:12:38 +0530 Subject: [PATCH 50/80] Create quickSort.cpp This is a quickSort algorithm code, could you please review it. --- quickSort.cpp | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 quickSort.cpp diff --git a/quickSort.cpp b/quickSort.cpp new file mode 100644 index 0000000..b2f56b5 --- /dev/null +++ b/quickSort.cpp @@ -0,0 +1,75 @@ +#include +using namespace std; + +int partion(int *arr, int s, int e) +{ + // Take pivot + int p = arr[s]; + int cnt = 0; + + // find right posn of pivot + for (int i = s + 1; i <= e; i++) + { + if (arr[i] <= p) + cnt++; + } + + // place pivot at right position + int pIndex = s + cnt; + swap(arr[pIndex], arr[s]); + + // Now, partion kro + int i = s; + int j = e; + + while (i < pIndex && j > pIndex) + { + while (arr[i] < p) // left part + { + i++; + } + + while (arr[j] > p) + { + j--; + } + + if (i < pIndex && j > pIndex) + { + swap(arr[i++], arr[j--]); + } + } + return pIndex; +} + +void quickSort(int *arr, int s, int e) +{ + // base case + if (s >= e) + return; + + // partition + int pivot = partion(arr, s, e); + + // left part sort + quickSort(arr, s, pivot - 1); + + // right part sort + quickSort(arr, pivot + 1, e); +} + +int main() +{ + int arr[] = {3, 1, 4, 5, 2}; + int n = sizeof(arr) / sizeof(int); + + quickSort(arr, 0, n - 1); + + cout << "Quick Sorting" << endl; + for (int i = 0; i < n; i++) + { + cout << arr[i] << " "; + } + + return 0; +} From 296850af663845c9e2e37d32fc2aeadc85bb36e7 Mon Sep 17 00:00:00 2001 From: NickSahu <4uamystery@gmail.com> Date: Thu, 12 Oct 2023 15:17:56 +0530 Subject: [PATCH 51/80] palindrome checker --- .vscode/settings.json | 5 - BIT_MANIPULATION.cpp | 79 ---------- BinarySearch.cpp | 39 ----- BubbleSort.java | 35 ----- CONTRIBUTING.md | 62 -------- Count_number_of_subarray_having_given_xor.cpp | 74 --------- Disjoint Set Union/DisjointSetUnion.cpp | 145 ------------------ InsertionSort.java | 30 ---- Kadane's Algorithm.cpp | 21 --- Kadane's algorithm | 22 --- KahnsAlgo.cpp | 93 ----------- Knapsack.py | 32 ---- MergeSort/MergeSort.java | 47 ------ Pairwise swap elements of a linked list | 64 -------- Pigeonhole Sort | 54 ------- README.md | 62 -------- Reverse_an_array/Reverse_Array.java | 29 ---- Reverse_an_array/Reverse_an_array.cpp | 37 ----- Reverse_an_array/Reverse_an_array.exe | Bin 44846 -> 0 bytes To check if two arrays are disjoint or not | 57 ------- To find all repeating elements in an array. | 48 ------ To find longest palindrome in a array | 45 ------ Trie/Trie.cpp | 120 --------------- array_sum.cpp | 22 --- binarySearch.cpp | 41 ----- count_Even_Odd/countEvenOdd.class | Bin 1112 -> 0 bytes count_Even_Odd/countEvenOdd.cpp | 27 ---- count_Even_Odd/countEvenOdd.exe | Bin 44775 -> 0 bytes count_Even_Odd/countEvenOdd.java | 24 --- count_Even_Odd/countEvenOdd.js | 0 count_Even_Odd/countEvenOdd.py | 18 --- count_frequency_of_array_items.cpp | 63 -------- .../Solution.java | 29 ---- countingevenodd.c | 34 ---- factorial.c | 21 --- findDisjoint/disjointOrNot.cpp | 52 ------- .../Solution.java | 25 --- finding_repeating_elements.c | 45 ------ if a number is an Armstrong Number.java | 26 ---- largestelement.c | 35 ----- longest_palindrome_in_array | 45 ------ .../Solution.java | 24 --- palindrome.cpp | 33 ++++ removingDuplicates/removeDupFromArray.cpp | 37 ----- reverse_an_array.c | 43 ------ rotateimage.cpp | 12 -- searchInRotArray.java | 33 ---- shell_sort/shell_sort.cpp | 34 ---- smallest element in array.c | 26 ---- sort_elements_of_array/Solution.java | 31 ---- turtle.py | 59 ------- 51 files changed, 33 insertions(+), 2006 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 BIT_MANIPULATION.cpp delete mode 100644 BinarySearch.cpp delete mode 100644 BubbleSort.java delete mode 100644 CONTRIBUTING.md delete mode 100644 Count_number_of_subarray_having_given_xor.cpp delete mode 100644 Disjoint Set Union/DisjointSetUnion.cpp delete mode 100644 InsertionSort.java delete mode 100644 Kadane's Algorithm.cpp delete mode 100644 Kadane's algorithm delete mode 100644 KahnsAlgo.cpp delete mode 100644 Knapsack.py delete mode 100644 MergeSort/MergeSort.java delete mode 100644 Pairwise swap elements of a linked list delete mode 100644 Pigeonhole Sort delete mode 100644 README.md delete mode 100644 Reverse_an_array/Reverse_Array.java delete mode 100644 Reverse_an_array/Reverse_an_array.cpp delete mode 100644 Reverse_an_array/Reverse_an_array.exe delete mode 100644 To check if two arrays are disjoint or not delete mode 100644 To find all repeating elements in an array. delete mode 100644 To find longest palindrome in a array delete mode 100644 Trie/Trie.cpp delete mode 100644 array_sum.cpp delete mode 100644 binarySearch.cpp delete mode 100644 count_Even_Odd/countEvenOdd.class delete mode 100644 count_Even_Odd/countEvenOdd.cpp delete mode 100644 count_Even_Odd/countEvenOdd.exe delete mode 100644 count_Even_Odd/countEvenOdd.java delete mode 100644 count_Even_Odd/countEvenOdd.js delete mode 100644 count_Even_Odd/countEvenOdd.py delete mode 100644 count_frequency_of_array_items.cpp delete mode 100644 count_number_of_odd_even_elements/Solution.java delete mode 100644 countingevenodd.c delete mode 100644 factorial.c delete mode 100644 findDisjoint/disjointOrNot.cpp delete mode 100644 find_the_smallest_element_in_an_array/Solution.java delete mode 100644 finding_repeating_elements.c delete mode 100644 if a number is an Armstrong Number.java delete mode 100644 largestelement.c delete mode 100644 longest_palindrome_in_array delete mode 100644 longest_palindrome_subsequence_length/Solution.java create mode 100644 palindrome.cpp delete mode 100644 removingDuplicates/removeDupFromArray.cpp delete mode 100644 reverse_an_array.c delete mode 100644 rotateimage.cpp delete mode 100644 searchInRotArray.java delete mode 100644 shell_sort/shell_sort.cpp delete mode 100644 smallest element in array.c delete mode 100644 sort_elements_of_array/Solution.java delete mode 100644 turtle.py diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 0cba2e6..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "iostream": "cpp" - } -} \ No newline at end of file diff --git a/BIT_MANIPULATION.cpp b/BIT_MANIPULATION.cpp deleted file mode 100644 index c3ca914..0000000 --- a/BIT_MANIPULATION.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include -using namespace std; -int getbit(int n, int pos) -{ - return ((n & (1 << pos)) != 0); -} -int setbit(int n, int pos) -{ - return (n | (1 << pos)); -} -int clearbit(int n, int pos) -{ - int mask = ~(1 << pos); - return (n & mask); -} -int updatebit(int n, int pos, int value) -{ - int mask = ~(1 << pos); - n = (n & mask); - return (n | (value << pos)); -} -int main() -{ - cout << "ENTER THE KEY AS PER YOUR TASK:" << endl; - int n; - bool check = true; - while (check) - { - int a, pos; - cout << "\n1)ENTER 1 FOR CHECKING WHICH BIT IS PRESENT AT THAT POSITION" << endl; - cout << "2)ENTER 2 FOR SETTING A BIT ON THAT POSITION" << endl; - cout << "3)ENTER 3 FOR SETTING BIT TO ZERO ON THAT POSITION" << endl; - cout << "4)ENTER 4 FOR UPDATE BIT ON THAT POSITION" << endl; - cout << "5)ENTER 5 FOR EXIT" << endl; - cin>>n; - switch (n) - { - case 1: - cout << "ENTER THE NO: "; - cin >> a; - cout << "ENTER THE POSITION WHERE YOU WANT TO CHECK: "; - cin >> pos; - cout << "THE BIT AT "<> a; - cout << "ENTER THE POSITION WHERE YOU WANT TO SET A BIT: "; - cin >> pos; - cout << "NO AFTER SETTING A BIT IS "<> a; - cout << "ENTER THE POSITION WHERE YOU WANT TO CLEAR A BIT: "; - cin >> pos; - cout << "NEW NO IS "<> a; - cout << "ENTER THE POSITION WHERE YOU WANT TO CHANGE: "; - cin >> pos; - bool bit; - cout<<"ENTER THE BIT TO WHICH YOU WANT TO CHANGE: "; - cin>>bit; - cout <<"NEW NO IS "<< updatebit(a, pos, bit); - break; - case 5: - check = false; - break; - default: - cout << "YOU ENTER WRONG KEY.." << endl; - break; - } - } - - return 0; -} \ No newline at end of file diff --git a/BinarySearch.cpp b/BinarySearch.cpp deleted file mode 100644 index 884c628..0000000 --- a/BinarySearch.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// C++ program to implement iterative Binary Search -#include -using namespace std; - -// An iterative binary search function. -int binarySearch(int arr[], int l, int r, int x) -{ - while (l <= r) { - int m = l + (r - l) / 2; - - // Check if x is present at mid - if (arr[m] == x) - return m; - - // If x greater, ignore left half - if (arr[m] < x) - l = m + 1; - - // If x is smaller, ignore right half - else - r = m - 1; - } - - // If we reach here, then element was not present - return -1; -} - -// Driver code -int main(void) -{ - int arr[] = { 2, 3, 4, 10, 40 }; - int x = 10; - int n = sizeof(arr) / sizeof(arr[0]); - int result = binarySearch(arr, 0, n - 1, x); - (result == -1) - ? cout << "Element is not present in array" - : cout << "Element is present at index " << result; - return 0; -} diff --git a/BubbleSort.java b/BubbleSort.java deleted file mode 100644 index 64753a5..0000000 --- a/BubbleSort.java +++ /dev/null @@ -1,35 +0,0 @@ -public class BubbleSort { - static void bubbleSort(int[] arr) { - int n = arr.length; - int temp = 0; - for(int i=0; i < n; i++){ - for(int j=1; j < (n-i); j++){ - if(arr[j-1] > arr[j]){ - //swap elements - temp = arr[j-1]; - arr[j-1] = arr[j]; - arr[j] = temp; - } - - } - } - - } - public static void main(String[] args) { - int arr[] ={3,60,35,2,45,320,5}; - - System.out.println("Array Before Bubble Sort"); - for(int i=0; i < arr.length; i++){ - System.out.print(arr[i] + " "); - } - System.out.println(); - - bubbleSort(arr);//sorting array elements using bubble sort - - System.out.println("Array After Bubble Sort"); - for(int i=0; i < arr.length; i++){ - System.out.print(arr[i] + " "); - } - - } -} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 6724cf1..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Programming Projects Collections🔥 - -![image](https://user-images.githubusercontent.com/70385488/192114009-0830321a-d227-4a4d-8411-6c03b54d7ce6.png) - -
- -[![Open Source Love](https://firstcontributions.github.io/open-source-badges/badges/open-source-v1/open-source.svg)](https://github.com/kishanrajput23/Hacktoberfest-2022) -Hacktober Badge -Star Badge -Contributions - -
- - -### This repository aims to help code beginners with their first successful pull request and open source contribution. :partying_face: - -:star: Feel free to use this project to make your first contribution to an open-source project on GitHub. Practice making your first pull request to a public repository before doing the real thing! - -:star: Make sure to grab some cool swags during Hacktoberfest by getting involved in the open-source community. - -### This repository is open to all members of the GitHub community. Any member can contribute to this project! :grin: - -## What is Hacktoberfest? :thinking: -A month-long celebration from October 1st to October 31st presented by [Digital Ocean](https://hacktoberfest.digitalocean.com/) and [DEV Community](https://dev.to/) collaborated with [GitHub](https://github.com/blog/2433-celebrate-open-source-this-october-with-hacktoberfest) to get people involved in [Open Source](https://github.com/open-source). Create your very first pull request to any public repository on GitHub and contribute to the open-source developer community. - -[https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/) - -## Rules :fire: -To qualify for the __official limited edition Hacktoberfest shirt__, you must register [here](https://hacktoberfest.digitalocean.com/) and make four Pull Requests (PRs) between October 1-31, 2023 (in any time zone). PRs can be made to any public repository on GitHub, not only the ones with issues labeled Hacktoberfest. This year, the __first 40,000__ participants who complete Hacktoberfest can elect to receive one of two prizes: a tree planted in their name. - -## Steps to follow :scroll: - -### Tip : Complete this process in GitHub (in your browser) - -```mermaid -flowchart LR - Fork[Fork the project]-->branch[Create a New Branch] - branch-->Edit[Edit file] - Edit-->commit[Commit the changes] - commit -->|Finally|creatpr((Create a Pull Request)) - - ``` - - -Star the repository by pressing the topmost-right button to start your wonderful journey. - - - - -Made with [contributors-img](https://contributors-img.web.app). - - -## Help Contributing Guides :crown: - -We love to have `articles` and `codes` in different languages and the `betterment` of existing ones. - -Please discuss it with us first by creating a new issue. - -:tada: :confetti_ball: :smiley: _**Happy Contributing**_ :smiley: :confetti_ball: :tada: - -## Author 🙋‍♂️ : [Find Me Here](https://www.linkedin.com/in/nikhil-falke-1a3639200/) diff --git a/Count_number_of_subarray_having_given_xor.cpp b/Count_number_of_subarray_having_given_xor.cpp deleted file mode 100644 index 3fd268c..0000000 --- a/Count_number_of_subarray_having_given_xor.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// A simple C++ Program to count all subarrays having -// XOR of elements as given value m -// Given an array of integers arr[] and a number m, count the number of subarrays having XOR of their elements as m. -#include -using namespace std; - -// Simple function that returns count of subarrays -// of arr with XOR value equals to m -long long subarrayXor(int arr[], int n, int m) -{ - long long ans = 0; // Initialize ans - - // Pick starting point i of subarrays - for (int i = 0; i < n; i++) { - int xorSum = 0; // Store XOR of current subarray - - // Pick ending point j of subarray for each i - for (int j = i; j < n; j++) { - // calculate xorSum - xorSum = xorSum ^ arr[j]; - - // If xorSum is equal to given value, - // increase ans by 1. - if (xorSum == m) - ans++; - } - } - return ans; -} - -// MAIN program to test above function -int main() -{ - int arr[] = { 4, 2, 2, 6, 4 }; - int n = sizeof(arr) / sizeof(arr[0]); - int m = 6; - - cout << "Number of subarrays having given XOR is " - << subarrayXor(arr, n, m); - return 0; -} -// output -// Number of subarrays having given XOR is 4 -// Time Complexity: O(n2) -// Auxiliary Space: O(1) -// APPROACH -// 1) Initialize ans as 0. -// 2) Compute xorArr, the prefix xor-sum array. -// 3) Create a map mp in which we store count of -// all prefixes with XOR as a particular value. -// 4) Traverse xorArr and for each element in xorArr -// (A) If m^xorArr[i] XOR exists in map, then -// there is another previous prefix with -// same XOR, i.e., there is a subarray ending -// at i with XOR equal to m. We add count of -// all such subarrays to result. -// (B) If xorArr[i] is equal to m, increment ans by 1. -// (C) Increment count of elements having XOR-sum -// xorArr[i] in map by 1. -// 5) Return ans. - -// EXAMPLE: -// Input : arr[] = {4, 2, 2, 6, 4}, m = 6 -// Output : 4 -// Explanation : The subarrays having XOR of -// their elements as 6 are {4, 2}, -// {4, 2, 2, 6, 4}, {2, 2, 6}, -// and {6} - -// Input : arr[] = {5, 6, 7, 8, 9}, m = 5 -// Output : 2 -// Explanation : The subarrays having XOR of -// their elements as 5 are {5} -// and {5, 6, 7, 8, 9} diff --git a/Disjoint Set Union/DisjointSetUnion.cpp b/Disjoint Set Union/DisjointSetUnion.cpp deleted file mode 100644 index 097dc1d..0000000 --- a/Disjoint Set Union/DisjointSetUnion.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -using namespace std; - -/* - Disjoint Set Union is a data structure that is used to find dynamic set - of connected elements(pairwise or through a chained pairwise relation). - - The algorithm is used to find the connected components in a graph network, - flow network, etc. - - The data structure maintains two arrays :- - 1. parent - 2. rank (Here we are doing union by rank) - - There are 3 main fucntionalities in this data structure:- - - 1. MAKE_SET() ---> initialises the data-structures, parent[node]=node - initially and rank of all nodes = 0. - - - 2. FIND_SET(node) ---> Finds the representative element of the set where - node belongs - - 3. UNION(x,y) ----> Joins the nodes x and y based on the rank of the - parent of x and y. Say, parent of x is p_x and parent of y is p_y. - - Then if, - - a. rank[p_x]>rank[p_y] ---> Make parent[p_y]=p_x ; No change in rank - - b. rank[p_y]>rank[p_x] ---> Make parent[p_x]=p_y; No change in rank - - c. rank[p_x]=rank[p_y] ---> Make parent[p_y]=p_x; Increment rank[p_x] by 1 - - For n operations the amortised time complexity to do union operations is - O(alpha); where alpha is the inverse ackermann function. - -*/ - -class DSU -{ -private: - vector parent; // stores the representative element of the set - vector rank; // stores the rank of the nodes(parent of nodes to be specific) - int connectedComponents; - -public: - DSU(int); // Similiar to MAKE_SET(); initialises the data structure - int findParent(int); // Similar to FIND_SET(node); Finds representative element of the set where node belongs - void unionByRank(int, int); // Similiar to UNION(x,y) - int numberOfConnectedComponents(); // Utility function to track the number of connected components as the graph grows -}; - -/* - @param - Total number of nodes in the graph - @return - void -*/ - -DSU::DSU(int n) -{ - this->rank.resize(n, 0); // Consider 0 based indexing - this->parent.resize(n); - this->connectedComponents = n; // initally all are disconnected - for (int i = 0; i < n; i++) - { - this->parent[i] = i; - } -} - -/* - @param - node - @return - parent/representative element of node -*/ - -int DSU::findParent(int node) -{ - if (node == this->parent[node]) - { - return node; - } - return this->parent[node] = this->findParent(this->parent[node]); -} - -/* - @param - node x and nodex y whose union is to be done - @return - void -*/ - -void DSU::unionByRank(int x, int y) -{ - int parent_x = this->findParent(x); - int parent_y = this->findParent(y); - if (parent_x == parent_y) - { - return; - } - if (this->rank[parent_x] > this->rank[parent_y]) - { - this->parent[parent_y] = parent_x; - } - else if (this->rank[parent_x] < this->rank[parent_y]) - { - this->parent[parent_x] = parent_y; - } - else - { - this->parent[parent_y] = parent_x; - this->rank[parent_x]++; - } - this->connectedComponents--; -} - -/* - @param - nil - @return - Returns the number of connected components in the graph -*/ -int DSU::numberOfConnectedComponents() -{ - return this->connectedComponents; -} - -/* Main Function to test the DSU datastructure */ - -int main() -{ - DSU obj(6); // Nodes are 0,1,2,3,4,5 - cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; - cout << "Joining nodes 1 and 2\n"; - obj.unionByRank(1, 2); - cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; - cout << "Joining nodes 1 and 0\n"; - obj.unionByRank(1, 0); - cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; - cout << "Joining nodes 1 and 5\n"; - obj.unionByRank(1, 5); - cout << "Parent of node 0 is : " << obj.findParent(0) << "\n"; - cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; - cout << "Joining nodes 3 and 2\n"; - obj.unionByRank(3, 2); - cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; - cout << "Joining nodes 4 and 2\n"; - obj.unionByRank(4, 2); - cout << "The number of connected components are: " << obj.numberOfConnectedComponents() << "\n"; - return 0; -} \ No newline at end of file diff --git a/InsertionSort.java b/InsertionSort.java deleted file mode 100644 index 1760a10..0000000 --- a/InsertionSort.java +++ /dev/null @@ -1,30 +0,0 @@ -public class InsertionSort { - public static void insertionSort(int array[]) { - int n = array.length; - for (int j = 1; j < n; j++) { - int key = array[j]; - int i = j-1; - while ( (i > -1) && ( array [i] > key ) ) { - array [i+1] = array [i]; - i--; - } - array[i+1] = key; - } - } - - public static void main(String a[]){ - int[] arr1 = {9,14,3,2,43,11,58,22}; - System.out.println("Before Insertion Sort"); - for(int i:arr1){ - System.out.print(i+" "); - } - System.out.println(); - - insertionSort(arr1);//sorting array using insertion sort - - System.out.println("After Insertion Sort"); - for(int i:arr1){ - System.out.print(i+" "); - } - } -} \ No newline at end of file diff --git a/Kadane's Algorithm.cpp b/Kadane's Algorithm.cpp deleted file mode 100644 index e0ea9b5..0000000 --- a/Kadane's Algorithm.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -using namespace std; -int main() -{ - int a[] = { -2, -3, 4, -1, -2, 1, 5, -3 }; - int n = sizeof(a) / sizeof(a[0]); - - // Kadane's algorithm - int max_so_far = INT_MIN, max_ending_here = 0; - - for (int i = 0; i < n; i++) { - max_ending_here = max_ending_here + a[i]; - if (max_so_far < max_ending_here) - max_so_far = max_ending_here; - - if (max_ending_here < 0) - max_ending_here = 0; - } -cout << "Maximum contiguous sum in the array is : "< -#include - -int kadanesAlgorithm(std::vector& nums) { - int maxEndingHere = nums[0]; - int maxSoFar = nums[0]; - - for (int i = 1; i < nums.size(); i++) { - maxEndingHere = std::max(nums[i], maxEndingHere + nums[i]); - maxSoFar = std::max(maxSoFar, maxEndingHere); - } - - return maxSoFar; -} - -int main() { - std::vector nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4}; - int maxSum = kadanesAlgorithm(nums); - std::cout << "Maximum subarray sum: " << maxSum << std::endl; - - return 0; -} diff --git a/KahnsAlgo.cpp b/KahnsAlgo.cpp deleted file mode 100644 index e8cad78..0000000 --- a/KahnsAlgo.cpp +++ /dev/null @@ -1,93 +0,0 @@ -//{ Driver Code Starts -#include -using namespace std; - -// } Driver Code Ends -class Solution -{ - public: - //Function to return list containing vertices in Topological order. - vector topoSort(int V, vector adj[]) - { - queue q; - vector ans; - - vector indegree(V,0); - - for(int i = 0;i &res, vector adj[]) { - - if(V!=res.size()) - return 0; - - vector map(V, -1); - for (int i = 0; i < V; i++) { - map[res[i]] = i; - } - for (int i = 0; i < V; i++) { - for (int v : adj[i]) { - if (map[i] > map[v]) return 0; - } - } - return 1; -} - -int main() { - int T; - cin >> T; - while (T--) { - int N, E; - cin >> E >> N; - int u, v; - - vector adj[N]; - - for (int i = 0; i < E; i++) { - cin >> u >> v; - adj[u].push_back(v); - } - - Solution obj; - vector res = obj.topoSort(N, adj); - - cout << check(N, res, adj) << endl; - } - - return 0; -} -// } Driver Code Ends diff --git a/Knapsack.py b/Knapsack.py deleted file mode 100644 index 74fad6a..0000000 --- a/Knapsack.py +++ /dev/null @@ -1,32 +0,0 @@ -# A naive recursive implementation of 0-1 Knapsack Problem - -# Returns the maximum value that can be put in a knapsack of -# capacity W -def knapSack(W, wt, val, n): - - # Base Case - if n == 0 or W == 0 : - return 0 - - # If weight of the nth item is more than Knapsack of capacity - # W, then this item cannot be included in the optimal solution - if (wt[n-1] > W): - return knapSack(W, wt, val, n-1) - - # return the maximum of two cases: - # (1) nth item included - # (2) not included - else: - return max(val[n-1] + knapSack(W-wt[n-1], wt, val, n-1), - knapSack(W, wt, val, n-1)) - -# end of function knapSack - -# To test above function -val = [60, 100, 120] -wt = [10, 20, 30] -W = 50 -n = len(val) -print knapSack(W, wt, val, n) - -# This code is contributed by Nikhil Kumar Singh diff --git a/MergeSort/MergeSort.java b/MergeSort/MergeSort.java deleted file mode 100644 index 9d13109..0000000 --- a/MergeSort/MergeSort.java +++ /dev/null @@ -1,47 +0,0 @@ - - -public class MergeSort { - public static void mergesort(int arr[],int si,int ei){ - if(si>=ei){ - return; - } - int mid=si+(ei-si)/2; - mergesort(arr, si, mid); - mergesort(arr, mid+1, ei); - merge(arr,si,mid,ei); - } - public static void merge(int arr[], int si, int mid, int ei) { - int temp[] = new int[ei - si + 1]; - int i = si; - int j = mid + 1; - int k = 0; - while (i <= mid && j <= ei) { - if (arr[i] < arr[j]) { - temp[k] = arr[i]; - i++; - k++; - } else { - temp[k] = arr[j]; - j++; - k++; - } - } - while (i <= mid) { - temp[k++] = arr[i++]; - } - while (j <= ei) { - temp[k++] = arr[j++]; - } - for (k = 0, i = si; k < temp.length; k++, i++) { - arr[i] = temp[k]; - } - } - - public static void main(String[] args) { - int arr[]={6,3,9,5,2,8}; - mergesort(arr,0,5); - for(int ele :arr){ - System.out.print(ele+" "); - } - } -} diff --git a/Pairwise swap elements of a linked list b/Pairwise swap elements of a linked list deleted file mode 100644 index f08b947..0000000 --- a/Pairwise swap elements of a linked list +++ /dev/null @@ -1,64 +0,0 @@ -#include -using namespace std; - -// Definition for singly-linked list. -struct Node { - int data; - Node* next; - Node(int x) : data(x), next(nullptr) {} -}; - -class Solution { -public: - Node* pairWiseSwap(Node* head) { - if (head == nullptr || head->next == nullptr) { - return head; - } - - Node* prev = head; - Node* curr = head->next; - head = curr; // New head after swapping - - while (true) { - Node* nextNode = curr->next; - curr->next = prev; // Swapping nodes - - if (nextNode == nullptr || nextNode->next == nullptr) { - prev->next = nextNode; - break; - } - - prev->next = nextNode->next; // Connecting previous swapped pair to the next pair - prev = nextNode; // Moving the prev pointer to the end of the current pair - curr = prev->next; // Moving the curr pointer to the start of the next pair - } - - return head; - } -}; - -// Function to print the linked list -void printList(Node* head) { - while (head != nullptr) { - cout << head->data << " "; - head = head->next; - } - cout << endl; -} - -int main() { - Node* head = new Node(1); - head->next = new Node(2); - head->next->next = new Node(3); - head->next->next->next = new Node(4); - - Solution obj; - cout << "Original Linked List: "; - printList(head); - - Node* newHead = obj.pairWiseSwap(head); - cout << "Linked List after pairwise swapping: "; - printList(newHead); - - return 0; -} diff --git a/Pigeonhole Sort b/Pigeonhole Sort deleted file mode 100644 index 0eda01c..0000000 --- a/Pigeonhole Sort +++ /dev/null @@ -1,54 +0,0 @@ -/* C++ program to implement Pigeonhole Sort */ -#include -using namespace std; - -/* Sorts the array using pigeonhole algorithm */ -void pigeonholeSort(int arr[], int n) -{ - // Find minimum and maximum values in arr[] - int min = arr[0], max = arr[0]; - for (int i = 1; i < n; i++) - { - if (arr[i] < min) - min = arr[i]; - if (arr[i] > max) - max = arr[i]; - } - int range = max - min + 1; // Find range - - // Create an array of vectors. Size of array - // range. Each vector represents a hole that - // is going to contain matching elements. - vector holes[range]; - - // Traverse through input array and put every - // element in its respective hole - for (int i = 0; i < n; i++) - holes[arr[i]-min].push_back(arr[i]); - - // Traverse through all holes one by one. For - // every hole, take its elements and put in - // array. - int index = 0; // index in sorted array - for (int i = 0; i < range; i++) - { - vector::iterator it; - for (it = holes[i].begin(); it != holes[i].end(); ++it) - arr[index++] = *it; - } -} - -// Driver program to test the above function -int main() -{ - int arr[] = {8, 3, 2, 7, 4, 6, 8}; - int n = sizeof(arr)/sizeof(arr[0]); - - pigeonholeSort(arr, n); - - printf("Sorted order is : "); - for (int i = 0; i < n; i++) - printf("%d ", arr[i]); - - return 0; -} diff --git a/README.md b/README.md deleted file mode 100644 index 441dd7a..0000000 --- a/README.md +++ /dev/null @@ -1,62 +0,0 @@ - -# Programs Projects Collections🔥 - -![image](https://user-images.githubusercontent.com/70385488/192114009-0830321a-d227-4a4d-8411-6c03b54d7ce6.png) - -
- -[![Open Source Love](https://firstcontributions.github.io/open-source-badges/badges/open-source-v1/open-source.svg)](https://github.com/kishanrajput23/Hacktoberfest-2022) -Hacktober Badge -Star Badge -Contributions - -
- - -### This repository aims to help code beginners with their first successful pull request and open source contribution. :partying_face: - -:star: Feel free to use this project to make your first contribution to an open-source project on GitHub. Practice making your first pull request to a public repository before doing the real thing! - -:star: Make sure to grab some cool swags during Hacktoberfest by getting involved in the open-source community. - -### This repository is open to all members of the GitHub community. Any member can contribute to this project! :grin: - -## What is Hacktoberfest? :thinking: -A month-long celebration from October 1st to October 31st presented by [Digital Ocean](https://hacktoberfest.digitalocean.com/) and [DEV Community](https://dev.to/) collaborated with [GitHub](https://github.com/blog/2433-celebrate-open-source-this-october-with-hacktoberfest) to get people involved in [Open Source](https://github.com/open-source). Create your very first pull request to any public repository on GitHub and contribute to the open-source developer community. - -[https://hacktoberfest.digitalocean.com/](https://hacktoberfest.digitalocean.com/) - -## Rules :fire: -To qualify for the __official limited edition Hacktoberfest shirt__, you must register [here](https://hacktoberfest.digitalocean.com/) and make four Pull Requests (PRs) between October 1-31, 2023 (in any time zone). PRs can be made to any public repository on GitHub, not only the ones with issues labeled Hacktoberfest. This year, the __first 40,000__ participants who complete Hacktoberfest can elect to receive one of two prizes: a tree planted in their name. - -## Steps to follow :scroll: - -### Tip : Complete this process in GitHub (in your browser) - -```mermaid -flowchart LR - Fork[Fork the project]-->branch[Create a New Branch] - branch-->Edit[Edit file] - Edit-->commit[Commit the changes] - commit -->|Finally|creatpr((Create a Pull Request)) - - ``` - - -Star the repository by pressing the topmost-right button to start your wonderful journey. - - - - -Made with [contributors-img](https://contributors-img.web.app). - - -## Help Contributing Guides :crown: - -We love to have `articles` and `codes` in different languages and the `betterment` of existing ones. - -Please discuss it with us first by creating a new issue. - -:tada: :confetti_ball: :smiley: _**Happy Contributing**_ :smiley: :confetti_ball: :tada: - -## Author 🙋‍♂️ : [Find Me Here](https://www.linkedin.com/in/nikhil-falke-1a3639200/) diff --git a/Reverse_an_array/Reverse_Array.java b/Reverse_an_array/Reverse_Array.java deleted file mode 100644 index 5467e90..0000000 --- a/Reverse_an_array/Reverse_Array.java +++ /dev/null @@ -1,29 +0,0 @@ -import java.util.Scanner; - -public class Main -{ - static void reverseRecursive(int arr[], int start, int end) - { - if (start >= end) - return; - - int temp = arr[start]; - arr[start] = arr[end]; - arr[end] = temp; - - // recursive call to swap arr[start+1] & arr[end-1] - reverseRecursive(arr, start + 1, end - 1); - } - public static void main(String args[]) - { - - int arr[] = {10, 20, 30, 40, 50}; - - int n=arr.length; - int start = 0, end = n-1; - reverseRecursive(arr, start, end); - - for(int i=0; i -using namespace std; -int main() -{ - //Take an array as input - cout<<"Size of array is: "; - int n; - cin>>n; - - //Declaring an array of size n - int arr[n]; - - //Taking the array from user - cout<<"Enter the array: "; - for(int i=0;i>arr[i]; - } - - //Reversing the entered array - for(int i=0;iR^L{LLeA0XwaD?lMl(4`QSsrOGqXpk}s1xfFDS3 zCYHNn+U(Z0Zfmzv+%DUUdCqgrJ@?)-C3p8QD`U)tGaP1YAFgz`_}@$a=|pkTwLeK> zdndmeMM| z8tHNmW5v=`R&(%5FWb!6Ef&U3v3My#vdm)XKq|&buxYp^<8WXPv4IhVz;i9sV6&zG zupVb3&Mcf!2jQh}=;$C2$;jI1Pwdf2d>aK{Zo^LC*m35Wak+fC6;%Y~w(3EG^q{tl zIyj!v#Q8c2{xnX)E5#Xg5Z=NJp$HfKSrif;=^b^rm@8-D;$<8XCIj~2yas0l&Zxu1 zl5-YjW^l+tYO_-~iQX8!Io^^bC}8Xm;hn`vceg|mx-s?$&j6VOtSqE&aN6RmN0%Vk;bdUcZ=m|iujXo1 z0~RF#sTaCJkW$t_r9dVj*tp)B1jC;Ls7JGb4s&R9qB$SEkxN0`LO)B^rTFbzgqomrTtK~ zpGl;2vWta6MCyz!lnl&Wc9)B(wzSaaAX(^Mh_NfJjg!g=Uj5+?7u%gk2ry?XiMrT7z^!6_t%emE6uPoE9Vn~aidDj~Y|T@3t)*e)9-Q1t|C zqV|U-14W&c7W#X->h0w}lii({HlMc@(5Xr20uZSQGReDa5ZHf8LOKzsbBRajm-E2; zV0M2G{2O)1=;0ZspkC;wW_yZqvYb}_b#r-mPU533*1cJ`e|XL(pwbgL&>kz%AjxFw za*%(97@x6`3;hs8H88Z>Bno!73Gr>yflb;9xLq9}73XQdl^of=n?bd%b4m)8*{Px} zZQptq3%|B&CYAIlw*ulurO8Bv3M?Sh(mpzD}285O8*_!tt4Qc?3t zxNx_3^qzay^+V0UIN}+a?P4#S!k>{HBU2-~QUdz=&&=G#1?%I~xIja@NG}MK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zkePHl@RJ#`JpfI|6$OWf3WIJOxFi+|Zh%jvcCWSLMapU7l_VeOq){#>0u|_L#WK z>yb&{aouo>25(JUl)DH;#BV!dOFCLoF}bz2^odUETV(D;OF zk*Cq#Wm;qrJ`veComee4u>z6kz4$3gXnqvi$b8FlB9SRb@LkW5)R>xGSKO}gaR&R$ zVORC&9>H5e`-VZ|7uh^M!rzD~uq$^9Jvwk1Yp^>U?bOa&UXMbWNJgu6h~G63n|3vO z@!=zSYjM<%0FaMH*@sIuHXaw@qjg=oh%6E3g)|d83%Fs-)waFYRf`VPk+{g@s9#v% zJxBLfzCFG+X6Ry=eo}ysIQ-Wbc)jQkGZ8Vc;}~tq&%3R*`8^s9QW-xgAiQ6vP3tnI zafIUgU$T|G?i;lc>yfq?a=lwG;bwf-eWR-3%ev`l(|43Fr5*)3rVmjOE~2A8ZH%Zp znD|8kZY%THM2}L<4kEh1c)uZGG>o?VAYgDj$h_~8VZ|B~#OAK>6t ziu?)%7yd8vAAP`ujoUB~7~`!7I!ct8is%65aCZI>-J{?gaYs z-XJE;oQ}4xgcJP8hCbnGB%7N;JMGU%zg&zBip6A#v(bOhLoE7gcO3{pd|i}A{OCR% z86~lm@um)C6ZWNm=z2HX=>+K zl`_0t_)_FoNg@&598OKmM>mn$EUIeEjF;PH!U^o9 -#include -#include - -// Function to check if two arrays are disjoint -bool areArraysDisjoint(const std::vector& arr1, const std::vector& arr2) { - std::unordered_set set1; - - // Add elements from the first array to the set - for (int num : arr1) { - set1.insert(num); - } - - // Check if any element in the second array is present in the set - for (int num : arr2) { - if (set1.find(num) != set1.end()) { - // A common element is found, so the arrays are not disjoint - return false; - } - } - - // No common elements were found, so the arrays are disjoint - return true; -} - -int main() { - int n1, n2; - std::cout << "Enter the number of elements in the first array: "; - std::cin >> n1; - - std::vector arr1(n1); - - std::cout << "Enter the elements of the first array: "; - for (int i = 0; i < n1; i++) { - std::cin >> arr1[i]; - } - - std::cout << "Enter the number of elements in the second array: "; - std::cin >> n2; - - std::vector arr2(n2); - - std::cout << "Enter the elements of the second array: "; - for (int i = 0; i < n2; i++) { - std::cin >> arr2[i]; - } - - bool isDisjoint = areArraysDisjoint(arr1, arr2); - - if (isDisjoint) { - std::cout << "The two arrays are disjoint." << std::endl; - } else { - std::cout << "The two arrays are not disjoint." << std::endl; - } - - return 0; -} diff --git a/To find all repeating elements in an array. b/To find all repeating elements in an array. deleted file mode 100644 index a0d155d..0000000 --- a/To find all repeating elements in an array. +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include - -// Function to find repeating elements in an integer array -std::vector findRepeatingElements(const std::vector& arr) { - std::vector result; - std::unordered_set seen; - - for (int num : arr) { - if (seen.find(num) != seen.end()) { - // If the number is already in the set, it's a duplicate - result.push_back(num); - } else { - // Otherwise, add it to the set - seen.insert(num); - } - } - - return result; -} - -int main() { - int n; - std::cout << "Enter the number of elements in the array: "; - std::cin >> n; - - std::vector arr(n); - - std::cout << "Enter the elements of the array: "; - for (int i = 0; i < n; i++) { - std::cin >> arr[i]; - } - - std::vector repeatingElements = findRepeatingElements(arr); - - if (repeatingElements.empty()) { - std::cout << "No repeating elements found in the array." << std::endl; - } else { - std::cout << "Repeating elements in the array: "; - for (int num : repeatingElements) { - std::cout << num << " "; - } - std::cout << std::endl; - } - - return 0; -} diff --git a/To find longest palindrome in a array b/To find longest palindrome in a array deleted file mode 100644 index e01c651..0000000 --- a/To find longest palindrome in a array +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -// Function to find the longest palindrome subarray -std::vector findLongestPalindromeSubarray(const std::vector& arr) { - int n = arr.size(); - std::vector longestPalindromeSubarray; - - for (int i = 0; i < n; i++) { - for (int j = i; j < n; j++) { - bool isPalindrome = true; - for (int left = i, right = j; left < right; left++, right--) { - if (arr[left] != arr[right]) { - isPalindrome = false; - break; - } - } - - if (isPalindrome && (j - i + 1) > longestPalindromeSubarray.size()) { - longestPalindromeSubarray = std::vector(arr.begin() + i, arr.begin() + j + 1); - } - } - } - - return longestPalindromeSubarray; -} - -int main() { - std::vector arr = {1, 2, 3, 4, 3, 5, 6, 7, 7, 6, 5}; - - // Find the longest palindrome subarray - std::vector longestPalindromeSubarray = findLongestPalindromeSubarray(arr); - - if (longestPalindromeSubarray.empty()) { - std::cout << "No palindrome subarray found." << std::endl; - } else { - std::cout << "Longest palindrome subarray: "; - for (int num : longestPalindromeSubarray) { - std::cout << num << " "; - } - std::cout << std::endl; - } - - return 0; -} diff --git a/Trie/Trie.cpp b/Trie/Trie.cpp deleted file mode 100644 index e999fd8..0000000 --- a/Trie/Trie.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include -#include -using namespace std; - -/* - A trie or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. - There are various applications of this data structure, such as autocomplete and spellchecker. - Some nuanced dynamic programming problems also use the trie data-structure to reduce its time complexity - - A trie Data-Structure maintains a node which can have atmost n-children(here it is 26 - total numbers of lowercase letters) - This forms a deeply nested tree which where each node can have atmost n children. - -*/ - -class TrieNode -{ -public: - bool isComplete; - TrieNode *children[26]; - TrieNode() - { - isComplete = false; // by default - memset(children, '\0', sizeof(children)); - } -}; - -class Trie -{ -public: - TrieNode *root; - Trie() - { - root = new TrieNode(); - } - - void insert(string word) - { - TrieNode *node = root; - for (auto ch : word) - { - int index = ch - 'a'; - if (node->children[index] == NULL) - { - node->children[index] = new TrieNode(); - } - node = node->children[index]; - } - node->isComplete = true; - } - - bool search(string word) - { - TrieNode *node = root; - for (auto ch : word) - { - int index = ch - 'a'; - if (node->children[index] == NULL) - return false; - node = node->children[index]; - } - return node->isComplete; - } - - bool startsWith(string prefix) - { - TrieNode *node = root; - for (auto ch : prefix) - { - int index = ch - 'a'; - if (node->children[index] == NULL) - return false; - node = node->children[index]; - } - return true; - } -}; - -/* Main function to test the working of trie */ -int main() -{ - Trie *obj = new Trie(); - obj->insert("AppleBee"); - obj->insert("Fardeen"); - obj->insert("Friendship"); - cout << "The given words inserted are: AppleBee, Fardeen, Friendship\n"; - if (obj->search("Friend")) - { - cout << "Friend was inserted in trie\n"; - } - else - { - cout << "Friend was not inserted in trie\n"; - } - if (obj->startsWith("Friend")) - { - cout << "Friend is a valid prefix\n"; - } - else - { - cout << "Friend is not a valid prefix\n"; - } - if (obj->startsWith("Far")) - { - cout << "Far is a valid prefix\n"; - } - else - { - cout << "Far is not a valid prefix\n"; - } - if (obj->search("AppleBee")) - { - cout << "AppleBee was inserted in trie\n"; - } - else - { - cout << "Applebee was not inserted in trie\n"; - } - return 0; -} \ No newline at end of file diff --git a/array_sum.cpp b/array_sum.cpp deleted file mode 100644 index 463e03c..0000000 --- a/array_sum.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include - -int main() -{ - int n; - std::cout << "Enter the number of elements in the array: "; - std::cin >> n; - - int myArray[n]; - int arraySum = 0; - - std::cout << "Enter " << n << " elements, one at a time:\n"; - for (int i = 0; i < n; ++i) - { - std::cin >> myArray[i]; - arraySum += myArray[i]; - } - - std::cout << "Sum of elements in the array: " << arraySum << std::endl; - - return 0; -} diff --git a/binarySearch.cpp b/binarySearch.cpp deleted file mode 100644 index 8d9d008..0000000 --- a/binarySearch.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// C++ program to implement iterative Binary Search -// Time Complexity: O(log N) -// Auxiliary Space: O(1) -#include -using namespace std; - -// An iterative binary search function. -int binarySearch(int arr[], int l, int r, int x) -{ - while (l <= r) { - int m = l + (r - l) / 2; - - // Check if x is present at mid - if (arr[m] == x) - return m; - - // If x greater, ignore left half - if (arr[m] < x) - l = m + 1; - - // If x is smaller, ignore right half - else - r = m - 1; - } - - // If we reach here, then element was not present - return -1; -} - -// Driver code -int main(void) -{ - int arr[] = { 2, 3, 4, 10, 40 }; - int x = 10; - int n = sizeof(arr) / sizeof(arr[0]); - int result = binarySearch(arr, 0, n - 1, x); - (result == -1) - ? cout << "Element is not present in array" - : cout << "Element is present at index " << result; - return 0; -} diff --git a/count_Even_Odd/countEvenOdd.class b/count_Even_Odd/countEvenOdd.class deleted file mode 100644 index 603fd33a0c527fcadfedbde7235420837573e361..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1112 zcmaJ=T~8B16g|`3?zFX(1uR$uEDF+swtn`3Dkh>tVsSMkn99@8j2Th3K2lx+s@^2Vp#JgLgB{c5CoqK1`J#+7wxnF)A9RqlPLJT2j9C{pK7!2mF z*c17NaJKW-)~>872IHRX*lLME%VamAh#<-li{l*Pr{Lv%Pst{s+zurrO97GX=AXB1 zN0n7uie_<`&P>EH2$Nx~De7|Bb*e(WwABuIo)V7oC^xg3?WPBHP_FH47h@R42*>$2 zk{D$e>BG;!TmESc$0s>Uk=+;uLxLm45U;u&M?Kz?j#aBM=*w{Zwi~}Ml+lJ_!tJtN>uA>q7~pd(o|X>D92@n(B>*btn7B$Rk>pO>_fd()AP#xW3<#ec-(~?Y%5ue;5td?tDg=O zSWL4B@^mY78Gm;uTy-4TUTz4_lOD${hS@WX_v?q_4#U*{q4co3&0`uDXbAi-M9+i9 zfb2L$le98g!}FiO-jl;{k*xpQ_oJ8yAU^afbQ%o6Gx_IOMGIRMJz`bDCKd?-!zyX_wWWncJ*6KP!dk&d8p-fGq*Hp*$Q5{!hg)wEJqWQw7zY|VFxcVA zw-4YGM;HJ;Vu<|7Ba8*UUsxz8EJrg5Dr62ESt@6N;zyM66bZb5iFJx!(e%8=DB6@g zMd&p26BNKXE^$mV78u|s#@P>qzLOdnt^_B{V3yVdopqI(zZTdWZqQzg;+wdQyGZ>8 DKv4?Y diff --git a/count_Even_Odd/countEvenOdd.cpp b/count_Even_Odd/countEvenOdd.cpp deleted file mode 100644 index 3c4e5ea..0000000 --- a/count_Even_Odd/countEvenOdd.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -using namespace std; - -int main() { - // Initialize an array of integers - int arr[] = {2, 5, 8, 9, 12, 7, 6}; - - // Initialize counters for even and odd elements - int evenCount = 0; - int oddCount = 0; - - // Iterate through the array - for (int i = 0; i < sizeof(arr) / sizeof(arr[0]); i++) { - // Check if the current element is even - if (arr[i] % 2 == 0) { - evenCount++; - } else { // If it's not even, it's odd - oddCount++; - } - } - - // Print the counts of even and odd elements - cout << "Even count: " << evenCount << endl; - cout << "Odd count: " << oddCount << endl; - - return 0; -} diff --git a/count_Even_Odd/countEvenOdd.exe b/count_Even_Odd/countEvenOdd.exe deleted file mode 100644 index 4ea07602fdde22fb345c645272dd929b78198e85..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 44775 zcmeHw3w%`7x$oLD6EcvHNgyaH>R^L{LP#(m*idJZOdgV#nS_Uen~+RMBrlUafDa@% z6U)BS^rSuZ)^o1C2Z}wH_IRv4^+Z~&4FnUkR3oKIi}j#Vofz6us~EsK_y4W6_w3o3 zg!cBH-|yVtZTBxbd#`VO>wB$lee1FJUQ>2wFS9bnY&atk#tz_0hl~He^uI1-r(FBP z6!y&2pUyoXmHu>Ybz@Vfv%RBjb4P89v#z$awM}tu@;N*Ft9vNwjiekZ=n;*J2Hp zIt_r0IFoTM#~E`FUgoCGP6CmPteyVFA6>+^N$}-1>;jG*XMq`)%a>nOO;B#DUfhr# zRJSn)$5Wa)Unjx$;3T|qoG}OCEzTB-aM7PeCgG9ZF^7w}@)j>y!66YcU_Z`la8}`r zIb19?Z*fjGhb*Q#JB5?zjnkXsEnSKX#*Pr)S)7E|fivddc*}0#5Mf#%6CO9Ffe1bF zjMRV4UEs`|P(g+>#6oQ4S74!SD;(70T)O2QHV8Ekik83$d-|WWVq`l#sXuK zBUlW*x`BkY#(JK)o;1kr4;-Fz$i{lL^vXv;Mk!hO--%jK1;)z1$F2X37^37d;hS`# z|B6(1ztRV8lo1&|5Wz9Jzo!qWSXp?nk8b3$_;W_B0*uG>!fH6b) zsf73L0u4pLvIzF78CFTK=Ku@8g@2)0oI+~YJsoUMpAG*20)~%L4$-ymW#C7|_S)zM zMNhyc>OlA(fTGUH2rq!R(fSIU$?Yk~Sjg)N=unADA-RyW2AR~oHV7OzCE-39sPl!@NbkM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N -using namespace std; - -void countFreq(int arr[], int n) -{ - // Mark all array elements as not visited - vector visited(n, false); - - // Traverse through array elements and - // count frequencies - - for (int i = 0; i < n; i++) { - - // Skip this element if already processed - - if (visited[i] == true) - continue; - - // Count frequency - int count = 1; - for (int j = i + 1; j < n; j++) { - if (arr[i] == arr[j]) { - visited[j] = true; - count++; - } - } - cout << arr[i] << " " << count << endl; - } -} - -//Main code -int main() -{ - int arr[] = { 10, 20, 20, 10, 10, 20, 5, 20 }; - int n = sizeof(arr) / sizeof(arr[0]); - countFreq(arr, n); - return 0; -} - // Complexity Analysis: - - // Time Complexity : O(n2) - // Auxiliary Space : O(n) -// Output - -// 10 3 -// 20 4 -// 5 1 - -// Examples: - -// Input : arr[] = {20, 20, 10, 10, 20, 5, 20} -// Output : 10 2 - // 20 4 - // 5 1 - -// Input : arr[] = {10,20} -// Output : 10 1 - // 20 1 - diff --git a/count_number_of_odd_even_elements/Solution.java b/count_number_of_odd_even_elements/Solution.java deleted file mode 100644 index c7e5852..0000000 --- a/count_number_of_odd_even_elements/Solution.java +++ /dev/null @@ -1,29 +0,0 @@ -import java.util.Scanner; - -public class Solution { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - - // Read the size of the array - System.out.print("Enter the size of the array: "); - int n = sc.nextInt(); - - int[] arr = new int[n]; - System.out.println("Enter the elements of the array:"); - for (int i = 0; i < n; i++) { - arr[i] = sc.nextInt(); - } - - int countOdd = 0; - int countEven = 0; - for (int i = 0; i < n; i++) { - if (arr[i] % 2 == 0) { - countEven++; - } else { - countOdd++; - } - } - System.out.println("Number of odd elements: " + countOdd); - System.out.println("Number of even elements: " + countEven); - } -} diff --git a/countingevenodd.c b/countingevenodd.c deleted file mode 100644 index eb43748..0000000 --- a/countingevenodd.c +++ /dev/null @@ -1,34 +0,0 @@ -#include - -int main() { - int size; - - // Input the size of the array - printf("Enter the size of the array: "); - scanf("%d", &size); - - // Input the elements of the array - printf("Enter the elements of the array:\n"); - int arr[size]; - for (int i = 0; i < size; i++) { - scanf("%d", &arr[i]); - } - - // Count even and odd numbers - int evenCount = 0; - int oddCount = 0; - - for (int i = 0; i < size; i++) { - if (arr[i] % 2 == 0) { - evenCount++; - } else { - oddCount++; - } - } - - // Display the counts - printf("Number of even elements: %d\n", evenCount); - printf("Number of odd elements: %d\n", oddCount); - - return 0; -} diff --git a/factorial.c b/factorial.c deleted file mode 100644 index f1598c9..0000000 --- a/factorial.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -int main() -{ - int number,fact=1; - printf("Enter the number to find the factorial:"); - scanf("%d",&number); - if(number<0) - { - printf("\n the entered number is negative.there is no factorial for given number!!"); - } - if(number==0||number==1) - { - printf("\n the entered numbers's factorial is 1."); - } - for(int i=1;i<=number;i++) - { - fact=fact*i; - } - printf("\n the factorial of the entered number%d is:%d",number,fact); - return 0; -} \ No newline at end of file diff --git a/findDisjoint/disjointOrNot.cpp b/findDisjoint/disjointOrNot.cpp deleted file mode 100644 index c2374a3..0000000 --- a/findDisjoint/disjointOrNot.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include -using namespace std; -#define int long long -#define MOD 1000000007 -const long long N = 10000005; - -main() -{ - // Provide the size of array 1 and array 2 with their elements - int n, m; - cout << "Size of first array: "; - cin >> n; - cout << "Size of Second array: "; - cin >> m; - - // Initializing arrays - int a[n], b[m]; - - // Initializing sets for both arrays and a third set to combine them - unordered_set setA, setB, setC; - cout << "Elements of first array: "; - for (int i = 0; i < n; i++) - { - cin >> a[i]; - setA.insert(a[i]); - setC.insert(a[i]); - } - cout << "Elements of second array: "; - for (int i = 0; i < m; i++) - { - cin >> b[i]; - setB.insert(b[i]); - setC.insert(b[i]); - } - - // Comparing the sizes of sets to determine if they are disjoint - int sizeA = setA.size(); - int sizeB = setB.size(); - int sizeC = setC.size(); - - if (sizeA + sizeB == sizeC) - { - cout << "Yes, the arrays are disjoint" << endl; - } - - else - { - cout << "Arrays are not disjoint , they have some common values" << endl; - } - - return 0; -} diff --git a/find_the_smallest_element_in_an_array/Solution.java b/find_the_smallest_element_in_an_array/Solution.java deleted file mode 100644 index 80b0907..0000000 --- a/find_the_smallest_element_in_an_array/Solution.java +++ /dev/null @@ -1,25 +0,0 @@ -import java.util.Scanner; - -public class Solution { - public static void main(String[] args) { - Scanner scanner = new Scanner(System.in); - System.out.print("Enter the number of elements in the array: "); - int n = scanner.nextInt(); - int[] arr = new int[n]; - System.out.println("Enter the elements of the array:"); - for (int i = 0; i < n; i++) { - arr[i] = scanner.nextInt(); - } - scanner.close(); - - int min = arr[0]; - - for (int i = 1; i < arr.length; i++) { - if (arr[i] < min) { - min = arr[i]; - } - } - - System.out.println("The smallest element in the array is: " + min); - } -} diff --git a/finding_repeating_elements.c b/finding_repeating_elements.c deleted file mode 100644 index 189df3a..0000000 --- a/finding_repeating_elements.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -int main() { - int size; - - // Taking the size of the array from the user - printf("Enter the size of the array: "); - scanf("%d", &size); - - if (size <= 0) { - printf("Invalid size\n"); - return 1; // Exit the program with an error code - } - - int arr[size]; - - // Taking array elements as input from the user - printf("Enter the elements of the array:\n"); - for (int i = 0; i < size; ++i) { - scanf("%d", &arr[i]); - } - - // Finding the Repeated elements - int i,j; - int No_of_repeated=0; - - for (i=0;i 0) { - int digit = number % 10; - sum += Math.pow(digit, numDigits); - number /= 10; - } - - if (sum == originalNumber) { - System.out.println(originalNumber + " is an Armstrong number."); - } else { - System.out.println(originalNumber + " is not an Armstrong number."); - } - } -} diff --git a/largestelement.c b/largestelement.c deleted file mode 100644 index 55d370d..0000000 --- a/largestelement.c +++ /dev/null @@ -1,35 +0,0 @@ -#include - -int main() { - int n; - - // Taking the size of the array from the user - printf("Enter the size of the array: "); - scanf("%d", &n); - - if (n <= 0) { - printf("Invalid size\n"); - return 1; // Exit the program with an error code - } - - int arr[n]; - - // Taking array elements as input from the user - printf("Enter the elements of the array:\n"); - for (int i = 0; i < n; ++i) { - scanf("%d", &arr[i]); - } - - // Finding the largest element - int max = arr[0]; - for (int i = 1; i < n; ++i) { - if (arr[i] > max) { - max = arr[i]; - } - } - - // Displaying the result - printf("The largest element in the array is: %d\n", max); - - return 0; -} diff --git a/longest_palindrome_in_array b/longest_palindrome_in_array deleted file mode 100644 index e4ac858..0000000 --- a/longest_palindrome_in_array +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -bool isPalindrome(int n) { - int reversed = 0; - int original = n; - - while (n > 0) { - int digit = n % 10; - reversed = reversed * 10 + digit; - n /= 10; - } - - return original == reversed; -} - -int largestPalindrome(const std::vector& arr) { - int currentMax = -1; - - for (int i = 0; i < arr.size(); i++) { - if (arr[i] > currentMax && isPalindrome(arr[i])) { - currentMax = arr[i]; - } - } - - return currentMax; -} - -int main() { - int A[] = {1, 232, 54545, 999991}; - int n = sizeof(A) / sizeof(A[0]); - - std::vector arr(A, A + n); - - int largestPalin = largestPalindrome(arr); - - if (largestPalin != -1) { - std::cout << "The largest palindrome in the array is: " << largestPalin << std::endl; - } else { - std::cout << "No palindrome found in the array." << std::endl; - } - - return 0; -} - diff --git a/longest_palindrome_subsequence_length/Solution.java b/longest_palindrome_subsequence_length/Solution.java deleted file mode 100644 index 48b7870..0000000 --- a/longest_palindrome_subsequence_length/Solution.java +++ /dev/null @@ -1,24 +0,0 @@ -import java.util.*; - -public class Solution { - public int longestPalindromeSubseq(String s) { - int[][] dp = new int[s.length() + 1][s.length() + 1]; - Arrays.fill(dp[0], 0); - for (int i = 1; i <= s.length(); i++) { - dp[i][0] = 0; - for (int j = 1; j <= s.length(); j++) { - if (s.charAt(i - 1) == s.charAt(s.length() - j)) { - dp[i][j] = dp[i - 1][j - 1] + 1; - } else { - dp[i][j] = dp[i - 1][j] > dp[i][j - 1] ? dp[i - 1][j] : dp[i][j - 1]; - } - } - } - return dp[s.length()][s.length()]; - } - - public static void main(String[] args) { - Solution solver = new Solution(); - System.out.println(solver.longestPalindromeSubseq("bbbab")); - } -} \ No newline at end of file diff --git a/palindrome.cpp b/palindrome.cpp new file mode 100644 index 0000000..068f20a --- /dev/null +++ b/palindrome.cpp @@ -0,0 +1,33 @@ +#include +#include +#include +using namespace std; + +// Function to check whether the string is palindrome +string isPalindrome(string S) +{ + // Stores the reverse of the string S + string P = S; + + // Reverse the string P + reverse(P.begin(), P.end()); + + if (S == P) { + return "Yes"; + } + + else { + return "No"; + } +} + +// Driver Code +int main() +{ + string S; + cout<<"Enter the string: "; + cin>>S; + cout << isPalindrome(S); + + return 0; +} diff --git a/removingDuplicates/removeDupFromArray.cpp b/removingDuplicates/removeDupFromArray.cpp deleted file mode 100644 index f001831..0000000 --- a/removingDuplicates/removeDupFromArray.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -using namespace std; -#define int long long -#define MOD 1e9 + 7 -const long long N=10000005; - - -main() -{ - //Declare an array size; - int n; - cout<<"Size of an array: "; - cin>>n; - - //declare a set also as inserting into sets as it will remove the duplicates - - //declare an array of size n - - int a[n]; - - //unordered set for better time complexity - unordered_set sam; - cout<<"Elements of an array: "; - for(int i=0;i>a[i]; - sam.insert(a[i]); - } - - cout<<"Array without duplicates: "; - - for(int it:sam) - { - cout< - -int main() { - int size; - - // Taking the size of the array from the user - printf("Enter the size of the array: "); - scanf("%d", &size); - - if (size <= 0) { - printf("Invalid size\n"); - return 1; // Exit the program with an error code - } - - int arr[size]; - - // Taking array elements as input from the user - printf("Enter the elements of the array:\n"); - for (int i = 0; i < size; ++i) { - scanf("%d", &arr[i]); - } - - // initializing the start and end position of an array. - int start=0; - int end=size-1; - - // Reversing the array - while(start>& matrix) { - int row = matrix.size(); - for(int i=0;i use two pointers , keep a track of mid value , check condition , update mid value , return answer - - - - -class Solution { - public int search(int[] nums, int target) { - int left = 0; - int right = nums.length - 1; - - while (left <= right) { - int mid = (left + right) / 2; - - if (nums[mid] == target) { - return mid; - } else if (nums[mid] >= nums[left]) { - if (nums[left] <= target && target <= nums[mid]) { - right = mid - 1; - } else { - left = mid + 1; - } - } else { - if (nums[mid] <= target && target <= nums[right]) { - left = mid + 1; - } else { - right = mid - 1; - } - } - } - - return -1; - } -} diff --git a/shell_sort/shell_sort.cpp b/shell_sort/shell_sort.cpp deleted file mode 100644 index a4b1525..0000000 --- a/shell_sort/shell_sort.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Shell Sort in C++ programming - -#include -using namespace std; - -void shellSort(int array[], int n) { - - for (int interval = n / 2; interval > 0; interval /= 2) { - for (int i = interval; i < n; i += 1) { - int temp = array[i]; - int j; - for (j = i; j >= interval && array[j - interval] > temp; j -= interval) { - array[j] = array[j - interval]; - } - array[j] = temp; - } - } -} - -void printArray(int array[], int size) { - int i; - for (i = 0; i < size; i++) - cout << array[i] << " "; - cout << endl; -} - - -int main() { - int data[] = {9, 8, 3, 7, 5, 6, 4, 1}; - int size = sizeof(data) / sizeof(data[0]); - shellSort(data, size); - cout << "Sorted array: \n"; - printArray(data, size); -} diff --git a/smallest element in array.c b/smallest element in array.c deleted file mode 100644 index 6a4f575..0000000 --- a/smallest element in array.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -int findSmallest(int arr[], int n) { - if (n <= 0) { - printf("Array is empty.\n"); - return -1; // Return an indicator for an error or empty array - } - int smallest = arr[0]; - for (int i = 1; i < n; i++) { - if (arr[i] < smallest) { - smallest = arr[i]; - } - } - - return smallest; -} - -int main() { - // Example usage - int array[] = {4, 2, 8, 1, 6}; - int size = sizeof(array) / sizeof(array[0]); - int smallest = findSmallest(array, size); - if (smallest != -1) { - printf("The smallest element in the array is: %d\n", smallest); - } - return 0; -} diff --git a/sort_elements_of_array/Solution.java b/sort_elements_of_array/Solution.java deleted file mode 100644 index 5a0935e..0000000 --- a/sort_elements_of_array/Solution.java +++ /dev/null @@ -1,31 +0,0 @@ -import java.util.Arrays; -import java.util.Scanner; - -public class Solution { - public static void main(String[] args) { - Scanner input = new Scanner(System.in); - System.out.print("Enter the size of the array: "); - int n = input.nextInt(); - int[] arr = new int[n]; - System.out.println("Enter the elements of the array:"); - for (int i = 0; i < n; i++) { - arr[i] = input.nextInt(); - } - System.out.println("Original array: " + Arrays.toString(arr)); - bubbleSort(arr); - System.out.println("Sorted array: " + Arrays.toString(arr)); - } - - public static void bubbleSort(int[] arr) { - int n = arr.length; - for (int i = 0; i < n - 1; i++) { - for (int j = 0; j < n - i - 1; j++) { - if (arr[j] > arr[j + 1]) { - int temp = arr[j]; - arr[j] = arr[j + 1]; - arr[j + 1] = temp; - } - } - } - } -} diff --git a/turtle.py b/turtle.py deleted file mode 100644 index 02d5317..0000000 --- a/turtle.py +++ /dev/null @@ -1,59 +0,0 @@ -import turtle - -# Create the game window -wn = turtle.Screen() -wn.title("Turtle Game") -wn.bgcolor("white") - -# Create the player turtle -player = turtle.Turtle() -player.shape("turtle") -player.color("blue") -player.speed(0) -player.penup() -player.goto(0, 0) -player.direction = "stop" - -# Functions to control the player's movement -def move_up(): - player.direction = "up" - -def move_down(): - player.direction = "down" - -def move_left(): - player.direction = "left" - -def move_right(): - player.direction = "right" - -# Keyboard bindings -wn.listen() -wn.onkeypress(move_up, "Up") -wn.onkeypress(move_down, "Down") -wn.onkeypress(move_left, "Left") -wn.onkeypress(move_right, "Right") - -# Main game loop -while True: - wn.update() - - # Move the player - if player.direction == "up": - y = player.ycor() - player.sety(y + 20) - - if player.direction == "down": - y = player.ycor() - player.sety(y - 20) - - if player.direction == "left": - x = player.xcor() - player.setx(x - 20) - - if player.direction == "right": - x = player.xcor() - player.setx(x + 20) - -# Close the game window when done (unreachable in this example) -wn.mainloop() From 976feb0df56f5777d9aea2f4a451a18e1bb24164 Mon Sep 17 00:00:00 2001 From: krutika Ladani <119760273+krutika-ladani@users.noreply.github.com> Date: Fri, 13 Oct 2023 15:52:43 +0530 Subject: [PATCH 52/80] added PalindromeChecker.java --- PalindromeChecker.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 PalindromeChecker.java diff --git a/PalindromeChecker.java b/PalindromeChecker.java new file mode 100644 index 0000000..bf1908f --- /dev/null +++ b/PalindromeChecker.java @@ -0,0 +1,21 @@ +import java.util.Scanner; + +class PalindromeChecker { + public static void main(String[] args){ + + Scanner sc = new Scanner(System.in); + System.out.println("Enter a string:"); + String s = sc.nextLine(); + + for(int i=0; i Date: Sat, 14 Oct 2023 23:04:02 +0530 Subject: [PATCH 53/80] Created soln.cpp for issue #9 --- count_number_of_odd_even_elements/soln.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 count_number_of_odd_even_elements/soln.cpp diff --git a/count_number_of_odd_even_elements/soln.cpp b/count_number_of_odd_even_elements/soln.cpp new file mode 100644 index 0000000..2cf452d --- /dev/null +++ b/count_number_of_odd_even_elements/soln.cpp @@ -0,0 +1,21 @@ +//Author: Divya Raj (aka guru_divine) +#include +using namespace std; + +// TC -> O(n) +// SC -> O(1) + +int main() { + cout << "Enter the number of elements to be considered: "; + int n; cin >> n; + int cntEven=0, cntOdd=0; + cout << "Enter " << n << " elements: " << endl; + + for(int i=0; i> x; + if(x&1) cntOdd++; + else cntEven++; + } + cout << "Number of even elements in the list: " << cntEven << endl; + cout << "Number of odd elements in the list: " << cntOdd << endl; +} From 500ca05319a32a965420be3d88184d895fcda463 Mon Sep 17 00:00:00 2001 From: mdsarfarazalam840 <41156047+mdsarfarazalam840@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:22:26 +0530 Subject: [PATCH 54/80] Create Palindrom_checkerwithJava.java --- Palindrom_checkerwithJava.java | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Palindrom_checkerwithJava.java diff --git a/Palindrom_checkerwithJava.java b/Palindrom_checkerwithJava.java new file mode 100644 index 0000000..46f463e --- /dev/null +++ b/Palindrom_checkerwithJava.java @@ -0,0 +1,35 @@ +import java.util.Scanner; + +public class PalindromeChecker { + + public static boolean isPalindrome(String str) { + str = str.replaceAll("[^a-zA-Z0-9]", "").toLowerCase(); // Remove non-alphanumeric characters and convert to lowercase + int left = 0; + int right = str.length() - 1; + + while (left < right) { + if (str.charAt(left) != str.charAt(right)) { + return false; // Characters at the left and right positions don't match + } + left++; + right--; + } + + return true; // All characters matched, it's a palindrome + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter a string: "); + String input = scanner.nextLine(); + + if (isPalindrome(input)) { + System.out.println("The input is a palindrome."); + } else { + System.out.println("The input is not a palindrome."); + } + + scanner.close(); + } +} From c92bd7bc9e0ab137efc8c3b96dd8cad74dc93056 Mon Sep 17 00:00:00 2001 From: mdsarfarazalam840 <41156047+mdsarfarazalam840@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:29:16 +0530 Subject: [PATCH 55/80] Create ArrayDisjoinOrNot.java --- findDisjoint/ArrayDisjoinOrNot.java | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 findDisjoint/ArrayDisjoinOrNot.java diff --git a/findDisjoint/ArrayDisjoinOrNot.java b/findDisjoint/ArrayDisjoinOrNot.java new file mode 100644 index 0000000..754cf8d --- /dev/null +++ b/findDisjoint/ArrayDisjoinOrNot.java @@ -0,0 +1,51 @@ +import java.util.HashSet; +import java.util.Scanner; + +public class DisjointArraysChecker { + + public static boolean areDisjoint(int[] arr1, int[] arr2) { + HashSet set = new HashSet<>(); + + for (int num : arr1) { + set.add(num); + } + + for (int num : arr2) { + if (set.contains(num)) { + return false; // Common element found, arrays are not disjoint + } + } + + return true; // No common elements found, arrays are disjoint + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter the size of the first array: "); + int size1 = scanner.nextInt(); + int[] array1 = new int[size1]; + + System.out.println("Enter elements of the first array:"); + for (int i = 0; i < size1; i++) { + array1[i] = scanner.nextInt(); + } + + System.out.print("Enter the size of the second array: "); + int size2 = scanner.nextInt(); + int[] array2 = new int[size2]; + + System.out.println("Enter elements of the second array:"); + for (int i = 0; i < size2; i++) { + array2[i] = scanner.nextInt(); + } + + scanner.close(); + + if (areDisjoint(array1, array2)) { + System.out.println("The arrays are disjoint."); + } else { + System.out.println("The arrays are not disjoint."); + } + } +} From 3c6dade3345e91552300b3753450647a644fc201 Mon Sep 17 00:00:00 2001 From: mdsarfarazalam840 <41156047+mdsarfarazalam840@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:33:26 +0530 Subject: [PATCH 56/80] Create EvenOddinArray.java --- EvenOddinArray.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 EvenOddinArray.java diff --git a/EvenOddinArray.java b/EvenOddinArray.java new file mode 100644 index 0000000..fc8d14d --- /dev/null +++ b/EvenOddinArray.java @@ -0,0 +1,37 @@ +import java.util.Scanner; + +public class EvenOddCounter { + + public static void countEvenOdd(int[] arr) { + int evenCount = 0; + int oddCount = 0; + + for (int num : arr) { + if (num % 2 == 0) { + evenCount++; + } else { + oddCount++; + } + } + + System.out.println("Even numbers: " + evenCount); + System.out.println("Odd numbers: " + oddCount); + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter the size of the array: "); + int size = scanner.nextInt(); + int[] array = new int[size]; + + System.out.println("Enter elements of the array:"); + for (int i = 0; i < size; i++) { + array[i] = scanner.nextInt(); + } + + scanner.close(); + + countEvenOdd(array); + } +} From 77ff609466580640aa38d7cb82b0509476cf202a Mon Sep 17 00:00:00 2001 From: mdsarfarazalam840 <41156047+mdsarfarazalam840@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:38:05 +0530 Subject: [PATCH 57/80] Create ReverseArrayUsingScanner.java --- .../ReverseArrayUsingScanner.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Reverse_an_array/ReverseArrayUsingScanner.java diff --git a/Reverse_an_array/ReverseArrayUsingScanner.java b/Reverse_an_array/ReverseArrayUsingScanner.java new file mode 100644 index 0000000..e959bb1 --- /dev/null +++ b/Reverse_an_array/ReverseArrayUsingScanner.java @@ -0,0 +1,47 @@ +import java.util.Scanner; + +public class ArrayReverser { + + public static void reverseArray(int[] arr) { + int start = 0; + int end = arr.length - 1; + + while (start < end) { + // Swap the elements at start and end positions + int temp = arr[start]; + arr[start] = arr[end]; + arr[end] = temp; + + // Move the pointers toward each other + start++; + end--; + } + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter the size of the array: "); + int size = scanner.nextInt(); + int[] array = new int[size]; + + System.out.println("Enter elements of the array:"); + for (int i = 0; i < size; i++) { + array[i] = scanner.nextInt(); + } + + scanner.close(); + + System.out.println("Original Array:"); + for (int num : array) { + System.out.print(num + " "); + } + + reverseArray(array); + + System.out.println("\nReversed Array:"); + for (int num : array) { + System.out.print(num + " "); + } + } +} From b310f5032bed92a60b64feebbac077843cec3950 Mon Sep 17 00:00:00 2001 From: mdsarfarazalam840 <41156047+mdsarfarazalam840@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:45:51 +0530 Subject: [PATCH 58/80] Create smallestelementusingScanner.java --- .../smallestelementusingScanner.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 find_the_smallest_element_in_an_array/smallestelementusingScanner.java diff --git a/find_the_smallest_element_in_an_array/smallestelementusingScanner.java b/find_the_smallest_element_in_an_array/smallestelementusingScanner.java new file mode 100644 index 0000000..2bd1377 --- /dev/null +++ b/find_the_smallest_element_in_an_array/smallestelementusingScanner.java @@ -0,0 +1,47 @@ +import java.util.Scanner; + +public class SmallestElementFinder { + + public static int findSmallestElement(int[] arr) { + if (arr.length == 0) { + throw new IllegalArgumentException("Array is empty"); + } + + int smallest = arr[0]; + + for (int num : arr) { + if (num < smallest) { + smallest = num; + } + } + + return smallest; + } + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter the size of the array: "); + int size = scanner.nextInt(); + int[] array = new int[size]; + + if (size <= 0) { + System.out.println("Array size must be greater than 0."); + return; + } + + System.out.println("Enter elements of the array:"); + for (int i = 0; i < size; i++) { + array[i] = scanner.nextInt(); + } + + scanner.close(); + + try { + int smallestElement = findSmallestElement(array); + System.out.println("The smallest element in the array is: " + smallestElement); + } catch (IllegalArgumentException e) { + System.out.println(e.getMessage()); + } + } +} From ac892591f7c83618dc9f7558e5462cfd1716fc44 Mon Sep 17 00:00:00 2001 From: Ishita Kumari <85451704+ishita3513@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:49:25 +0530 Subject: [PATCH 59/80] Create Minimum Sum of Four Digit Number After Splitting Digits || Java || Two approaches || Explanation || O(nlogn) || O(n) || Very Easy to understand || --- ...f Four Digit Number After Splitting Digits | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 2160. Minimum Sum of Four Digit Number After Splitting Digits diff --git a/2160. Minimum Sum of Four Digit Number After Splitting Digits b/2160. Minimum Sum of Four Digit Number After Splitting Digits new file mode 100644 index 0000000..6876265 --- /dev/null +++ b/2160. Minimum Sum of Four Digit Number After Splitting Digits @@ -0,0 +1,61 @@ +/* +Get all digits of num. +Sort them. +To get the minimum sum. We need to choose 1st and 2nd digits as tens digits and 3rd and 4th as ones digits. +As when the tens digits will be minimum, then only we will get minimum sum. +For example: +5643=>3,4,5,6 +30+40+5+6=86(min) + +Other possibilities: +30+50+4+6=90 +30+60+4+5=101 +40+50+4+6=100 and so on. + +Method 1: +Time complexity: O(nlogn) +Use array to store the digits of num. +*/ + +class Solution { + public int minimumSum(int num) { + int[] res=new int[4]; + int i=0; + while(num>0){ + res[i]=num%10; + num/=10; + i++; + } + Arrays.sort(res) + return res[0]*10+res[2]+res[1]*10+res[3]; + } +} + + + + + +//method 2 +/* +Method 2: +Use priorityqueue to store the digits of num. +Time complexity: O(n) +*/ + + +class Solution { + public int minimumSum(int num) { + PriorityQueuepq=new PriorityQueue<>(); + //complexity to insert: O(1) + while(num>0){ + pq.offer(num%10); + num/=10; + } + //complexity to remove: O(n) + int a=10*pq.remove(); + int b=10*pq.remove(); + int c=pq.remove(); + int d=pq.remove(); + return a+b+c+d; + } +} From 91411d5a81d12ccc8da96c6b8d78e37ba234a8c7 Mon Sep 17 00:00:00 2001 From: Rahul Sinha <87859957+rahul12043@users.noreply.github.com> Date: Sun, 15 Oct 2023 16:58:40 +0530 Subject: [PATCH 60/80] Create Palindrome_Num_Checker.cpp --- Palindrome_Num_Checker.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 Palindrome_Num_Checker.cpp diff --git a/Palindrome_Num_Checker.cpp b/Palindrome_Num_Checker.cpp new file mode 100644 index 0000000..56a959a --- /dev/null +++ b/Palindrome_Num_Checker.cpp @@ -0,0 +1,28 @@ +#include +using namespace std; + +int main(){ + +int num, result=0; +cout<<"Enter a positive integer: "; +cin>>num; + + +int temporary = num; +while(num>0){ + int dig = num%10; + result = result*10+dig; + num=num/10; +} + +num = temporary; + + + if(result==num){ + cout<<"Number is a palindrome."; +} + else + cout<<"Not a palindrome."; + +return 0; +} From 8460d4625991a5f6b749684fc3c36e49a9d02b30 Mon Sep 17 00:00:00 2001 From: Muhammed Sabah Date: Sun, 15 Oct 2023 19:49:28 +0530 Subject: [PATCH 61/80] Update palindrome.cpp Added a function to check whether string is Palindrome or not without using extra space. --- palindrome.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/palindrome.cpp b/palindrome.cpp index 068f20a..6bc0a39 100644 --- a/palindrome.cpp +++ b/palindrome.cpp @@ -21,13 +21,24 @@ string isPalindrome(string S) } } +//Function to check if string is Palindrome without using extra space +string isPalind(string &s){ + int l=0, r = s.size()-1; + while(l>S; - cout << isPalindrome(S); - - return 0; + cout << isPalindrome(S); + cout< Date: Sun, 15 Oct 2023 22:08:48 +0530 Subject: [PATCH 62/80] added kadans algorithm and unique element in array code in cpp --- FindUniqueElement.cpp | 29 +++++++++++++++++++++++++++++ KadansAlgorithm.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 FindUniqueElement.cpp create mode 100644 KadansAlgorithm.cpp diff --git a/FindUniqueElement.cpp b/FindUniqueElement.cpp new file mode 100644 index 0000000..e8ae77e --- /dev/null +++ b/FindUniqueElement.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +int main() { + int n; + std::cout << "Enter the number of elements: "; + std::cin >> n; + + std::vector arr(n); + + std::cout << "Enter " << n << " elements: "; + for (int i = 0; i < n; ++i) { + std::cin >> arr[i]; + } + + std::set uniqueElements; + for (int i : arr) { + uniqueElements.insert(i); + } + + std::cout << "Unique elements in the array: "; + for (int element : uniqueElements) { + std::cout << element << " "; + } + std::cout << std::endl; + + return 0; +} diff --git a/KadansAlgorithm.cpp b/KadansAlgorithm.cpp new file mode 100644 index 0000000..60b1f70 --- /dev/null +++ b/KadansAlgorithm.cpp @@ -0,0 +1,24 @@ +#include +#include + +int kadanesAlgorithm(const std::vector& arr) { + int maxEndingHere = arr[0]; + int maxSoFar = arr[0]; + + for (int i = 1; i < arr.size(); ++i) { + maxEndingHere = std::max(arr[i], maxEndingHere + arr[i]); + maxSoFar = std::max(maxSoFar, maxEndingHere); + } + + return maxSoFar; +} + +int main() { + std::vector arr = {1, -3, 2, 1, -1}; + + int maxSubarraySum = kadanesAlgorithm(arr); + + std::cout << "Maximum subarray sum: " << maxSubarraySum << std::endl; + + return 0; +} From 69609c5017dd875f602d674d3a0102a278838244 Mon Sep 17 00:00:00 2001 From: kashish-219 Date: Sun, 15 Oct 2023 22:57:34 +0530 Subject: [PATCH 63/80] added evaluate postfix exp --- postfix_eval/eval_postfix.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 postfix_eval/eval_postfix.c diff --git a/postfix_eval/eval_postfix.c b/postfix_eval/eval_postfix.c new file mode 100644 index 0000000..e69de29 From 40343e0c4ad008d9882da696a2dcec1865e34a03 Mon Sep 17 00:00:00 2001 From: NickSahu <4uamystery@gmail.com> Date: Mon, 16 Oct 2023 20:01:39 +0530 Subject: [PATCH 64/80] greatest element in array --- Gr8stIntInArr.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Gr8stIntInArr.cpp diff --git a/Gr8stIntInArr.cpp b/Gr8stIntInArr.cpp new file mode 100644 index 0000000..8c0b0d8 --- /dev/null +++ b/Gr8stIntInArr.cpp @@ -0,0 +1,48 @@ +#include +using namespace std; + +int findLargestElement(int arr[], int size) { + if (size <= 0) { + // Ha the case of an empty array or invalid size + return -1; + } + + int largest = arr[0]; // Assuming the first element is the largest + + for (int i = 1; i < size; i++) { + if (arr[i] > largest) { + largest = arr[i]; // Updating largest if current element is greater + } + } + + return largest; +} + +int main() { + int size; + + cout << "Enter the size of the array: "; + cin >> size; + + if (size <= 0) { + cout << "Invalid array size." <> arr[i]; + } + + int largest = findLargestElement(arr, size); + + if (largest != -1) { + cout << "The largest element in the array is: " << largest < Date: Mon, 16 Oct 2023 21:28:43 +0530 Subject: [PATCH 65/80] added bfs code --- BFS.cpp | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 BFS.cpp diff --git a/BFS.cpp b/BFS.cpp new file mode 100644 index 0000000..f0e309b --- /dev/null +++ b/BFS.cpp @@ -0,0 +1,88 @@ +// Program to print BFS traversal from a given +// source vertex. BFS(int s) traverses vertices +// reachable from s. +#include +using namespace std; + +// This class represents a directed graph using +// adjacency list representation +class Graph +{ + int V; // No. of vertices + + // Pointer to an array containing adjacency + // lists + vector> adj; +public: + Graph(int V); // Constructor + + // function to add an edge to graph + void addEdge(int v, int w); + + // prints BFS traversal from a given source s + void BFS(int s); +}; + +Graph::Graph(int V) +{ + this->V = V; + adj.resize(V); +} + +void Graph::addEdge(int v, int w) +{ + adj[v].push_back(w); // Add w to v’s list. +} + +void Graph::BFS(int s) +{ + // Mark all the vertices as not visited + vector visited; + visited.resize(V,false); + + // Create a queue for BFS + list queue; + + // Mark the current node as visited and enqueue it + visited[s] = true; + queue.push_back(s); + + while(!queue.empty()) + { + // Dequeue a vertex from queue and print it + s = queue.front(); + cout << s << " "; + queue.pop_front(); + + // Get all adjacent vertices of the dequeued + // vertex s. If a adjacent has not been visited, + // then mark it visited and enqueue it + for (auto adjecent: adj[s]) + { + if (!visited[adjecent]) + { + visited[adjecent] = true; + queue.push_back(adjecent); + } + } + } +} + +// Driver program to test methods of graph class +int main() +{ + // Create a graph given in the above diagram + Graph g(4); + g.addEdge(0, 1); + g.addEdge(0, 2); + g.addEdge(1, 2); + g.addEdge(2, 0); + g.addEdge(2, 3); + g.addEdge(3, 3); + + cout << "Following is Breadth First Traversal " + << "(starting from vertex 2) \n"; + g.BFS(2); + + return 0; +} From 2bbca41a186619d203a7984a9790be37e7898e36 Mon Sep 17 00:00:00 2001 From: Urvashi Date: Tue, 17 Oct 2023 10:29:36 +0530 Subject: [PATCH 66/80] Create NGE.java --- NGE.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 NGE.java diff --git a/NGE.java b/NGE.java new file mode 100644 index 0000000..cb09b85 --- /dev/null +++ b/NGE.java @@ -0,0 +1,22 @@ +//leetcode --> 496. Next Greater Element I +import java.util.*; +class Hactober { + public static int[] nextGreaterElement(int[] nums1, int[] nums2) { + HashMap map = new HashMap<>(); + Stack s = new Stack<>(); + for(int i:nums2){ + while(!s.isEmpty()&&s.peek() Date: Wed, 18 Oct 2023 19:08:32 +0530 Subject: [PATCH 67/80] added pattern program --- patterns/.DS_Store | Bin 0 -> 8196 bytes patterns/numberPatterns/Pattern23.java | 45 ++++++++++++++++ patterns/numberPatterns/Pattern24.java | 45 ++++++++++++++++ patterns/numberPatterns/Pattern25.java | 45 ++++++++++++++++ patterns/numberPatterns/Pattern26.java | 46 ++++++++++++++++ patterns/numberPatterns/Pattern27.java | 51 ++++++++++++++++++ patterns/numberPatterns/Pattern28.java | 50 +++++++++++++++++ patterns/numberPatterns/Pattern29.java | 49 +++++++++++++++++ patterns/numberPatterns/Pattern30.java | 36 +++++++++++++ patterns/numberPatterns/Pattern31.java | 42 +++++++++++++++ patterns/numberPatterns/Pattern32.java | 53 ++++++++++++++++++ patterns/numberPatterns/Pattern33.java | 45 ++++++++++++++++ patterns/starPatterns/Pattern0.java | 27 ++++++++++ patterns/starPatterns/Pattern1.java | 35 ++++++++++++ patterns/starPatterns/Pattern10.java | 38 +++++++++++++ patterns/starPatterns/Pattern11.java | 50 +++++++++++++++++ patterns/starPatterns/Pattern12.java | 52 ++++++++++++++++++ patterns/starPatterns/Pattern13.java | 46 ++++++++++++++++ patterns/starPatterns/Pattern14.java | 57 ++++++++++++++++++++ patterns/starPatterns/Pattern15.java | 50 +++++++++++++++++ patterns/starPatterns/Pattern16.java | 52 ++++++++++++++++++ patterns/starPatterns/Pattern17.java | 52 ++++++++++++++++++ patterns/starPatterns/Pattern18.java | 47 ++++++++++++++++ patterns/starPatterns/Pattern19.java | 63 ++++++++++++++++++++++ patterns/starPatterns/Pattern2.java | 33 ++++++++++++ patterns/starPatterns/Pattern20.java | 13 +++++ patterns/starPatterns/Pattern21.java | 69 ++++++++++++++++++++++++ patterns/starPatterns/Pattern22.java | 71 +++++++++++++++++++++++++ patterns/starPatterns/Pattern3.java | 38 +++++++++++++ patterns/starPatterns/Pattern4.java | 53 ++++++++++++++++++ patterns/starPatterns/Pattern5.java | 42 +++++++++++++++ patterns/starPatterns/Pattern6.java | 40 ++++++++++++++ patterns/starPatterns/Pattern7.java | 39 ++++++++++++++ patterns/starPatterns/Pattern8.java | 14 +++++ patterns/starPatterns/Pattern9.java | 46 ++++++++++++++++ 35 files changed, 1534 insertions(+) create mode 100644 patterns/.DS_Store create mode 100644 patterns/numberPatterns/Pattern23.java create mode 100644 patterns/numberPatterns/Pattern24.java create mode 100644 patterns/numberPatterns/Pattern25.java create mode 100644 patterns/numberPatterns/Pattern26.java create mode 100644 patterns/numberPatterns/Pattern27.java create mode 100644 patterns/numberPatterns/Pattern28.java create mode 100644 patterns/numberPatterns/Pattern29.java create mode 100644 patterns/numberPatterns/Pattern30.java create mode 100644 patterns/numberPatterns/Pattern31.java create mode 100644 patterns/numberPatterns/Pattern32.java create mode 100644 patterns/numberPatterns/Pattern33.java create mode 100644 patterns/starPatterns/Pattern0.java create mode 100644 patterns/starPatterns/Pattern1.java create mode 100644 patterns/starPatterns/Pattern10.java create mode 100644 patterns/starPatterns/Pattern11.java create mode 100644 patterns/starPatterns/Pattern12.java create mode 100644 patterns/starPatterns/Pattern13.java create mode 100644 patterns/starPatterns/Pattern14.java create mode 100644 patterns/starPatterns/Pattern15.java create mode 100644 patterns/starPatterns/Pattern16.java create mode 100644 patterns/starPatterns/Pattern17.java create mode 100644 patterns/starPatterns/Pattern18.java create mode 100644 patterns/starPatterns/Pattern19.java create mode 100644 patterns/starPatterns/Pattern2.java create mode 100644 patterns/starPatterns/Pattern20.java create mode 100644 patterns/starPatterns/Pattern21.java create mode 100644 patterns/starPatterns/Pattern22.java create mode 100644 patterns/starPatterns/Pattern3.java create mode 100644 patterns/starPatterns/Pattern4.java create mode 100644 patterns/starPatterns/Pattern5.java create mode 100644 patterns/starPatterns/Pattern6.java create mode 100644 patterns/starPatterns/Pattern7.java create mode 100644 patterns/starPatterns/Pattern8.java create mode 100644 patterns/starPatterns/Pattern9.java diff --git a/patterns/.DS_Store b/patterns/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..95f99d63eccd27db57a85a7f8d3d43ecf1606a50 GIT binary patch literal 8196 zcmeHMPfrs;6n_uUb_HZX3aFTD?8QV95fNjIp;n9%V?aufKVsQ!hq|(zX?C|D5R#tt zf$V@+XXN^`300b^5)Qw&t* zG;T?C!c2@cg~}XInFGcvW1OL2v^v>Ykvd>Tp>8z;nt{Cx$lU!jaHv8VoE`bQ%;h-* z&Pq^mJmHYud#B>LLD=8_1sfWhPMl06j6`!{KKER#wVU>p@EG)YyIXx zf1fpYZD?b|NT$+PZcXHuyfPQBlv^0z8lZKTo39V^(Jd^;KH|r^kKar)_A+UlYHn#g z-Db9ToN4cDPo+{_-Knm#UFY-W8OJUxm3;Z_?+Q=&S+C0GO1@jnRqTSxOVc5H8RpzI zmNz?gsZOxsv#qYl)e7l!ZgoV{-S-*e(R^czivbI#^JZI6@P+4%i@*(C!DqIO&O8l> z`_Yh~OuP?TqE-?w>*Wml!9oUI`ExXxTMn_wHN=U(oe|5xt!AxhHsu^yC~Z z5YTCrz3t@c|BC#5{o5AxpAV1vu2gqVs{34bua5cyqCTA&QsMZ=!~Zc(U;&HhMgdNX zZ2kZ)s1@ri1|;pf>AQlzZlv)TGSH}e?veTbz5UPsk0CSKWzE3xVE~&(awA#txBg1C z+jW_1TT~aQ$|Ch@3L_J0qI8@vO2-K||1c!kB2{UViLs`TdZ_&Kg8+IB{(En|`uQJi Ks&0-v1HS;xM#ZZD literal 0 HcmV?d00001 diff --git a/patterns/numberPatterns/Pattern23.java b/patterns/numberPatterns/Pattern23.java new file mode 100644 index 0000000..014c01b --- /dev/null +++ b/patterns/numberPatterns/Pattern23.java @@ -0,0 +1,45 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + + 1 + 111 + 11111 + 1111111 +111111111 + + */ + +public class Pattern23 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp=n-1; + int nst=1; + int value =1; + + //rows + int row=1; + while(row<=n){ + + //space + for(int csp= 1 ;csp<=nsp;csp++){ + System.out.print(" "); + } + //star + + for(int cst=1;cst<=nst;cst++){ + System.out.print(value); + } + + //pre + System.out.println(); + nsp--; + nst+=2; + + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern24.java b/patterns/numberPatterns/Pattern24.java new file mode 100644 index 0000000..759dfcf --- /dev/null +++ b/patterns/numberPatterns/Pattern24.java @@ -0,0 +1,45 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + 1 + 222 + 33333 + 4444444 +555555555 + + */ + +public class Pattern24 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp=n-1; + int nst=1; + int value =1; + + //rows + int row=1; + while(row<=n){ + //value=row; as we are printing the value same as no. of rows + + //space + for(int csp= 1 ;csp<=nsp;csp++){ + System.out.print(" "); + } + //star + + for(int cst=1;cst<=nst;cst++){ + System.out.print(value); + } + + //pre + System.out.println(); + nsp--; + nst+=2; + value++; + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern25.java b/patterns/numberPatterns/Pattern25.java new file mode 100644 index 0000000..117c423 --- /dev/null +++ b/patterns/numberPatterns/Pattern25.java @@ -0,0 +1,45 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + 1 + 2 3 4 + 5 6 7 8 9 + 10 11 12 13 14 15 16 +17 18 19 20 21 22 23 24 25 + + */ + +public class Pattern25 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp=n-1; + int nst=1; + int value =1; + + //rows + int row=1; + while(row<=n){ + + //space + for(int csp= 1 ;csp<=nsp;csp++){ + System.out.print("\t"); + } + //star + + for(int cst=1;cst<=nst;cst++){ + //numbers + System.out.print(value + "\t"); + value++; + } + + //pre + System.out.println(); + nsp--; + nst+=2; + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern26.java b/patterns/numberPatterns/Pattern26.java new file mode 100644 index 0000000..68b0baf --- /dev/null +++ b/patterns/numberPatterns/Pattern26.java @@ -0,0 +1,46 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + + 1 + 1 2 3 + 1 2 3 4 5 + 1 2 3 4 5 6 7 +1 2 3 4 5 6 7 8 9 + + + */ + +public class Pattern26 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp=n-1; + int nst=1; + + //rows + int row=1; + while(row<=n){ + + //space + for(int csp= 1 ;csp<=nsp;csp++){ + System.out.print("\t"); + } + //star + + for(int cst=1;cst<=nst;cst++){ + //as we are prining the count of star + System.out.print(cst + "\t"); + + } + + //pre + System.out.println(); + nsp--; + nst+=2; + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern27.java b/patterns/numberPatterns/Pattern27.java new file mode 100644 index 0000000..ef3b107 --- /dev/null +++ b/patterns/numberPatterns/Pattern27.java @@ -0,0 +1,51 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + + 1 + 1 2 1 + 1 2 3 2 1 + 1 2 3 4 3 2 1 +1 2 3 4 5 4 3 2 1 + + + */ + +public class Pattern27 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp=n-1; + int nst=1; + int value; + //rows + int row=1; + while(row<=n){ + value=1; + //space + for(int csp= 1 ;csp<=nsp;csp++){ + System.out.print("\t"); + } + //star + + for(int cst=1;cst<=nst;cst++){ + //as we are prining the count of star + System.out.print(value + "\t"); + if(cst<=nst/2){ + value++; + }else{ + value--; + } + + } + + //pre + System.out.println(); + nsp--; + nst+=2; + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern28.java b/patterns/numberPatterns/Pattern28.java new file mode 100644 index 0000000..f82d311 --- /dev/null +++ b/patterns/numberPatterns/Pattern28.java @@ -0,0 +1,50 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + 1 + 2 3 2 + 3 4 5 4 3 + 4 5 6 7 6 5 4 +5 6 7 8 9 8 7 6 5 + + */ + +public class Pattern28 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst=1; + int nsp=n-1; + int value; + + //row + int row=1; + while(row<=n){ + //space + value=row; + for(int csp=1;csp<=nsp;csp++){ + System.out.print("\t"); + } + + //star + for(int cst=1;cst<=nst;cst++){ + //print the no. + System.out.print(value + "\t"); + if(cst<=nst/2){ + value++; + }else{ + value--; + } + } + + //preparation + System.out.println(); + nst+=2; + nsp--; + + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern29.java b/patterns/numberPatterns/Pattern29.java new file mode 100644 index 0000000..ca40bd2 --- /dev/null +++ b/patterns/numberPatterns/Pattern29.java @@ -0,0 +1,49 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + 1 + 2 0 2 + 3 0 0 0 3 + 4 0 0 0 0 0 4 +5 0 0 0 0 0 0 0 5 + + */ + +public class Pattern29 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst=1; + int nsp=n-1; + int value; + + //row + int row=1; + while(row<=n){ + //space + value=row; + for(int csp=1;csp<=nsp;csp++){ + System.out.print("\t"); + } + + //star + for(int cst=1;cst<=nst;cst++){ + //print the no. + if(cst==1 || cst==nst){ + System.out.print(value + "\t"); + }else{ + System.out.print(0 + "\t"); + } + } + + //preparation + System.out.println(); + nst+=2; + nsp--; + + row++; + } + } +} diff --git a/patterns/numberPatterns/Pattern30.java b/patterns/numberPatterns/Pattern30.java new file mode 100644 index 0000000..8631712 --- /dev/null +++ b/patterns/numberPatterns/Pattern30.java @@ -0,0 +1,36 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; +/* + +5 4 3 2 1 +5 4 3 2 1 +5 4 3 2 1 +5 4 3 2 1 +5 4 3 2 1 + + */ + +public class Pattern30 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst=n; + int value; + //rows + int row=1; + while (row<=n){ + value=n; + //star + for(int cst=1;cst<=nst;cst++){ + System.out.print(value + "\t"); + value--; + } + + //pre + System.out.println(); + row++; + + } + } +} diff --git a/patterns/numberPatterns/Pattern31.java b/patterns/numberPatterns/Pattern31.java new file mode 100644 index 0000000..63513cb --- /dev/null +++ b/patterns/numberPatterns/Pattern31.java @@ -0,0 +1,42 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + +5 4 3 2 * +5 4 3 * 1 +5 4 * 2 1 +5 * 3 2 1 +* 4 3 2 1 + + */ + +public class Pattern31 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst=n; + int value; + //rows + int row=1; + while (row<=n){ + value=n; + //star + for(int cst=1;cst<=nst;cst++){ + + if(value==row){ + System.out.print("*\t"); + }else{ + System.out.print(value + "\t"); + } + value--; + } + + //pre + System.out.println(); + row++; + + } + } +} diff --git a/patterns/numberPatterns/Pattern32.java b/patterns/numberPatterns/Pattern32.java new file mode 100644 index 0000000..5bbbad3 --- /dev/null +++ b/patterns/numberPatterns/Pattern32.java @@ -0,0 +1,53 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +/* + +1 +2 * 2 +3 * 3 * 3 +4 * 4 * 4 * 4 +5 * 5 * 5 * 5 * 5 +4 * 4 * 4 * 4 +3 * 3 * 3 +2 * 2 +1 + + */ + +public class Pattern32 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); //5 + int nr= 2*n-1; + int nst=1; + int value=1; + //rows + int row=1; + while(row<=nr){ + + //star + for(int cst=1;cst<=nst;cst++){ + if(cst%2==0){ + System.out.print("*\t"); + }else{ + System.out.print(value+ "\t"); + } + + } + + //pre + System.out.println(); + if(row<=nr/2){ + nst+=2; + value++; + }else{ + nst-=2; + value--; + } + row++; + + } + } +} diff --git a/patterns/numberPatterns/Pattern33.java b/patterns/numberPatterns/Pattern33.java new file mode 100644 index 0000000..7ae43af --- /dev/null +++ b/patterns/numberPatterns/Pattern33.java @@ -0,0 +1,45 @@ +package basics.patterns.numberPatterns; + +import java.util.Scanner; + +public class Pattern33 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); //10 + int nst=1; + int nsp=n-1; + int value=n; + //rows + int row=1; + while(row<=n){ + //space + for(int csp=1;csp<=nsp;csp++){ + System.out.print("\t"); + } + + //star + for(int cst=1;cst<=nst;cst++){ + //as we are prining the count of star + if(value==n) + { + System.out.print(0 + "\t"); + }else{ + System.out.print(value + "\t"); + } + if(cst<=nst/2){ + value++; + }else{ + value--; + } + + } + + //pre + System.out.println(); + nsp--; + nst+=2; + row++; + } + + } +} diff --git a/patterns/starPatterns/Pattern0.java b/patterns/starPatterns/Pattern0.java new file mode 100644 index 0000000..681b560 --- /dev/null +++ b/patterns/starPatterns/Pattern0.java @@ -0,0 +1,27 @@ + package basics.patterns.starPatterns; +import java.util.*; +public class Pattern0 { + + public static void main(String[] args) { + + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int row=1; + //rows + + while(row<=n) { + //work + System.out.print("x"); + + //prepation + System.out.println(); + row++; + } + + + + + + } + +} diff --git a/patterns/starPatterns/Pattern1.java b/patterns/starPatterns/Pattern1.java new file mode 100644 index 0000000..43fcf5c --- /dev/null +++ b/patterns/starPatterns/Pattern1.java @@ -0,0 +1,35 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + +x x x x x +x x x x x +x x x x x +x x x x x +x x x x x + +*/ + +public class Pattern1 { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int row=1; + + while(row<=n) { + //work + for(int col = 1;col<=n;col++) { + System.out.print("x "); + } + //prepartion + + System.out.println(); + row++; + } + + } + +} diff --git a/patterns/starPatterns/Pattern10.java b/patterns/starPatterns/Pattern10.java new file mode 100644 index 0000000..59ff1e5 --- /dev/null +++ b/patterns/starPatterns/Pattern10.java @@ -0,0 +1,38 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern10 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = n+4; + int nsp = 0; + + //rows + int row=1; + while(row<=n){ + + + // space work + int csp= 1; + while(csp<=nsp){ + System.out.print(" "); + csp++; + } + + //star work + int cst= 1; + while(cst<=nst){ + System.out.print("x"); + cst++; + } + + //preparation + System.out.println(); + nsp++; + nst-=2; + row++; + } + } +} diff --git a/patterns/starPatterns/Pattern11.java b/patterns/starPatterns/Pattern11.java new file mode 100644 index 0000000..c8e39d2 --- /dev/null +++ b/patterns/starPatterns/Pattern11.java @@ -0,0 +1,50 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + x + x x + x x x + x x x x +x x x x x + + */ +public class Pattern11 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = 1; + int nsp = n-1; + + //rows + int row=1; + while(row<=n){ + + //space work + int csp=1; + while(csp<=nsp){ + System.out.print(" "); + csp++; + } + + //star work + int cst =1; + while(cst<=nst){ + //checking the even position + if(cst%2==0){ + System.out.print(" "); + }else{ + System.out.print("x "); + } + cst++; + } + + //preparation + System.out.println(); + nsp--; + nst+=2; + row++; + } + } +} diff --git a/patterns/starPatterns/Pattern12.java b/patterns/starPatterns/Pattern12.java new file mode 100644 index 0000000..cf564b9 --- /dev/null +++ b/patterns/starPatterns/Pattern12.java @@ -0,0 +1,52 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + + x + x ! x + x ! x ! x + x ! x ! x ! x +x ! x ! x ! x ! x + + */ + +public class Pattern12 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = 1; + int nsp = n-1; + + //rows + int row=1; + while(row<=n){ + + //space work + int csp=1; + while(csp<=nsp){ + System.out.print(" "); + csp++; + } + + //star work + int cst =1; + while(cst<=nst){ + //checking the even position + if(cst%2==0){ + System.out.print("! "); + }else{ + System.out.print("x "); + } + cst++; + } + + //preparation + System.out.println(); + nsp--; + nst+=2; + row++; + } + } +} diff --git a/patterns/starPatterns/Pattern13.java b/patterns/starPatterns/Pattern13.java new file mode 100644 index 0000000..61c997b --- /dev/null +++ b/patterns/starPatterns/Pattern13.java @@ -0,0 +1,46 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; +/* + +x +x x +x x x +x x x x +x x x x x +x x x x +x x x +x x +x + + */ + +public class Pattern13 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst= 1;// no of stars + int nr = 2*n-1; + + //rows + int row = 1; + while(row<=nr){ + + //work done + int cst = 1; + while(cst<=nst){ + System.out.print("x "); + cst++; + } + + //preparation + System.out.println(); + if(row<=nr/2){ + nst++; + }else{ + nst--; + } + row++; + } + } +} diff --git a/patterns/starPatterns/Pattern14.java b/patterns/starPatterns/Pattern14.java new file mode 100644 index 0000000..7d21b42 --- /dev/null +++ b/patterns/starPatterns/Pattern14.java @@ -0,0 +1,57 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + + x + x x + x x x + x x x x + x x x x x + x x x x + x x x + x x + x + */ + +public class Pattern14 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nr = 2*n-1; + int nst = 1; + int nsp= n-1; + + //rows + int row = 1; + while(row<=nr){ + + //space work + int csp=1; + while(csp<=nsp){ + System.out.print(" "); + csp++; + } + // star work + + int cst = 1; + while(cst<=nst){ + System.out.print("*"); + cst++; + } + + //prepartion + System.out.println(); + if(row<=nr/2){ + nst++; + nsp--; + }else{ + nst--; + nsp++; + } + row++; + + } + } +} diff --git a/patterns/starPatterns/Pattern15.java b/patterns/starPatterns/Pattern15.java new file mode 100644 index 0000000..9027d75 --- /dev/null +++ b/patterns/starPatterns/Pattern15.java @@ -0,0 +1,50 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; +/* +x x x x x + x x x x + x x x + x x + x + x x + x x x + x x x x +x x x x x + + */ +public class Pattern15 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nr = 2*n-1; + int nst = n; + int nsp= 0; + + //rows + for(int row=1;row<=nr;row++){ + + //space work + for(int csp =1; csp<=nsp;csp++) + { + System.out.print(" "); + } + + //star work + for(int cst =1;cst<=nst;cst++) + { + System.out.print("x "); + } + + //prearation + System.out.println(); + if(row<=nr/2){ + nst--; + nsp+=2; + }else{ + nst++; + nsp-=2; + } + } + } +} diff --git a/patterns/starPatterns/Pattern16.java b/patterns/starPatterns/Pattern16.java new file mode 100644 index 0000000..fec9ef6 --- /dev/null +++ b/patterns/starPatterns/Pattern16.java @@ -0,0 +1,52 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; +/* + + x x x x x + x x x x + x x x + x x +x + x x + x x x + x x x x + x x x x x + + + */ +public class Pattern16 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nr = 2*n-1; + int nst = n; + int nsp= n-1; + + //rows + for(int row=1;row<=nr;row++){ + + //space work + for(int csp =1; csp<=nsp;csp++) + { + System.out.print(" "); + } + + //star work + for(int cst =1;cst<=nst;cst++) + { + System.out.print("x "); + } + + //prearation + System.out.println(); + if(row<=nr/2){ + nst--; + nsp--; + }else{ + nst++; + nsp++; + } + } + } +} diff --git a/patterns/starPatterns/Pattern17.java b/patterns/starPatterns/Pattern17.java new file mode 100644 index 0000000..bd7220f --- /dev/null +++ b/patterns/starPatterns/Pattern17.java @@ -0,0 +1,52 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; +/* + +x x x x x x +x x x x +x x + +x x +x x x x +x x x x x x + + + */ +public class Pattern17 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt();//7 + int nst = n/2; // 7/2 = 3 + int nsp=1; + + //rows + for(int row=1;row<=n;row++){ + + //star work + for(int cst = 1;cst<=nst;cst++){ + System.out.print("x "); + } + //space work + for(int csp=1;csp<=nsp;csp++){ + System.out.print(" "); + } + + //star work + for(int cst = 1;cst<=nst;cst++){ + System.out.print("x "); + } + + //preparation + System.out.println(); + if(row<=n/2){ + nst--; + nsp+=2; + }else{ + nst++; + nsp-=2; + } + + } + } +} diff --git a/patterns/starPatterns/Pattern18.java b/patterns/starPatterns/Pattern18.java new file mode 100644 index 0000000..f30b5be --- /dev/null +++ b/patterns/starPatterns/Pattern18.java @@ -0,0 +1,47 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + x + x x x + x x x x x +x x x x x x x + x x x x x + x x x + x + + */ + +public class Pattern18 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt();//7 + + int nst = 1; + int nsp = n/2; + + //row + for(int row=1;row<=n;row++){ + + //space + for(int csp=1;csp<=nsp;csp++){ + System.out.print(" "); + } + //star + for(int cst = 1; cst <= nst ;cst++){ + System.out.print("x "); + } + + //preparation + System.out.println(); + if(row<=n/2){ + nsp--; + nst+=2; + }else{ + nsp++; + nst-=2; + } + } + } +} diff --git a/patterns/starPatterns/Pattern19.java b/patterns/starPatterns/Pattern19.java new file mode 100644 index 0000000..5217aac --- /dev/null +++ b/patterns/starPatterns/Pattern19.java @@ -0,0 +1,63 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + +x x x x x x x +x x x x x x +x x x x +x x +x x x x +x x x x x x +x x x x x x x + + + */ + +public class Pattern19 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt();//7 + + int nst = n/2+1; + int nsp = -1; + + //row + for(int row=1;row<=n;row++){ + + //star + if(row==1 | row==n){ + + for(int cst = 1; cst <= n ;cst++){ + System.out.print("x "); + } + }else{ + + //star + for(int cst = 1; cst <= nst ;cst++){ + System.out.print("x "); + } + //space + for(int csp=1;csp<=nsp;csp++) { + System.out.print(" "); + } + + //star + for(int cst = 1; cst <= nst ;cst++){ + System.out.print("x "); + } + } + + //preparation + System.out.println(); + if(row<=n/2){ + nsp+=2; + nst--; + }else{ + nsp-=2; + nst++; + } + } + } +} diff --git a/patterns/starPatterns/Pattern2.java b/patterns/starPatterns/Pattern2.java new file mode 100644 index 0000000..f5da95d --- /dev/null +++ b/patterns/starPatterns/Pattern2.java @@ -0,0 +1,33 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern2 { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = 1; // no of star present in first row + int row=1; + + + // no of row + while(row<=n) { + + //work done + + int cst = 1; // counter of stars that need to bee print in a row + while(cst<=nst) { + System.out.print("x "); + cst++; + } + + //pre + System.out.println(); + nst++; + row++; + + + } + } +} diff --git a/patterns/starPatterns/Pattern20.java b/patterns/starPatterns/Pattern20.java new file mode 100644 index 0000000..7a7f6f9 --- /dev/null +++ b/patterns/starPatterns/Pattern20.java @@ -0,0 +1,13 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern20 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt();//7 + + + + } +} diff --git a/patterns/starPatterns/Pattern21.java b/patterns/starPatterns/Pattern21.java new file mode 100644 index 0000000..2a97095 --- /dev/null +++ b/patterns/starPatterns/Pattern21.java @@ -0,0 +1,69 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + +x x +x x x x +x x x x x x +x x x x x x x x +x x x x x x x x x + + + */ + +public class Pattern21 { + + public static void main(String[] args) { + + + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = 1; + int nsp = 2 * n - 3; + + //rows + int row = 1; + while (row <= n) { + + /* work done */ + + //star + int cst = 1; + while (cst <= nst) { + System.out.print("x "); + cst++; + } + + //space + int csp = 1; + while (csp <= nsp) { + System.out.print(" "); + csp++; + } + + //star + + int cstt=1; + if(row==n){ + cstt=2; + } + while (cstt<= nst) { + System.out.print("x "); + cstt++; + } + + + /* preparation */ + System.out.println(); + nst++; + nsp -= 2; + row++; + + + } + + } + +} diff --git a/patterns/starPatterns/Pattern22.java b/patterns/starPatterns/Pattern22.java new file mode 100644 index 0000000..1785f87 --- /dev/null +++ b/patterns/starPatterns/Pattern22.java @@ -0,0 +1,71 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + +x x x x x x x x x +x x x x x x x x +x x x x x x +x x x x +x x + +*/ + +public class Pattern22 { + +public static void main(String[] args) { + + + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = n; + int nsp = -1; + + //rows + int row = 1; + while (row <= n) { + + /* work done */ + + //star + int cst=1; + if(row==1) { + cst = 2; + } + while (cst <= nst) { + System.out.print("x "); + cst++; + } + + + + //space + int csp = 1; + while (csp <= nsp) { + System.out.print(" "); + csp++; + } + + //star + + int cstt=1; + + while (cstt<= nst) { + System.out.print("x "); + cstt++; + } + + + /* preparation */ + System.out.println(); + nst--; + nsp += 2; + row++; + + + } + +} + +} diff --git a/patterns/starPatterns/Pattern3.java b/patterns/starPatterns/Pattern3.java new file mode 100644 index 0000000..2eaad17 --- /dev/null +++ b/patterns/starPatterns/Pattern3.java @@ -0,0 +1,38 @@ +/** + * + */ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern3 { + + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = n; // no of star present in first row + int row = 1; + + + // no of row + while (row <= n) { + + //work done + + int cst = 1; // counter of stars that need to bee print in a row + while (cst <= nst) { + System.out.print("x"); + cst++; + } + + //pre + System.out.println(); + //System.out.print("\t"); + nst--; + row++; + } + + } + +} diff --git a/patterns/starPatterns/Pattern4.java b/patterns/starPatterns/Pattern4.java new file mode 100644 index 0000000..659dfa3 --- /dev/null +++ b/patterns/starPatterns/Pattern4.java @@ -0,0 +1,53 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + * + ** + *** + **** + ***** + ****** +******* + + */ + +public class Pattern4 { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp = n-1; + int nst = 1; + + // row + int row=1; + while(row<= n ) { + + // space work + + int csp = 1; + while(csp<= nsp) { + System.out.print(" "); + csp++; + } + + // star work + + int cst = 1; + + while(cst <= nst) { + System.out.print("*"); + cst++; + } + + //preparation + System.out.println(); + nsp--; + nst++; + row++; + } + } + +} diff --git a/patterns/starPatterns/Pattern5.java b/patterns/starPatterns/Pattern5.java new file mode 100644 index 0000000..486a380 --- /dev/null +++ b/patterns/starPatterns/Pattern5.java @@ -0,0 +1,42 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern5 { + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nsp=0; + int nst = n; + + + //rows + int row=1; + while( row <= n) { + + //star work + int cst = 1; + while(cst <= nst) { + System.out.print("x"); + cst++; + } + + //space work + + int csp = 1; + while(csp <= nsp) { + System.out.print(" "); + csp++; + } + + //pre + System.out.println(); + nsp++; + nst--; + row++; + } + + } + +} diff --git a/patterns/starPatterns/Pattern6.java b/patterns/starPatterns/Pattern6.java new file mode 100644 index 0000000..2f48cc9 --- /dev/null +++ b/patterns/starPatterns/Pattern6.java @@ -0,0 +1,40 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern6 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = n; + int nsp = 0; + + //rows + int rows =1; + while( rows <=n){ + + //spaces work + if(nsp>=2){ + int csp = 1; + while(csp<=nsp){ + System.out.print(" "); + csp++; + } + } + + //star work + int cst = 1; + while (cst <=nst){ + System.out.print("x"); + cst++; + } + + System.out.println(); + nst--; + nsp+=2; + rows++; + + + } + } +} diff --git a/patterns/starPatterns/Pattern7.java b/patterns/starPatterns/Pattern7.java new file mode 100644 index 0000000..3a5fdf6 --- /dev/null +++ b/patterns/starPatterns/Pattern7.java @@ -0,0 +1,39 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern7 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + + int nst =n; + //rows + + for(int row=1;row<=n;row++){ + //work done + if(row==1 || row==n){ + for(int cst =1; cst<=nst;cst++ ){ + System.out.print("x "); + } + } + else{ + for(int cst =1;cst<=n;cst++){ + if(cst==1 || cst==n){ + System.out.print("x "); + }else{ + System.out.print(" "); + } + + + } + + } + + + + System.out.println(); + + } + } +} diff --git a/patterns/starPatterns/Pattern8.java b/patterns/starPatterns/Pattern8.java new file mode 100644 index 0000000..8e84da2 --- /dev/null +++ b/patterns/starPatterns/Pattern8.java @@ -0,0 +1,14 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +public class Pattern8 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + + + + + } +} diff --git a/patterns/starPatterns/Pattern9.java b/patterns/starPatterns/Pattern9.java new file mode 100644 index 0000000..305c6e6 --- /dev/null +++ b/patterns/starPatterns/Pattern9.java @@ -0,0 +1,46 @@ +package basics.patterns.starPatterns; + +import java.util.Scanner; + +/* + x + xxx + xxxxx + xxxxxxx +xxxxxxxxx + + */ + +public class Pattern9 { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int nst = 1; + int nsp = n-1; + + //rows + int row=1; + while(row<=n){ + // space work + int csp= 1; + while(csp<=nsp){ + System.out.print(" "); + csp++; + } + + //star work + + int cst= 1; + while(cst<=nst){ + System.out.print("x"); + cst++; + } + + //preparation + System.out.println(); + nsp--; + nst+=2; + row++; + } + } +} From bf723d1412eeb9189828421a564139ce49ccd7dd Mon Sep 17 00:00:00 2001 From: Souradeep Date: Fri, 20 Oct 2023 05:41:47 +0530 Subject: [PATCH 68/80] Added Dijkstra's algorithm --- application of algorithm/shortestPath.cpp | 64 +++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 application of algorithm/shortestPath.cpp diff --git a/application of algorithm/shortestPath.cpp b/application of algorithm/shortestPath.cpp new file mode 100644 index 0000000..1dd7da9 --- /dev/null +++ b/application of algorithm/shortestPath.cpp @@ -0,0 +1,64 @@ +#include +#include +#include + +const int V = 6; // Number of vertices in the graph + +// Function to find the vertex with the minimum distance value from the set of vertices not yet included in the shortest path tree +int minDistance(const std::vector& dist, const std::vector& sptSet) { + int minDist = INT_MAX, minIndex = -1; + for (int v = 0; v < V; ++v) { + if (!sptSet[v] && dist[v] < minDist) { + minDist = dist[v]; + minIndex = v; + } + } + return minIndex; +} + +// Function to print the constructed distance array +void printSolution(const std::vector& dist) { + std::cout << "Vertex \t Distance from Source" << std::endl; + for (int i = 0; i < V; ++i) { + std::cout << i << " \t " << dist[i] << std::endl; + } +} + +// Dijkstra's algorithm to find the shortest path from source to all vertices +void dijkstra(const std::vector>& graph, int src) { + std::vector dist(V, INT_MAX); // The output array to store the shortest distance from the source vertex + std::vector sptSet(V, false); // Set to keep track of vertices included in the shortest path tree + + dist[src] = 0; // Distance from the source to itself is 0 + + for (int count = 0; count < V - 1; ++count) { + int u = minDistance(dist, sptSet); + + sptSet[u] = true; + + for (int v = 0; v < V; ++v) { + if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX && dist[u] + graph[u][v] < dist[v]) { + dist[v] = dist[u] + graph[u][v]; + } + } + } + + printSolution(dist); +} + +int main() { + std::vector> graph = { + {0, 2, 4, 0, 0, 0}, + {2, 0, 3, 2, 0, 0}, + {4, 3, 0, 0, 1, 0}, + {0, 2, 0, 0, 3, 2}, + {0, 0, 1, 3, 0, 2}, + {0, 0, 0, 2, 2, 0} + }; + + int src = 0; // Source vertex + + dijkstra(graph, src); + + return 0; +} From b449ee9392ea7e0d0602fa34f1655e4ea2573634 Mon Sep 17 00:00:00 2001 From: Gautam Jain Date: Fri, 20 Oct 2023 10:19:26 +0530 Subject: [PATCH 69/80] Add files via upload --- MaxSubarray.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 MaxSubarray.cpp diff --git a/MaxSubarray.cpp b/MaxSubarray.cpp new file mode 100644 index 0000000..0280476 --- /dev/null +++ b/MaxSubarray.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; + +// function for kadane's algorithm +static int kadane(int Array[], int n) { + int max_sum = 0; + int current_sum = 0; + + for(int i=0; i Date: Fri, 20 Oct 2023 10:19:39 +0530 Subject: [PATCH 70/80] Create README.md --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..8ef8fe6 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Programming_Hactoberfest23 From fd818e9f2ada89370ded92153a1337f18b2ea49c Mon Sep 17 00:00:00 2001 From: Alisha Parveen <139856223+Alisha-786@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:54:09 +0530 Subject: [PATCH 71/80] Created Merge Sort --- mergesort.cpp | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 mergesort.cpp diff --git a/mergesort.cpp b/mergesort.cpp new file mode 100644 index 0000000..ab42bd6 --- /dev/null +++ b/mergesort.cpp @@ -0,0 +1,97 @@ +#include +//#include + +// Merges two subarrays of arr[]. +// First subarray is arr[l..m] +// Second subarray is arr[m+1..r] +void merge(int arr[], int l, int m, int r) +{ + int i, j, k; + int n1 = m - l + 1; + int n2 = r - m; + + // Create temp arrays + int L[n1], R[n2]; + + // Copy data to temp arrays L[] and R[] + for (i = 0; i < n1; i++) + L[i] = arr[l + i]; + for (j = 0; j < n2; j++) + R[j] = arr[m + 1 + j]; + + // Merge the temp arrays back into arr[l..r + i = 0; + j = 0; + k = l; + while (i < n1 && j < n2) { + if (L[i] <= R[j]) { + arr[k] = L[i]; + i++; + } + else { + arr[k] = R[j]; + j++; + } + k++; + } + + // Copy the remaining elements of L[], + // if there are any + while (i < n1) { + arr[k] = L[i]; + i++; + k++; + } + + // Copy the remaining elements of R[], + // if there are any + while (j < n2) { + arr[k] = R[j]; + j++; + k++; + } +} + +// l is for left index and r is right index of the +// sub-array of arr to be sorted +void mergeSort(int arr[], int l, int r)//mergeSort(arr, 0, arr_size - 1); +{ + if (l < r) {//arr[0]=2, l=0; r=arr_size-1=6-1=5 + int m = l + ( r - l) / 2;//m=0+(5-0)/2 + + // Sort first and second halves + mergeSort(arr, l, m); + mergeSort(arr, m + 1, r); + + merge(arr, l, m, r); + } +} + +// Function to print an array +void printArray(int A[], int size) +{ + int i; + for (i = 0; i < size; i++) + printf("%d ", A[i]); + printf("\n"); +} + +// Driver code +int main() +{ + int n,i, j; + printf("Enter no of elements in the array:"); + scanf("%d",&n); + int arr[n]; + printf("Enter array to be sorted:\n"); + for(i=0;i Date: Fri, 20 Oct 2023 14:38:36 +0530 Subject: [PATCH 72/80] Created CONTRIBUTING.md for the project --- CONTRIBUTING.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..30b9f91 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,53 @@ +# Contributing to Programming_HacktoberFest-2023 + +Welcome to Programming_Hactober23 ! We appreciate your interest in contributing. Before you get started, please read and follow these guidelines. + +## Prerequisites + +Prior to beginning your contributions, please ensure the following: + +- Possess a GitHub Account. +- Complete your contributor registration on the [Hacktoberfest 2023 website.](https://hacktoberfest.com/) + +
+ +## How to Contribute + +1. **Look for the issue you wish to solve** on the project's issue tracker. + +2. **Comment on the issue**: Please comment on the issue, indicating your interest in working on it. You can use a comment like: "Please assign me this issue." + + + **Note**: + + - If the assigned contributor takes longer than expected to work on the issue, the maintainer may reassign the issue to the next person in the comment queue. + +
+ +## Commit your changes: + +- Make your changes or additions to the code, documentation, or any other improvements. + +- Test your changes thoroughly. + +## Contribution Guidelines + +- Please ensure your code and contributions align with the project's purpose and goals. + +- Follow the coding style and guidelines of the project. + +- Keep your commits and pull requests concise and clearly describe the changes you've made. + +- Do not submit spammy, trivial, or duplicate pull requests. Quality contributions are highly encouraged. + +
+ +## Questions and Support + +- If you have questions or need support related to your contributions or the project, feel free to tag and ask your doubts to the repository maintainer. + +- Thank you for contributing to Programming_HacktoberFest-2023! Your contributions are greatly appreciated. + +
+ + Happy contributing! 🚀 From 9eecf50f37ce34af3255802faa8f3a3e28cc78f4 Mon Sep 17 00:00:00 2001 From: Ishita Kumari <85451704+ishita3513@users.noreply.github.com> Date: Sat, 21 Oct 2023 20:59:34 +0530 Subject: [PATCH 73/80] Create maximum-product-of-two-elements-in-an-array --- maximum-product-of-two-elements-in-an-array | 56 +++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 maximum-product-of-two-elements-in-an-array diff --git a/maximum-product-of-two-elements-in-an-array b/maximum-product-of-two-elements-in-an-array new file mode 100644 index 0000000..67c1427 --- /dev/null +++ b/maximum-product-of-two-elements-in-an-array @@ -0,0 +1,56 @@ +/* + Approach 1 + Time Complexity: O(nlogn) +*/ + +class Solution { + public int maxProduct(int[] nums) { + Arrays.sort(nums); //O(nlogn) time complexity sorting quick sort + return (nums[nums.length-1]-1)*(nums[nums.length-2]-1); + } +} + +/* + Approach 2 + Time Complexity: O(n) +*/ +class Solution { + public int maxProduct(int[] nums) { + int[] arr=new int[2]; + arr[0]=nums[0];//take array of size 2 store maximum two elements as we traverse through the array. + arr[1]=nums[1]; + //Once traversing the array has O(n) time complexity + for(int i=2;iarr[0] && nums[i]>arr[1]){ + if(arr[0]arr[0]){ + arr[0]=nums[i]; + } + else if(nums[i]>arr[1]){ + arr[1]=nums[i]; + } + } + return (arr[0]-1)*(arr[1]-1); + } +} + +/* + Approach 3 + Time complexity: O(n) using PriorityQueue +*/ +class Solution { + public int maxProduct(int[] nums) { + PriorityQueuepq=new PriorityQueue<>(); + for(int num:nums){ + pq.offer(num); + if(pq.size()>2)pq.poll(); + } + return (pq.poll()-1)*(pq.poll()-1); + } +} From 573875c22adc7463f5e3979e253d01907259ff3a Mon Sep 17 00:00:00 2001 From: Ishita Kumari <85451704+ishita3513@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:06:48 +0530 Subject: [PATCH 74/80] Create count-the-number-of-complete-components --- count-the-number-of-complete-components | 79 +++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 count-the-number-of-complete-components diff --git a/count-the-number-of-complete-components b/count-the-number-of-complete-components new file mode 100644 index 0000000..111c703 --- /dev/null +++ b/count-the-number-of-complete-components @@ -0,0 +1,79 @@ +/* + Just 3 main steps|| dfs || connected graph || check adjList +a) Intuition + 1. Get the number of connected graphs. + 2. For each connected graph, each element should be present in other's adjacency list. + 3. If the 2nd step becomes correct, increment count by 1. +b) Approach + 1. Make the adjacency list using map. + 2. dfs approach to get the list of connected nodes. + 3. Check whether each node has edges to other in the connected graph. + -->take the adjency list and add itself to its adjency list. + -->If adjency list == connectedNode list (for each node in the connected graph), count it. + +*/ + +class Solution { + List dfs(Listlist,Map>map,int key,int[] vis){ + //visted again means traversal completed for a given connected chunk of nodes + if(vis[key]==1)return list; + //mark node as visted + vis[key]=1; + //store list in new list + Listli=new ArrayList<>(list); + li.add(key); + for(int i=0;ilist,Map>adjList){ + int cnt=0; + for(Integer i:list){ + //if a node can visit to all other node + //means adj list just lack itself + //if we add it to its own adjacency list, + //adj will be equal to list. + Listadj=new ArrayList<>(adjList.get(i)); + adj.add(i); + Collections.sort(adj); + if(list.equals(adj))cnt++; + } + return cnt==list.size()?1:0; + } + public int countCompleteComponents(int n, int[][] edges) { + //make adjacency list using map + Map>map=new HashMap<>(); + for(int i=0;i()); + map.get(edges[i][0]).add(edges[i][1]); + map.putIfAbsent(edges[i][1],new ArrayList<>()); + map.get(edges[i][1]).add(edges[i][0]); + } + + for(int i=0;i()); + } + int[] vis=new int[map.size()]; + int sum=0; + for(Map.Entry>m:map.entrySet()){ + if(vis[m.getKey()]==0){ + Listlist=new ArrayList<>(); + //get the list of connected nodes + list=dfs(list,map,m.getKey(),vis); + + if(list.size()==1)sum++; + else{ + //sort it to match with the adjacency list of particular nodes. + Collections.sort(list); + sum+=conn(list,map); + } + } + } + return sum; + } +} From fcb6b52452ed9bb78e6233e4e9573275bbca81b8 Mon Sep 17 00:00:00 2001 From: Ishita Kumari <85451704+ishita3513@users.noreply.github.com> Date: Sat, 21 Oct 2023 21:18:45 +0530 Subject: [PATCH 75/80] Create Take input in String form and convert to array format for operation #98 --- ... convert to array format for operation #98 | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Take input in String form and convert to array format for operation #98 diff --git a/Take input in String form and convert to array format for operation #98 b/Take input in String form and convert to array format for operation #98 new file mode 100644 index 0000000..361bbdc --- /dev/null +++ b/Take input in String form and convert to array format for operation #98 @@ -0,0 +1,38 @@ +/* +Steps: +1. Directly take a string as input. +2. Keep a list and a temporary string str. +3. Traverse in the string add the characters in the temporary string until the white space encountered. +4. If white space encountered, add the temporary string to list after converting to integer. +5. Make temporary string empty string. +6. after coming out of the string again check the temporary string and add. +Note: step 6 is important as in most of the cases white space will not come at the end. + so, after coming to end add the temporary string in end. +7. Now, you have the list of integers, without giving the input number of elements. + +*/ + + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; + +public class Solution { + public static void main(String[] args) { + Scanner sc=new Scanner(System.in); + String s=sc.nextLine(); + String str=""; + int n=s.length(); + Listlist=new ArrayList<>(); + for(int i=0;i Date: Sun, 22 Oct 2023 10:38:44 +0530 Subject: [PATCH 76/80] added pattern --- patterns/numberPatterns/Pattern23.java | 45 ---------------------- patterns/numberPatterns/Pattern24.java | 45 ---------------------- patterns/numberPatterns/Pattern25.java | 45 ---------------------- patterns/numberPatterns/Pattern26.java | 46 ---------------------- patterns/numberPatterns/Pattern27.java | 51 ------------------------- patterns/numberPatterns/Pattern28.java | 50 ------------------------ patterns/numberPatterns/Pattern29.java | 49 ------------------------ patterns/numberPatterns/Pattern30.java | 36 ----------------- patterns/numberPatterns/Pattern31.java | 42 -------------------- patterns/numberPatterns/Pattern32.java | 53 -------------------------- patterns/numberPatterns/Pattern33.java | 45 ---------------------- 11 files changed, 507 deletions(-) delete mode 100644 patterns/numberPatterns/Pattern23.java delete mode 100644 patterns/numberPatterns/Pattern24.java delete mode 100644 patterns/numberPatterns/Pattern25.java delete mode 100644 patterns/numberPatterns/Pattern26.java delete mode 100644 patterns/numberPatterns/Pattern27.java delete mode 100644 patterns/numberPatterns/Pattern28.java delete mode 100644 patterns/numberPatterns/Pattern29.java delete mode 100644 patterns/numberPatterns/Pattern30.java delete mode 100644 patterns/numberPatterns/Pattern31.java delete mode 100644 patterns/numberPatterns/Pattern32.java delete mode 100644 patterns/numberPatterns/Pattern33.java diff --git a/patterns/numberPatterns/Pattern23.java b/patterns/numberPatterns/Pattern23.java deleted file mode 100644 index 014c01b..0000000 --- a/patterns/numberPatterns/Pattern23.java +++ /dev/null @@ -1,45 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - - 1 - 111 - 11111 - 1111111 -111111111 - - */ - -public class Pattern23 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nsp=n-1; - int nst=1; - int value =1; - - //rows - int row=1; - while(row<=n){ - - //space - for(int csp= 1 ;csp<=nsp;csp++){ - System.out.print(" "); - } - //star - - for(int cst=1;cst<=nst;cst++){ - System.out.print(value); - } - - //pre - System.out.println(); - nsp--; - nst+=2; - - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern24.java b/patterns/numberPatterns/Pattern24.java deleted file mode 100644 index 759dfcf..0000000 --- a/patterns/numberPatterns/Pattern24.java +++ /dev/null @@ -1,45 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - 1 - 222 - 33333 - 4444444 -555555555 - - */ - -public class Pattern24 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nsp=n-1; - int nst=1; - int value =1; - - //rows - int row=1; - while(row<=n){ - //value=row; as we are printing the value same as no. of rows - - //space - for(int csp= 1 ;csp<=nsp;csp++){ - System.out.print(" "); - } - //star - - for(int cst=1;cst<=nst;cst++){ - System.out.print(value); - } - - //pre - System.out.println(); - nsp--; - nst+=2; - value++; - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern25.java b/patterns/numberPatterns/Pattern25.java deleted file mode 100644 index 117c423..0000000 --- a/patterns/numberPatterns/Pattern25.java +++ /dev/null @@ -1,45 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - 1 - 2 3 4 - 5 6 7 8 9 - 10 11 12 13 14 15 16 -17 18 19 20 21 22 23 24 25 - - */ - -public class Pattern25 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nsp=n-1; - int nst=1; - int value =1; - - //rows - int row=1; - while(row<=n){ - - //space - for(int csp= 1 ;csp<=nsp;csp++){ - System.out.print("\t"); - } - //star - - for(int cst=1;cst<=nst;cst++){ - //numbers - System.out.print(value + "\t"); - value++; - } - - //pre - System.out.println(); - nsp--; - nst+=2; - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern26.java b/patterns/numberPatterns/Pattern26.java deleted file mode 100644 index 68b0baf..0000000 --- a/patterns/numberPatterns/Pattern26.java +++ /dev/null @@ -1,46 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - - 1 - 1 2 3 - 1 2 3 4 5 - 1 2 3 4 5 6 7 -1 2 3 4 5 6 7 8 9 - - - */ - -public class Pattern26 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nsp=n-1; - int nst=1; - - //rows - int row=1; - while(row<=n){ - - //space - for(int csp= 1 ;csp<=nsp;csp++){ - System.out.print("\t"); - } - //star - - for(int cst=1;cst<=nst;cst++){ - //as we are prining the count of star - System.out.print(cst + "\t"); - - } - - //pre - System.out.println(); - nsp--; - nst+=2; - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern27.java b/patterns/numberPatterns/Pattern27.java deleted file mode 100644 index ef3b107..0000000 --- a/patterns/numberPatterns/Pattern27.java +++ /dev/null @@ -1,51 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - - 1 - 1 2 1 - 1 2 3 2 1 - 1 2 3 4 3 2 1 -1 2 3 4 5 4 3 2 1 - - - */ - -public class Pattern27 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nsp=n-1; - int nst=1; - int value; - //rows - int row=1; - while(row<=n){ - value=1; - //space - for(int csp= 1 ;csp<=nsp;csp++){ - System.out.print("\t"); - } - //star - - for(int cst=1;cst<=nst;cst++){ - //as we are prining the count of star - System.out.print(value + "\t"); - if(cst<=nst/2){ - value++; - }else{ - value--; - } - - } - - //pre - System.out.println(); - nsp--; - nst+=2; - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern28.java b/patterns/numberPatterns/Pattern28.java deleted file mode 100644 index f82d311..0000000 --- a/patterns/numberPatterns/Pattern28.java +++ /dev/null @@ -1,50 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - 1 - 2 3 2 - 3 4 5 4 3 - 4 5 6 7 6 5 4 -5 6 7 8 9 8 7 6 5 - - */ - -public class Pattern28 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nst=1; - int nsp=n-1; - int value; - - //row - int row=1; - while(row<=n){ - //space - value=row; - for(int csp=1;csp<=nsp;csp++){ - System.out.print("\t"); - } - - //star - for(int cst=1;cst<=nst;cst++){ - //print the no. - System.out.print(value + "\t"); - if(cst<=nst/2){ - value++; - }else{ - value--; - } - } - - //preparation - System.out.println(); - nst+=2; - nsp--; - - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern29.java b/patterns/numberPatterns/Pattern29.java deleted file mode 100644 index ca40bd2..0000000 --- a/patterns/numberPatterns/Pattern29.java +++ /dev/null @@ -1,49 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - 1 - 2 0 2 - 3 0 0 0 3 - 4 0 0 0 0 0 4 -5 0 0 0 0 0 0 0 5 - - */ - -public class Pattern29 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nst=1; - int nsp=n-1; - int value; - - //row - int row=1; - while(row<=n){ - //space - value=row; - for(int csp=1;csp<=nsp;csp++){ - System.out.print("\t"); - } - - //star - for(int cst=1;cst<=nst;cst++){ - //print the no. - if(cst==1 || cst==nst){ - System.out.print(value + "\t"); - }else{ - System.out.print(0 + "\t"); - } - } - - //preparation - System.out.println(); - nst+=2; - nsp--; - - row++; - } - } -} diff --git a/patterns/numberPatterns/Pattern30.java b/patterns/numberPatterns/Pattern30.java deleted file mode 100644 index 8631712..0000000 --- a/patterns/numberPatterns/Pattern30.java +++ /dev/null @@ -1,36 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; -/* - -5 4 3 2 1 -5 4 3 2 1 -5 4 3 2 1 -5 4 3 2 1 -5 4 3 2 1 - - */ - -public class Pattern30 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nst=n; - int value; - //rows - int row=1; - while (row<=n){ - value=n; - //star - for(int cst=1;cst<=nst;cst++){ - System.out.print(value + "\t"); - value--; - } - - //pre - System.out.println(); - row++; - - } - } -} diff --git a/patterns/numberPatterns/Pattern31.java b/patterns/numberPatterns/Pattern31.java deleted file mode 100644 index 63513cb..0000000 --- a/patterns/numberPatterns/Pattern31.java +++ /dev/null @@ -1,42 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - -5 4 3 2 * -5 4 3 * 1 -5 4 * 2 1 -5 * 3 2 1 -* 4 3 2 1 - - */ - -public class Pattern31 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); - int nst=n; - int value; - //rows - int row=1; - while (row<=n){ - value=n; - //star - for(int cst=1;cst<=nst;cst++){ - - if(value==row){ - System.out.print("*\t"); - }else{ - System.out.print(value + "\t"); - } - value--; - } - - //pre - System.out.println(); - row++; - - } - } -} diff --git a/patterns/numberPatterns/Pattern32.java b/patterns/numberPatterns/Pattern32.java deleted file mode 100644 index 5bbbad3..0000000 --- a/patterns/numberPatterns/Pattern32.java +++ /dev/null @@ -1,53 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -/* - -1 -2 * 2 -3 * 3 * 3 -4 * 4 * 4 * 4 -5 * 5 * 5 * 5 * 5 -4 * 4 * 4 * 4 -3 * 3 * 3 -2 * 2 -1 - - */ - -public class Pattern32 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); //5 - int nr= 2*n-1; - int nst=1; - int value=1; - //rows - int row=1; - while(row<=nr){ - - //star - for(int cst=1;cst<=nst;cst++){ - if(cst%2==0){ - System.out.print("*\t"); - }else{ - System.out.print(value+ "\t"); - } - - } - - //pre - System.out.println(); - if(row<=nr/2){ - nst+=2; - value++; - }else{ - nst-=2; - value--; - } - row++; - - } - } -} diff --git a/patterns/numberPatterns/Pattern33.java b/patterns/numberPatterns/Pattern33.java deleted file mode 100644 index 7ae43af..0000000 --- a/patterns/numberPatterns/Pattern33.java +++ /dev/null @@ -1,45 +0,0 @@ -package basics.patterns.numberPatterns; - -import java.util.Scanner; - -public class Pattern33 { - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - int n = sc.nextInt(); //10 - int nst=1; - int nsp=n-1; - int value=n; - //rows - int row=1; - while(row<=n){ - //space - for(int csp=1;csp<=nsp;csp++){ - System.out.print("\t"); - } - - //star - for(int cst=1;cst<=nst;cst++){ - //as we are prining the count of star - if(value==n) - { - System.out.print(0 + "\t"); - }else{ - System.out.print(value + "\t"); - } - if(cst<=nst/2){ - value++; - }else{ - value--; - } - - } - - //pre - System.out.println(); - nsp--; - nst+=2; - row++; - } - - } -} From f5bbb289d82a519dcc574e87cde79f73d802844a Mon Sep 17 00:00:00 2001 From: SOURADEEP HAZRA <105676331+Souradeephazra123@users.noreply.github.com> Date: Sat, 28 Oct 2023 02:44:28 +0530 Subject: [PATCH 77/80] Create shortest_path --- application of algorithm/shortest_path | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 application of algorithm/shortest_path diff --git a/application of algorithm/shortest_path b/application of algorithm/shortest_path new file mode 100644 index 0000000..1dd7da9 --- /dev/null +++ b/application of algorithm/shortest_path @@ -0,0 +1,64 @@ +#include +#include +#include + +const int V = 6; // Number of vertices in the graph + +// Function to find the vertex with the minimum distance value from the set of vertices not yet included in the shortest path tree +int minDistance(const std::vector& dist, const std::vector& sptSet) { + int minDist = INT_MAX, minIndex = -1; + for (int v = 0; v < V; ++v) { + if (!sptSet[v] && dist[v] < minDist) { + minDist = dist[v]; + minIndex = v; + } + } + return minIndex; +} + +// Function to print the constructed distance array +void printSolution(const std::vector& dist) { + std::cout << "Vertex \t Distance from Source" << std::endl; + for (int i = 0; i < V; ++i) { + std::cout << i << " \t " << dist[i] << std::endl; + } +} + +// Dijkstra's algorithm to find the shortest path from source to all vertices +void dijkstra(const std::vector>& graph, int src) { + std::vector dist(V, INT_MAX); // The output array to store the shortest distance from the source vertex + std::vector sptSet(V, false); // Set to keep track of vertices included in the shortest path tree + + dist[src] = 0; // Distance from the source to itself is 0 + + for (int count = 0; count < V - 1; ++count) { + int u = minDistance(dist, sptSet); + + sptSet[u] = true; + + for (int v = 0; v < V; ++v) { + if (!sptSet[v] && graph[u][v] && dist[u] != INT_MAX && dist[u] + graph[u][v] < dist[v]) { + dist[v] = dist[u] + graph[u][v]; + } + } + } + + printSolution(dist); +} + +int main() { + std::vector> graph = { + {0, 2, 4, 0, 0, 0}, + {2, 0, 3, 2, 0, 0}, + {4, 3, 0, 0, 1, 0}, + {0, 2, 0, 0, 3, 2}, + {0, 0, 1, 3, 0, 2}, + {0, 0, 0, 2, 2, 0} + }; + + int src = 0; // Source vertex + + dijkstra(graph, src); + + return 0; +} From 14775b315159a23f3574741ea10aaad1214b06de Mon Sep 17 00:00:00 2001 From: Nikhil Falke <76964639+Nikhil-2002@users.noreply.github.com> Date: Wed, 1 Oct 2025 19:58:17 +0530 Subject: [PATCH 78/80] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8ef8fe6..dfee3ea 100644 --- a/README.md +++ b/README.md @@ -1 +1,3 @@ # Programming_Hactoberfest23 +New Contribution Repository +https://github.com/Nikhil-2002/hacktoberfest2025-contributions From edf5fa9378fd90db94b3f101a9abba2ca86faca4 Mon Sep 17 00:00:00 2001 From: Aryan Jagaty Date: Thu, 2 Oct 2025 12:39:00 +0530 Subject: [PATCH 79/80] Added F1 Race Predictor program for Hacktoberfest 2025 --- Python/F1_RACE_PREDICTION.py | 129 +++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Python/F1_RACE_PREDICTION.py diff --git a/Python/F1_RACE_PREDICTION.py b/Python/F1_RACE_PREDICTION.py new file mode 100644 index 0000000..974910f --- /dev/null +++ b/Python/F1_RACE_PREDICTION.py @@ -0,0 +1,129 @@ +# -*- coding: utf-8 -*- +"""Untitled19.ipynb + +Automatically generated by Colab. + +Original file is located at + https://colab.research.google.com/drive/1n8tDlXoN3D4JWiWUl-WPjG2wfc9qMR1C + +NEW MODEL +""" + +import pandas as pd +import numpy as np +from sklearn.model_selection import train_test_split +from sklearn.ensemble import RandomForestClassifier +from sklearn.metrics import accuracy_score, confusion_matrix + +# Load datasets (update paths if needed) +drivers = pd.read_csv("/content/drivers.csv") +constructor = pd.read_csv("/content/constructors.csv") +driver_standings = pd.read_csv("/content/driver_standings.csv") +constructor_standings = pd.read_csv("/content/constructor_standings.csv") +results = pd.read_csv("/content/results.csv") +constructor_results = pd.read_csv("/content/constructor_results.csv") + +# Merge driver info into results +data = results.merge(drivers, on="driverId", how="left") +# Merge constructor info +data = data.merge(constructor, on="constructorId", how="left") +# Using average points per race for realistic values +driver_points_avg = results.groupby('driverId')['points'].mean().to_dict() +constructor_points_avg = results.groupby('constructorId')['points'].mean().to_dict() + +data['driver_points'] = data['driverId'].map(driver_points_avg) +data['constructor_points'] = data['constructorId'].map(constructor_points_avg) + +data.head() + +# Target = 1 if driver won the race, else 0 +data['target'] = (data['positionOrder'] == 1).astype(int) + +features = ['grid', 'driver_points', 'constructor_points'] +X = data[features] +y = data['target'] + +X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) + +model = RandomForestClassifier(n_estimators=100, random_state=42) +model.fit(X_train, y_train) + +y_pred = model.predict(X_test) +print("Accuracy:", accuracy_score(y_test, y_pred)) +print("Confusion Matrix:\n", confusion_matrix(y_test, y_pred)) + +# Example future race: use actual driver IDs +future_race = pd.DataFrame({ + 'driverId': [1, 2, 3, 4, 5], + 'grid': [1, 2, 3, 4, 5] # starting positions +}) + +# Maping driver names +driver_names = drivers.set_index('driverId')['surname'].to_dict() +future_race['driver_name'] = future_race['driverId'].map(driver_names) + +# Maping latest constructor for each driver from results +latest_race_per_driver = results.groupby('driverId').apply(lambda x: x.sort_values('raceId', ascending=False).iloc[0]) +driver_constructor_map = latest_race_per_driver.set_index('driverId')['constructorId'].to_dict() +future_race['constructorId'] = future_race['driverId'].map(driver_constructor_map) + +# Mapingg constructor names +constructor_names = constructor.set_index('constructorId')['name'].to_dict() +future_race['constructor_name'] = future_race['constructorId'].map(constructor_names) + +# Maping average points per race for drivers and constructors +driver_points_avg = results.groupby('driverId')['points'].mean().to_dict() +constructor_points_avg = results.groupby('constructorId')['points'].mean().to_dict() +future_race['driver_points'] = future_race['driverId'].map(driver_points_avg) +future_race['constructor_points'] = future_race['constructorId'].map(constructor_points_avg) + +future_race + +features = ['grid', 'driver_points', 'constructor_points'] +X_future = future_race[features] + +# Predict probability of winning +future_race['win_probability'] = model.predict_proba(X_future)[:,1] +future_race + +# Sorting by win probability descending +future_race_sorted = future_race.sort_values('win_probability', ascending=False) + +# final table +future_race_sorted[['driver_name', 'constructor_name', 'grid', 'driver_points', 'constructor_points', 'win_probability']] + +# Select top 3 drivers by win probability +top3 = future_race_sorted.head(3) + +# Display a clean leaderboard +for i, row in top3.iterrows(): + print(f"Position {i+1}: {row['driver_name']} ({row['constructor_name']})") + print(f" Grid: {row['grid']}, Avg Driver Points: {row['driver_points']:.1f}, " + f"Avg Constructor Points: {row['constructor_points']:.1f}, " + f"Win Probability: {row['win_probability']:.2%}\n") + +# Sorting by win_probability descending +future_race_sorted = future_race.sort_values('win_probability', ascending=False) + +# top drivers +future_race_sorted[['driver_name', 'constructor_name', 'grid', 'driver_points', 'constructor_points', 'win_probability']] + +import matplotlib.pyplot as plt + +# Sort by win probability descending +future_race_sorted = future_race.sort_values('win_probability', ascending=False) + +# Bar chart of win probabilities +plt.figure(figsize=(12,6)) +bars = plt.bar(future_race_sorted['driver_name'], future_race_sorted['win_probability'], color='royalblue') + +# Add probability values on top of bars +for bar in bars: + height = bar.get_height() + plt.text(bar.get_x() + bar.get_width()/2.0, height + 0.01, f"{height:.2%}", ha='center', va='bottom') + +plt.ylabel('Win Probability') +plt.xlabel('Driver') +plt.title('Predicted Win Probabilities for Future Race') +plt.ylim(0, 1) # set y-axis between 0 and 1 +plt.show() \ No newline at end of file From 1a45dd4a2d6dd60c4e359f8db41c53465db3d65b Mon Sep 17 00:00:00 2001 From: aastikdas Date: Tue, 21 Oct 2025 07:13:34 +0530 Subject: [PATCH 80/80] added rain water problem --- Rainwater trapping.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Rainwater trapping.cpp diff --git a/Rainwater trapping.cpp b/Rainwater trapping.cpp new file mode 100644 index 0000000..c3844a0 --- /dev/null +++ b/Rainwater trapping.cpp @@ -0,0 +1,59 @@ +/* +Problem: Trapping Rain Water +We need to calculate how much water can be trapped between bars of different heights after raining. +Approach (Prefix–Suffix / Auxiliary Arrays Method) + +The main idea is: For each element, the amount of water that can be trapped above it depends on The maximum height to its left and the maximum height to its right + +Water trapped at that position = min(maxLeft, maxRight) - height[i] + +So, we first precompute two arrays: +left[i] → highest bar from the start to index i +right[i] → highest bar from the end to index i +Then, for every index i, we find: water[i] = min(left[i], right[i]) - height[i] +Add up all these values to get the total trapped water. +*/ +#include +using namespace std; + +class Solution { +public: + int trap(vector& height) { + int n = height.size(); + if (n == 0) return 0; + + // Step 1: Precompute the maximum height to the left of each bar + vector leftMax(n); + leftMax[0] = height[0]; + for (int i = 1; i < n; i++) { + leftMax[i] = max(leftMax[i - 1], height[i]); + } + + // Step 2: Precompute the maximum height to the right of each bar + vector rightMax(n); + rightMax[n - 1] = height[n - 1]; + for (int i = n - 2; i >= 0; i--) { + rightMax[i] = max(rightMax[i + 1], height[i]); + } + + // Step 3: Calculate trapped water for each index + int totalWater = 0; + for (int i = 0; i < n; i++) { + int waterLevel = min(leftMax[i], rightMax[i]); + totalWater += (waterLevel - height[i]); + } + + return totalWater; + } +}; + +int main() { + Solution s; + vector height = {4,2,0,3,2,5}; + cout << "Total trapped water: " << s.trap(height) << endl; + return 0; +} + +/*The time complexity of this approach is O(n) since we make three separate passes through the array — one to compute the leftMax array, one to compute the rightMax array, and one final pass to calculate the total trapped water. Each step takes linear time, so the overall complexity remains O(n). + +The space complexity, however, is O(n) because we use two additional arrays, leftMax and rightMax, to store the maximum heights on each side for every index. While this approach is easy to understand and straightforward to implement, it does require extra memory. The main advantage is its clarity and simplicity, but the downside is the use of additional space — which can be optimized using a more efficient two-pointer approach that reduces the space complexity to O(1).*/ \ No newline at end of file