From 6d08ebd94db2f346af3a9a0a67fc9a167866f371 Mon Sep 17 00:00:00 2001 From: BrightSkyz Date: Thu, 11 Oct 2018 06:47:55 -0400 Subject: [PATCH 01/80] Scripts should be at end of body --- html/bootstrapsimple.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/html/bootstrapsimple.html b/html/bootstrapsimple.html index 4f02d127..ec58094c 100644 --- a/html/bootstrapsimple.html +++ b/html/bootstrapsimple.html @@ -8,8 +8,6 @@ - - @@ -41,6 +39,7 @@

Simple Hello world with bootstrap

- + + From 03dd25b4176af79a75fa6d92dd567d7b8719cdf8 Mon Sep 17 00:00:00 2001 From: BrightSkyz Date: Thu, 11 Oct 2018 06:49:30 -0400 Subject: [PATCH 02/80] Put script in head to ensure it is loaded --- html/helloworld_changingcolors.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/html/helloworld_changingcolors.html b/html/helloworld_changingcolors.html index 64487d22..411e3db0 100644 --- a/html/helloworld_changingcolors.html +++ b/html/helloworld_changingcolors.html @@ -2,6 +2,14 @@ Change Color +
@@ -11,11 +19,3 @@

Hello World

- From c65f2b1f38f7dfe30ae579b8133ce88a0334e40f Mon Sep 17 00:00:00 2001 From: BrightSkyz Date: Thu, 11 Oct 2018 06:50:44 -0400 Subject: [PATCH 03/80] Removed unnecessary script block --- html/home.html | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/html/home.html b/html/home.html index 10af6cc0..593514cf 100644 --- a/html/home.html +++ b/html/home.html @@ -10,11 +10,6 @@

Hello world


Click Me!!

- - + From 0052489c58479aa2e588e9e5c302dc5724492fce Mon Sep 17 00:00:00 2001 From: M4l2tllV Date: Thu, 11 Oct 2018 17:51:03 +0700 Subject: [PATCH 04/80] Update CONTRIBUTORS.md Happy Hacktoberfest! --- CONTRIBUTORS.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..57a05643 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,9 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [M4l2tIlV](https://github.com/M4l2tIlV) +Place: Around the World +About: Developer +Programming Language: PYTHON,JS,PHP From a4db9755cdade4b43ec150ca99b794fcd29ae2d4 Mon Sep 17 00:00:00 2001 From: BrightSkyz Date: Thu, 11 Oct 2018 06:51:16 -0400 Subject: [PATCH 05/80] Found missing semicolon --- html/hw2018.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/hw2018.html b/html/hw2018.html index 331f16a3..d39c8ffc 100644 --- a/html/hw2018.html +++ b/html/hw2018.html @@ -7,7 +7,7 @@ Home From 4fa6f5b5ea2d6b9a17e1ef5eb6a6e4e84092a80a Mon Sep 17 00:00:00 2001 From: M4l2tllV Date: Thu, 11 Oct 2018 17:51:56 +0700 Subject: [PATCH 06/80] Add
--- CONTRIBUTORS.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 57a05643..80daaeb3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -961,7 +961,7 @@ About: Computer Engineer
Programming Language: C#, Python
Email: leeosena21@gmail.com
-Name: [M4l2tIlV](https://github.com/M4l2tIlV) -Place: Around the World -About: Developer -Programming Language: PYTHON,JS,PHP +Name: [M4l2tIlV](https://github.com/M4l2tIlV)
+Place: Around the World
+About: Developer
+Programming Language: PYTHON,JS,PHP
From 3cac0d6bf4503f46f0d178fc79daabf24c16bc77 Mon Sep 17 00:00:00 2001 From: M4l2tllV Date: Thu, 11 Oct 2018 17:52:56 +0700 Subject: [PATCH 07/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 80daaeb3..444e3699 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -964,4 +964,4 @@ Email: leeosena21@gmail.com
Name: [M4l2tIlV](https://github.com/M4l2tIlV)
Place: Around the World
About: Developer
-Programming Language: PYTHON,JS,PHP
+Programming Language: PYTHON, JS, PHP
From 6aaf03781b286614f0e6d7791b751c444fd2adf8 Mon Sep 17 00:00:00 2001 From: M4l2tllV Date: Thu, 11 Oct 2018 17:53:46 +0700 Subject: [PATCH 08/80] Update my info Completely Info --- CONTRIBUTORS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 444e3699..f81799cf 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -964,4 +964,4 @@ Email: leeosena21@gmail.com
Name: [M4l2tIlV](https://github.com/M4l2tIlV)
Place: Around the World
About: Developer
-Programming Language: PYTHON, JS, PHP
+Programming Language: JAVA, PYTHON, JS, PHP
From fa698edc7f974e7747becc76b30ee28d2c71cd79 Mon Sep 17 00:00:00 2001 From: Earl Austin Avila Zuniga Date: Thu, 11 Oct 2018 18:54:52 +0800 Subject: [PATCH 09/80] contribute --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..abcd7634 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Austin ZUniga](https://github.com/AustinZuniga) +Place: Manila,Philippines +About: Backend Developer +Programming Language: Python, C, C++, php +Email: earlaustin.zuniga@bicol-u.edu.ph From 3fc35c455544f3eeda54dcdd410bced733acd8d4 Mon Sep 17 00:00:00 2001 From: Olgert Pysqyli Date: Thu, 11 Oct 2018 13:01:37 +0200 Subject: [PATCH 10/80] Created simplejs --- hello-world/simplejs.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 hello-world/simplejs.js diff --git a/hello-world/simplejs.js b/hello-world/simplejs.js new file mode 100644 index 00000000..c58ae102 --- /dev/null +++ b/hello-world/simplejs.js @@ -0,0 +1,5 @@ +const text = ['Hello', 'World']; + +text.map(text => { + console.log(text); +}); From 37d799adaf9417ea5812a032bef856a21b7e5152 Mon Sep 17 00:00:00 2001 From: anantpingle <43113543+anantpingle@users.noreply.github.com> Date: Thu, 11 Oct 2018 13:06:02 +0200 Subject: [PATCH 11/80] Create BinarySearch.java --- binary_search/BinarySearch.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 binary_search/BinarySearch.java diff --git a/binary_search/BinarySearch.java b/binary_search/BinarySearch.java new file mode 100644 index 00000000..bf7f5bf3 --- /dev/null +++ b/binary_search/BinarySearch.java @@ -0,0 +1,28 @@ +import java.util.*; +import java.io.*; +class BinarySearch { + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + int n = sc.nextInt(); + int[] a = new int[n]; + System.out.println("Enter the array in sorted order"); + for(int i = 0; i>1; + if(a[mid]==key) { + ans = mid; + break; + } + if(a[mid] Date: Thu, 11 Oct 2018 16:36:49 +0530 Subject: [PATCH 12/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..db06f784 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,11 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ + +Name: [Anadi Kashyap](https://github.com/anadi198) +Place: Kalyani, India +About: 2nd year Computer Science student +Programming Language: C, C++, Python +Email: anadi.kashyap1598@gmail.com From a1cbae8969058b82813ce274446c418cd068e9f9 Mon Sep 17 00:00:00 2001 From: Anadi Kashyap Date: Thu, 11 Oct 2018 16:38:07 +0530 Subject: [PATCH 13/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index db06f784..c0330df8 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -962,8 +962,8 @@ Programming Language: C#, Python
Email: leeosena21@gmail.com
-Name: [Anadi Kashyap](https://github.com/anadi198) -Place: Kalyani, India -About: 2nd year Computer Science student -Programming Language: C, C++, Python -Email: anadi.kashyap1598@gmail.com +Name: [Anadi Kashyap](https://github.com/anadi198)
+Place: Kalyani, India
+About: 2nd year Computer Science student
+Programming Language: C, C++, Python
+Email: anadi.kashyap1598@gmail.com
From 66441ed62e8cc2f8b31b4e720a8c890d9340e6c7 Mon Sep 17 00:00:00 2001 From: anantpingle <43113543+anantpingle@users.noreply.github.com> Date: Thu, 11 Oct 2018 13:08:19 +0200 Subject: [PATCH 14/80] Create Dynamicfibonacci --- fibonacci/Dynamicfibonacci | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 fibonacci/Dynamicfibonacci diff --git a/fibonacci/Dynamicfibonacci b/fibonacci/Dynamicfibonacci new file mode 100644 index 00000000..2f44f33d --- /dev/null +++ b/fibonacci/Dynamicfibonacci @@ -0,0 +1,30 @@ +//Fibonacci Series using Dynamic Programming +#include + +int fib(int n) +{ + /* Declare an array to store Fibonacci numbers. */ + int f[n+2]; // 1 extra to handle case, n = 0 + int i; + + /* 0th and 1st number of the series are 0 and 1*/ + f[0] = 0; + f[1] = 1; + + for (i = 2; i <= n; i++) + { + /* Add the previous 2 numbers in the series + and store it */ + f[i] = f[i-1] + f[i-2]; + } + + return f[n]; +} + +int main () +{ + int n = 9; + printf("%d", fib(n)); + getchar(); + return 0; +} From 06b0bd83e16e802a845ab0624ed3ec5db558811e Mon Sep 17 00:00:00 2001 From: Jayesh Valbhani Date: Thu, 11 Oct 2018 19:27:10 +0530 Subject: [PATCH 15/80] Added personal details --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..805da0d4 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Jayesh Valbhani](https://github.com/jvalbhani) +Place: Vadodara, India +About: Student, Pursuing MS in Information Technology from DA-IICT. Back-end Develeoper +Programming Language: Java +Email: jayeshvalbhani1711@gmail.com From 121072b501637544ecd5dc5517db128c3ee17d3c Mon Sep 17 00:00:00 2001 From: Aman Singh Date: Thu, 11 Oct 2018 19:33:50 +0530 Subject: [PATCH 16/80] FIRST COMMIT --- .DS_Store | Bin 20484 -> 20484 bytes hello-world/HTML5.html | 19 +++++++------------ hello-world/helloworld.js | 2 +- hello-world/helloworld/index.html | 4 ++-- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.DS_Store b/.DS_Store index b6e7bbf75f9c56ee553e17561a68062f6cdfe6b7..fd958ab42632406175ddd14b8bdefd2fd7add46e 100644 GIT binary patch delta 91 zcmZo!z}T{Yae_Z%!p4Bz{EX_Gc?2SOHXo4jW}es(!>F>EN8uOmW;?yJj1wCy7=<_U p7))f^e9_2^cVdIdWCI_T&D;*AtdkinOg67Doxrr2#lr@{0|0&u9p3-| delta 256 zcmZo!z}T{Yae_Z%^2UJO{EQlt8Eqsss|Yyon94DfFr+f%0C53B217nW9*`9eBug1` z8IpkPA|S7fArYt|lOY92mjKliO-@jd+8izu!OW<-nMdIluPG0M2iTMxplmou1yFqo zgC0Y&XHI@{Qcivn0|SEq0|TQK0|WEN|6sttu$fu!0wbfyW*&oyOom)Q6G9k#8GIN_ zf%-Cl_T)0;pz3DW$H2f63)el%$dY%mfe*`OZU - - - - - Hello World + + + + Document - -

Hello World

-

Hello World

-

+

HELLO WORLD IN THE HACKTOBER FEST

+

ENJOY THE HACKTOBER

- - + \ No newline at end of file diff --git a/hello-world/helloworld.js b/hello-world/helloworld.js index 1ee7ce68..18eba066 100644 --- a/hello-world/helloworld.js +++ b/hello-world/helloworld.js @@ -1 +1 @@ -document.write("Hello World") \ No newline at end of file +console.log("HELLO HACTOBER FEST"); diff --git a/hello-world/helloworld/index.html b/hello-world/helloworld/index.html index 787dcc88..23588bcf 100644 --- a/hello-world/helloworld/index.html +++ b/hello-world/helloworld/index.html @@ -7,9 +7,9 @@ -

HACKTOBERFEST_2k18

+

HACKTOBERFEST_2k18

-Hello world! + Hello world! #HACTOBERFEST_2018 From 9f26f3d155a213f3469d19bef970eab38e7a080b Mon Sep 17 00:00:00 2001 From: Jayesh Valbhani Date: Thu, 11 Oct 2018 19:42:05 +0530 Subject: [PATCH 17/80] Added feature BigInteger In JAVA the maximum size of number is 64-bit (Long), including 1 signed bit. JAVA provides BigInteger to do operations for larger values. --- BigInteger_InJava/Demo.java | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 BigInteger_InJava/Demo.java diff --git a/BigInteger_InJava/Demo.java b/BigInteger_InJava/Demo.java new file mode 100644 index 00000000..fc619887 --- /dev/null +++ b/BigInteger_InJava/Demo.java @@ -0,0 +1,33 @@ +package BigInteger_InJava; + +/* + * In JAVA the maximum size of number is 64-bit (long), including 1 signed bit. + * So JAVA provides BigInteger to do operations for larger values. + * mod, add, div, sub, multiply and etc. for arithmetic operations +`* + * @uthor Jayesh Valbhani + */ + +import java.math.BigInteger; + +public class Demo { + public static void main(String[] args) { + + BigInteger bigNum = new BigInteger("100000000000000000000000"); + long temp = 1235678900; + + System.out.println("Added value : " + bigNum.add(BigInteger.valueOf(temp))); + + System.out.println("Multiplied value : " + bigNum.multiply(BigInteger.valueOf(temp))); + + System.out.println("Divided value : " + bigNum.divide(BigInteger.valueOf(temp))); + + System.out.println("Subtracted value : " + bigNum.subtract(BigInteger.valueOf(temp))); + + System.out.println("Mod value : " + bigNum.mod(BigInteger.valueOf(temp))); + + System.out.println("GCD value : " + bigNum.gcd(BigInteger.valueOf(temp))); + + + } +} From 5aaab3d757e95b2cd80872588e38eadb566813eb Mon Sep 17 00:00:00 2001 From: Kostas Thelouras Date: Thu, 11 Oct 2018 17:33:39 +0300 Subject: [PATCH 18/80] check palindrome in java check if a number is palindrome in two lines --- Palidrome.java | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Palidrome.java diff --git a/Palidrome.java b/Palidrome.java new file mode 100644 index 00000000..31a1a77d --- /dev/null +++ b/Palidrome.java @@ -0,0 +1,6 @@ +class Palidrome{ +public static boolean isPalindrome(int integer) { + String intStr = String.valueOf(integer); + return intStr.equals(new StringBuilder(intStr).reverse().toString()); +} +} From f9d56220bb8e9ca526bf14909bbbc57f7e014205 Mon Sep 17 00:00:00 2001 From: Kostas Thelouras Date: Thu, 11 Oct 2018 17:35:20 +0300 Subject: [PATCH 19/80] Create MergeSort.go merge sort in go lang --- mergesort/MergeSort.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mergesort/MergeSort.go diff --git a/mergesort/MergeSort.go b/mergesort/MergeSort.go new file mode 100644 index 00000000..a44b6eb6 --- /dev/null +++ b/mergesort/MergeSort.go @@ -0,0 +1,41 @@ + +package main + +import "fmt" + +func merge (a []int, b []int) []int { + var r = make([]int, len(a) + len(b)) + var i = 0 + var j = 0 + + for i < len(a) && j < len(b) { + if a[i] <= b[j] { + r[i+j] = a[i] + i++ + } else { + r[i+j] = b[j] + j++ + } + } + + for i < len(a) { r[i+j] = a[i]; i++ } + for j < len(b) { r[i+j] = b[j]; j++ } + + return r +} + +func Mergesort (items []int) []int { + if len(items) < 2 { + return items + } + + var middle = len(items) / 2 + + var a = Mergesort(items[:middle]) + var b = Mergesort(items[middle:]) + return merge(a, b) +} + +func main () { + fmt.Print(Mergesort([]int{ 10, 9, 8, 4, 5, 6, 7, 3, 2, 1 }), "\n") +} From c9037a31b59739eef0cb79d209ab221d55725389 Mon Sep 17 00:00:00 2001 From: Kostas Thelouras Date: Thu, 11 Oct 2018 17:36:11 +0300 Subject: [PATCH 20/80] Create MergeSort.java --- mergesort/MergeSort.java | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 mergesort/MergeSort.java diff --git a/mergesort/MergeSort.java b/mergesort/MergeSort.java new file mode 100644 index 00000000..ce0fe48a --- /dev/null +++ b/mergesort/MergeSort.java @@ -0,0 +1,73 @@ +void merge(int arr[], int l, int m, int r) + { + // Find sizes of two subarrays to be merged + int n1 = m - l + 1; + int n2 = r - m; + + /* Create temp arrays */ + int L[] = new int [n1]; + int R[] = new int [n2]; + + /*Copy data to temp arrays*/ + for (int i=0; i Date: Thu, 11 Oct 2018 17:42:03 +0200 Subject: [PATCH 21/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..6468bc56 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ + +Name: [rame54](https://github.com/rame54) +Place: Milan, Italy +About: It systems and network security student +Programming Language: Assembly, python, c, php From 48fb9eeaa27393e5556fd4eb65f73976a6fb93b9 Mon Sep 17 00:00:00 2001 From: rame54 <32925126+rame54@users.noreply.github.com> Date: Thu, 11 Oct 2018 17:44:26 +0200 Subject: [PATCH 22/80] Create hello_world.c --- hello-world/hello_world.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hello-world/hello_world.c diff --git a/hello-world/hello_world.c b/hello-world/hello_world.c new file mode 100644 index 00000000..7d6fef57 --- /dev/null +++ b/hello-world/hello_world.c @@ -0,0 +1,9 @@ +#include + +int main() { + +printf("Hello world!"); + +return 0; + +} From 9e366fc9d012a1585cdda820a706a056f4193aeb Mon Sep 17 00:00:00 2001 From: ccconrad <44064617+ccconrad@users.noreply.github.com> Date: Thu, 11 Oct 2018 11:47:29 -0400 Subject: [PATCH 23/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..70105f14 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,9 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [LCaleb Conrad](https://github.com/ccconrad)
+Place: Ohio, United States. +About: Programmer and avid drinker. +Programming Language: C#, C++ From 5b82304fb5ff6aa5c9d10697683cf2991e550ecf Mon Sep 17 00:00:00 2001 From: xenocidewiki Date: Thu, 11 Oct 2018 17:47:52 +0200 Subject: [PATCH 24/80] Added a hello world program which converts the binary string to text to print it out. --- hello-world/helloworldbinary.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 hello-world/helloworldbinary.cpp diff --git a/hello-world/helloworldbinary.cpp b/hello-world/helloworldbinary.cpp new file mode 100644 index 00000000..b4deadfa --- /dev/null +++ b/hello-world/helloworldbinary.cpp @@ -0,0 +1,22 @@ +#include +#include +#include +#include + +int main() +{ + std::string binary_representation = "011010000110010101101100011011000110111100100000011101110110111101110010011011000110010000100001"; + std::string hello_world_binary; + + std::istringstream in(binary_representation); + std::bitset<8> bitset; + + while (in >> bitset) + hello_world_binary += bitset.to_ulong(); + + + std::cout << hello_world_binary << std::endl; + + std::cin.get(); + return 0; +} From 85de695739443701d81367ef11eef7eaca8f43a5 Mon Sep 17 00:00:00 2001 From: ccconrad <44064617+ccconrad@users.noreply.github.com> Date: Thu, 11 Oct 2018 11:52:02 -0400 Subject: [PATCH 25/80] Create C#.cs --- hello-world/C#.cs | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 hello-world/C#.cs diff --git a/hello-world/C#.cs b/hello-world/C#.cs new file mode 100644 index 00000000..f3572444 --- /dev/null +++ b/hello-world/C#.cs @@ -0,0 +1,8 @@ +using System; +class Program +{ + public static void Main(string[] args) + { + Console.WriteLine("Hello, world!"); + } +} From 9dbeec09b7e2fd50747ab62f9e9c18de8b3e8114 Mon Sep 17 00:00:00 2001 From: Himanshu Thanna Date: Thu, 11 Oct 2018 21:25:58 +0530 Subject: [PATCH 26/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..6fb84798 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,9 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name:[Himanshu Thanna](https://github.com/himanshuthanna) +Place:Delhi,India +About:TCS Employee +Programming language:Java,C From 17f7f05a17e5fee943c11a1e5808727ad0f688c9 Mon Sep 17 00:00:00 2001 From: Himanshu Thanna Date: Thu, 11 Oct 2018 21:27:57 +0530 Subject: [PATCH 27/80] Create ArrayToArrayList.java Array To ArrayList in java --- ArrayToArrayList.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ArrayToArrayList.java diff --git a/ArrayToArrayList.java b/ArrayToArrayList.java new file mode 100644 index 00000000..186631ad --- /dev/null +++ b/ArrayToArrayList.java @@ -0,0 +1,24 @@ +import java.util.Arrays; +import java.util.List; +import java.util.ArrayList; +class A{ + public static void main(String args[]) + { int[] arr={1,5,6,7,42,4,}; + System.out.println(Arrays.toString(arr)); + //Create Integer array bcz in List Integer works not int + Integer[] i=new Integer[arr.length]; + //Put arr element into Integer array + for(int j=0;j ar=new ArrayList<>(Arrays.asList(i)); + ar.add(54889); + System.out.println(ar); + + + + } + +} From fc84f2f595ee6be3be174619b593d8b5374274be Mon Sep 17 00:00:00 2001 From: Alex Benchea Date: Thu, 11 Oct 2018 19:03:56 +0300 Subject: [PATCH 28/80] Hello World --- CONTRIBUTORS.md | 8 +++++++- hello-world/HelloWorld.py | 15 +++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 hello-world/HelloWorld.py diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..2d3276e3 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -11,6 +11,12 @@ About: Computer Science Sophomore
Programming Language: Python, C/C++, Java
Email: vishalpouras@gmail.com
+Name: [Benchea Alexandru](https://github.com/Aquaryus01) +Place: Romania +About: Computer Science student +Programming Language: Python, C++, Angular 6, Typescript, C, PHP +Email: alexbenchea99@yahoo.com + Name: [jluo117](https://github.com/jluo117)
Place: Bay Area
About: Software engineer student!
@@ -959,4 +965,4 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
diff --git a/hello-world/HelloWorld.py b/hello-world/HelloWorld.py new file mode 100644 index 00000000..afbab225 --- /dev/null +++ b/hello-world/HelloWorld.py @@ -0,0 +1,15 @@ +l = [] +l.append("H") +l.append("e") +l.append("l") +l.append("l") +l.append("o") +l.append(" ") +l.append("w") +l.append("o") +l.append("r") +l.append("l") +l.append("d") + +for el in l: + print (el) \ No newline at end of file From 8df33c662a00810af35fcd7b862aeb06a9553459 Mon Sep 17 00:00:00 2001 From: Zack Shorts Date: Thu, 11 Oct 2018 10:44:39 -0600 Subject: [PATCH 29/80] Finished factorial_1.js --- factorial/factorial_1.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 factorial/factorial_1.js diff --git a/factorial/factorial_1.js b/factorial/factorial_1.js new file mode 100644 index 00000000..540d95fd --- /dev/null +++ b/factorial/factorial_1.js @@ -0,0 +1,10 @@ +let factorial = (num) => { + if (num === 0 || num === 1) + return 1; + for (var i = num - 1; i >= 1; i--) { + num *= i; + } + return num; +}; + +console.log(factorial(5)); \ No newline at end of file From 44663cd1852e6703c3b83ae4997030ce0dcf58ff Mon Sep 17 00:00:00 2001 From: Ankit Guleria Date: Thu, 11 Oct 2018 22:24:20 +0530 Subject: [PATCH 30/80] Basic implementation of map in cpp --- map.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 map.cpp diff --git a/map.cpp b/map.cpp new file mode 100644 index 00000000..d263b88f --- /dev/null +++ b/map.cpp @@ -0,0 +1,25 @@ +#include +#include +using namespace std; + + + +int main() +{ + map m; + + //copying an array into a map + int arr[10] = {12,14,15,16,17,17,16,60,12,1}; + map map1; + for(int i=0;i<10;i++) + { + map1[arr[i]]++; + } + cout<::const_iterator it = map1.begin(); it != map1.end(); it++) + { + cout<first<<" "<second; + } +} \ No newline at end of file From 34c8e1c299cd3f17c22e9024efb40d643c5b74cb Mon Sep 17 00:00:00 2001 From: windusasongko Date: Fri, 12 Oct 2018 00:03:54 +0700 Subject: [PATCH 31/80] Greetings from Indonesia! <3 --- hello-world/HelloWorldID.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 hello-world/HelloWorldID.c diff --git a/hello-world/HelloWorldID.c b/hello-world/HelloWorldID.c new file mode 100644 index 00000000..5c26da23 --- /dev/null +++ b/hello-world/HelloWorldID.c @@ -0,0 +1,12 @@ +#include +int main() +{ + char hello[13]="Halo, Dunia!"; + + for (int i = 0; i < 14; ++i) + { + printf("%c", hello[i]); + } + printf("\n"); + return 0; +} From dce6940068ca772afa53c21a8751b65b2788431c Mon Sep 17 00:00:00 2001 From: Karim ElGhazouly Date: Thu, 11 Oct 2018 19:11:04 +0200 Subject: [PATCH 32/80] Added red black trees --- trees/Red Black Trees/Red_Black_Tree.cpp | 366 +++++++++++++++++++++++ trees/Red Black Trees/Red_Black_Tree.h | 36 +++ 2 files changed, 402 insertions(+) create mode 100644 trees/Red Black Trees/Red_Black_Tree.cpp create mode 100644 trees/Red Black Trees/Red_Black_Tree.h diff --git a/trees/Red Black Trees/Red_Black_Tree.cpp b/trees/Red Black Trees/Red_Black_Tree.cpp new file mode 100644 index 00000000..08a4e637 --- /dev/null +++ b/trees/Red Black Trees/Red_Black_Tree.cpp @@ -0,0 +1,366 @@ +#include "Red_Black_Tree.h" +template +node::node() +{ + left = right = parent = 0; + value = 0; + color = "red"; +} +template +node::node(t v) +{ + value = v; + left = right = parent = 0; + color = "red"; +} +template +node::~node() +{ + +} + +template +Red_Black_Tree::Red_Black_Tree() +{ + root = 0; +} + + +template +void Red_Black_Tree::insert(t v) +{ + node* neww = new node(v); + if (root == 0) + { + neww->color = "black"; + root = neww; + } + else + { + node*temp = root; + while(temp!=0) + { + if(v>temp->value) + { + if (temp->right == 0) { neww->parent = temp; temp->right = neww; break; } + else temp = temp->right; + } + else + { + if (temp->left == 0) { neww->parent = temp; temp->left = neww; break; } + else temp = temp->left; + } + } + check(neww); + } +} + +template +void Red_Black_Tree::right_rotation(node*nodee,bool change) +{ + node* p = nodee->parent; + node* grandp = nodee->parent->parent; + node* rightt = nodee->right; + nodee->parent = grandp; + if (grandp != 0) + { + if (grandp->right == p)grandp->right = nodee; + else grandp->left = nodee; + } + else root = nodee; + nodee->right = p; + p->parent = nodee; + p->left = rightt; + if (rightt != 0)rightt->parent = p; + if (change) + { + cout << "Changing color nodee = " << nodee->value << " p = " << p->value << endl; + nodee->color = "black"; + p->color = "red"; + } +} + +template +void Red_Black_Tree::left_rotation(node*nodee,bool change) +{ + node* p = nodee->parent; + node* grandp = nodee->parent->parent; + node* leftt = nodee->left; + nodee->parent = grandp; + if (grandp != 0) + { + if (grandp->right == p)grandp->right = nodee; + else grandp->left = nodee; + } + else root = nodee; + nodee->left = p; + p->parent = nodee; + p->right = leftt; + if (leftt != 0)leftt->parent = p; + if (change) + { + cout << "Changing color nodee = " << nodee->value << " p = " << p->value << endl; + nodee->color = "black"; + p->color = "red"; + } +} + +template +void Red_Black_Tree::solve_double_black(node*nodee,node*p,node*sib) +{ + while (1) + { + if (p==0) + { + cout << " case 1 " << endl; + if (nodee == 0)root = 0; + else nodee->color = "black"; + return; + } + if(p->color=="black"&&sib!=0&&sib->color=="red"&&(sib->left==0||sib->left->color=="black")&&(sib->right==0||sib->right->color=="black")) + { + cout << " case 2 " << endl; + //case 2 + sib->color = "black"; + p->color = "red"; + cout << " old p = " << p->value << " old p left = " << p->left->value << endl; + if (p->right == sib)left_rotation(sib, 0); + else right_rotation(sib, 0); + if (p->left == nodee)sib = p->right; + else sib = p->left; + cout << " p = " << p->value << " p left = " << p->left->value << " sib = "<value<color == "black"&&sib!=0&&sib->color == "black" && (sib->left == 0 || sib->left->color == "black") && (sib->right == 0 || sib->right->color == "black")) + { + cout << " case 3 " << endl; + // case 3 + sib->color = "red"; + nodee = nodee->parent; + p = nodee->parent; + if (p != 0) + { + if (p->right == nodee)sib = p->left; + else sib = p->right; + } + continue; + } + if (p->color == "red"&&sib!=0&&sib->color == "black" && (sib->left == 0 || sib->left->color == "black") && (sib->right == 0 || sib->right->color == "black")) + { + cout << " case 4 " << endl; + //case 4 + sib->color = "red"; + p->color = "black"; + return; + } + if (p->color == "black"&&sib!=0&&sib->color == "black"&&sib->left != 0 && sib->left->color == "red" && (sib->right == 0 || sib->right->color == "black")) + { + cout << " case 5 " << endl; + //case 5 + sib->color = "red"; + sib->left->color = "black"; + if (p->right == sib)right_rotation(sib, 0); + else left_rotation(sib, 0); + sib = sib->parent; + } + if (sib->color=="black"&&sib!=0&&sib->right!=0&&sib->right->color=="red") + { + cout << " case 6" << endl; + //case 6 + sib->color = p->color; + sib->right->color = "black"; + p->color = "black"; + if(p->right==sib)left_rotation(sib, 0); + else right_rotation(sib, 0); + return; + } + + } +} + + +template +node* Red_Black_Tree::findmin(node* nodee) +{ + node* temp = nodee; + while (temp->left != 0) + { + temp = temp->left; + } + return temp; +} + + +template +void Red_Black_Tree::del(t v) +{ + node*nodee = find(v); + if (nodee->left != 0 && nodee->right == 0) + { + cout << "1" << endl; + if (nodee->color == "red") + { + nodee->left->parent = nodee->parent; + if (nodee->value > nodee->parent->value)nodee->parent->right = nodee->left; + else nodee->parent->left = nodee->left; + } + else + { + if (nodee->left->color == "red") + { + nodee->left->color = "black"; + nodee->left->parent = nodee->parent; + if (nodee->value > nodee->parent->value)nodee->parent->right = nodee->left; + else nodee->parent->left = nodee->left; + } + else + { + node*sib; + nodee->left->parent = nodee->parent; + if (nodee->parent != 0) + { + if (nodee->value > nodee->parent->value) + { + nodee->parent->right = nodee->left; + sib = nodee->parent->left; + } + else + { + nodee->parent->left = nodee->left, sib = nodee->parent->right; + } + } + node*leftt = nodee->left; + delete nodee; + solve_double_black(leftt,leftt->parent,sib); + } + } + delete nodee; + } + else if (nodee->left == 0 && nodee->right != 0) + { + cout << "2" << endl; + if (nodee->color == "red") + { + nodee->right->parent = nodee->parent; + if (nodee->value > nodee->parent->value)nodee->parent->right = nodee->right; + else nodee->parent->left = nodee->right; + } + else + { + if (nodee->right->color == "red") + { + nodee->right->color = "black"; + nodee->right->parent = nodee->parent; + if (nodee->value > nodee->parent->value)nodee->parent->right = nodee->right; + else nodee->parent->left = nodee->right; + } + else + { + node* sib; + nodee->right->parent = nodee->parent; + if (nodee->parent != 0) + { + if (nodee->value > nodee->parent->value) + { + nodee->parent->right = nodee->right; + sib = nodee->parent->left; + } + else + { + nodee->parent->left = nodee->right; + sib = nodee->parent->right; + } + } + node*rightt = nodee->right; + delete nodee; + solve_double_black(rightt, rightt->parent,sib); + } + } + delete nodee; + } + else if(nodee->left!=0&&nodee->right!=0) + { + cout << "3" << endl; + node* mn = findmin(nodee->right); + t v = mn->value; + del(mn->value); + nodee->value = v; + } + else + { + cout << "4" << endl; + node*sib; + if (nodee->parent->right == nodee) + { + sib = nodee->parent->left; + nodee->parent->right = 0; + } + else + { + sib = nodee->parent->right; + nodee->parent->left = 0; + } + solve_double_black(nodee->right,nodee->parent,sib); + delete nodee; + } +} + + +template +void Red_Black_Tree::check(node* nodee) +{ + cout << "checking " << nodee->value << endl; + if (nodee->parent!=0&&nodee->parent->color == "black")return; + else + { + node*grandp = nodee->parent->parent; + node* sib; + if (grandp->right == nodee->parent)sib = grandp->left; + else sib = grandp -> right; + if(sib!=0&&sib->color=="red") + { + cout << " no rotation " << endl; + nodee->parent->color = "black"; + sib->color = "black"; + if (grandp == root)return; + grandp->color = "red"; + check(grandp); + } + else + { + if (nodee->parent->left == nodee&&grandp->left == nodee->parent)cout<<"LL"<parent->right == nodee&&grandp->left == nodee->parent) + { + cout << "RL" << endl; + left_rotation(nodee, 0); + right_rotation(nodee, 1); + } + else if (nodee->parent->right == nodee&&grandp->right == nodee->parent)cout<<"RR"< +node* Red_Black_Tree::find(t v) +{ + node*temp = root; + while (temp != 0) + { + cout << " node value = "<value<<" color = "<color << endl; + if (v > temp->value)temp = temp->right; + else if (v < temp->value)temp = temp->left; + else return temp; + } + return 0; +} +template +Red_Black_Tree::~Red_Black_Tree() +{ + +} diff --git a/trees/Red Black Trees/Red_Black_Tree.h b/trees/Red Black Trees/Red_Black_Tree.h new file mode 100644 index 00000000..5e037f50 --- /dev/null +++ b/trees/Red Black Trees/Red_Black_Tree.h @@ -0,0 +1,36 @@ +#pragma once +#include +using namespace std; + +template< class t> +class node +{ + public: + t value; + string color; + node*left; + node*right; + node* parent; + node(); + node(t); + ~node(); +}; + +template +class Red_Black_Tree +{ + node* root; + public: + Red_Black_Tree(); + void check(node*); + void insert(t); + void right_rotation(node*,bool); + void left_rotation (node*,bool); + node* findmin(node*); + void del(t); + void solve_double_black(node*,node*,node*); + node* find(t); + ~Red_Black_Tree(); + +}; + From ef49b6856a2742dd0952b8831a78473099ed4c43 Mon Sep 17 00:00:00 2001 From: sakshi <43309253+sakshipareek@users.noreply.github.com> Date: Thu, 11 Oct 2018 22:57:50 +0530 Subject: [PATCH 33/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..5eaa5a4b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,11 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ + +Name: [sakshi pareek](https://github.com/sakshipareek)
+Place: Rajasthan, India
+About: student
+Programming language: python,java
+Email: sakshi27pareek@gmail.com
From 05871e7df1191b16697916af0e4a740ac5e585ac Mon Sep 17 00:00:00 2001 From: Gargi Rajadhyaksha Date: Thu, 11 Oct 2018 13:54:16 -0400 Subject: [PATCH 34/80] Add stack implementation in go --- CONTRIBUTORS.md | 8 +++++++- stack/stack.go | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 stack/stack.go diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..1a5dc26e 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Gargi](https://github.com/gsrajadh)
+Place: Atlanta, USA
+About: Software Developer
+Programming Language: Go, Python
+Email: gargi.2812@gmail.com
diff --git a/stack/stack.go b/stack/stack.go new file mode 100644 index 00000000..e5dbc303 --- /dev/null +++ b/stack/stack.go @@ -0,0 +1,35 @@ + +package main + +import "fmt" + +type Stack []int + +func main() { + var st Stack + for i := 0; i <= 10; i++ { + st.push(i) + } + fmt.Println(st) + for i := 0; i <= 10; i++ { + st.pop() + } + fmt.Println(st) +} + +func (s *Stack) push(x int) { + *s = append(*s, x) +} + +func (s *Stack) pop() int { + if s.isEmpty() { + return 0 + } + d := (*s)[len(*s)-1] + (*s) = (*s)[:len(*s)-1] + return d +} + +func (s *Stack) isEmpty() bool { + return len(*s) == 0 +} From 610cd76ba55e11390bbd98127e17ccbc1057a6ec Mon Sep 17 00:00:00 2001 From: Joel Turk Date: Thu, 11 Oct 2018 15:06:01 -0400 Subject: [PATCH 35/80] Print 1 to N in Perl --- print1toN/indirect_recursion.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 print1toN/indirect_recursion.pl diff --git a/print1toN/indirect_recursion.pl b/print1toN/indirect_recursion.pl new file mode 100755 index 00000000..e75f8853 --- /dev/null +++ b/print1toN/indirect_recursion.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl +use 5.10.0; +use strict; +use warnings; + +my $n = 20; +sub fun1 { + my $i = 1; + while ($i <= $n) { + say $i; + $i++; + } +} + +fun1(); From afabfb3ba2eef65638023222e5b7d3ee4381f00d Mon Sep 17 00:00:00 2001 From: zonex909 Date: Thu, 11 Oct 2018 12:24:00 -0700 Subject: [PATCH 36/80] Update CONTRIBUTORS.MD --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..17132f77 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Rupna Maitra](https://github.com/zonex909)
+Place: Kolkata , West bengal , india
+About: Retired software developer
+Programming Language: C#, Python , ruby , lisp , cpp
+Email: killerdadu99@gmail.com
From 3ee4939e6b341d1373903863b7dfa5ef533ad647 Mon Sep 17 00:00:00 2001 From: Joel Turk Date: Thu, 11 Oct 2018 15:24:57 -0400 Subject: [PATCH 37/80] Factorial in Perl --- factorial/factorial.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 factorial/factorial.pl diff --git a/factorial/factorial.pl b/factorial/factorial.pl new file mode 100755 index 00000000..40dd6b88 --- /dev/null +++ b/factorial/factorial.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl +use 5.10.0; +use strict; +use warnings; + +sub main { + my $n = 5; + my $fact = 1; + for my $i (1..$n) { + $fact *= $i; + } + say $fact; +} + +main(); From 76c4f89211b91149ad09d5307e3989e0692f9ab7 Mon Sep 17 00:00:00 2001 From: CrackMayo Date: Thu, 11 Oct 2018 18:22:01 -0500 Subject: [PATCH 38/80] HolaMundo.c --- hello-world/HolaMundo.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 hello-world/HolaMundo.c diff --git a/hello-world/HolaMundo.c b/hello-world/HolaMundo.c new file mode 100644 index 00000000..dad33a8e --- /dev/null +++ b/hello-world/HolaMundo.c @@ -0,0 +1,10 @@ +#include + +int main(){ + + + printf("Hola Mundo!"); + + return 0; + +} From fa7b35376d7c7b5b0282471aeb8c8da6dfa9f20d Mon Sep 17 00:00:00 2001 From: CrackMayo Date: Thu, 11 Oct 2018 18:23:12 -0500 Subject: [PATCH 39/80] Update HolaMundo.c --- hello-world/HolaMundo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hello-world/HolaMundo.c b/hello-world/HolaMundo.c index dad33a8e..c4a2f5d8 100644 --- a/hello-world/HolaMundo.c +++ b/hello-world/HolaMundo.c @@ -2,9 +2,6 @@ int main(){ - printf("Hola Mundo!"); - - return 0; - + return 0; } From 622bc948c46731682fbc0f762d392ba883b9dafc Mon Sep 17 00:00:00 2001 From: Rafael Julio Date: Thu, 11 Oct 2018 22:04:09 -0300 Subject: [PATCH 40/80] Add the (in)famous and (im)practical bogosort algorithm This commit adds the bogosort algorithm on an array, it's kinda of a joke (but you can still learn from it!) It's based on Rosetta Code's and Wikipedia's implementation. The changed that have been made by me includes: - Changing important variables to CamelCase (following the WebKit Code Style Guideline), this makes reading and understanding the code a lot easier - Commenting important steps of bogosort - Formatting the code to make it easier to read --- CONTRIBUTORS.md | 8 +++++- bogosort.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 bogosort.c diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..d61f0658 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Rafael Julio](https://github.com/h4ndshake) +Place: São Paulo, Brazil +About: Computer Engineer +Programming Language: C/C++, Arduino, Web, .NET 4.5, Java, others. +Email: rafael_julio@protonmail.com diff --git a/bogosort.c b/bogosort.c new file mode 100644 index 00000000..ecd4e519 --- /dev/null +++ b/bogosort.c @@ -0,0 +1,73 @@ +/* + * Bogosort (or "Estou com Sort (pt-BR)", kinda like "I'm feeling lucky"): Probably the worst sorting + * algorithm out there. + * + * This implementation is based on Rosetta Code's implementation. + * see: https://rosettacode.org/wiki/Sorting_algorithms/Bogosort#C + * + * Additions and changes by Rafael Julio (11/10/2018): + * - Renamed variables and functions. + * - Comments. + */ + +#include +#include +#include + +// Verifies if a given number is already sorted. +bool isSorted(int *array, int number) +{ + while ( --number >= 1 ) { + /* + * While (number -1) is greater than 1, and IF this number is lesser + * than (itself -1), this number isn't sorted. + */ + if (array[number] < array[number-1]) { + return false + } + } + + return true; +} + +void shuffle(int *array, int number) +{ + // Randomly shuffles a number into the array. + int i, t, r; + + for(i = 0; i < number; i++) { + t = a[i]; + r = rand() % number; + a[i] = a[r]; + a[r] = t; + } +} + +void bogosort(int *array, int number) +{ + /* + * If an array of number isn't sorted, shuffles them in hope of sorting + * out everything. + */ + while (!is_sorted(a, number)) { + shuffle(a, number); + } +} + +int main() +{ + int numberArray[] = { 1, 10, 9, 7, 3, 0 }; + + // bogosort(); expects the array and it's size as arguments. + bogosort(numberArray, 6); + + // When (if) everything is sorted, print's out every number in the array. + for (int i = 0; i < 6; i++) { + printf("%d ", numberArray[i]); + } + + // End everything with a beautiful \n character. + printf("\n"); + + return 0; +} \ No newline at end of file From 3a89250acfb105a1d21ab716d80170a17095f1d3 Mon Sep 17 00:00:00 2001 From: Sam <4585872+yrsamrith@users.noreply.github.com> Date: Fri, 12 Oct 2018 10:34:11 +0900 Subject: [PATCH 41/80] Create random_infinite.bf --- random_infinite.bf | 1 + 1 file changed, 1 insertion(+) create mode 100644 random_infinite.bf diff --git a/random_infinite.bf b/random_infinite.bf new file mode 100644 index 00000000..5d220da4 --- /dev/null +++ b/random_infinite.bf @@ -0,0 +1 @@ ++[>?.<] From 57c4e91f6e81c40ea5e694e51a8779191a7bfe9f Mon Sep 17 00:00:00 2001 From: Alvin Date: Fri, 12 Oct 2018 09:19:36 +0700 Subject: [PATCH 42/80] add queue with menu in c++ --- QueueMenu.cpp | 155 ++++++++++++++++++++++++++++++++++++ hello-world/HelloWorld.c | 17 +--- hello-world/helloWorld.html | 21 ++--- 3 files changed, 171 insertions(+), 22 deletions(-) create mode 100644 QueueMenu.cpp diff --git a/QueueMenu.cpp b/QueueMenu.cpp new file mode 100644 index 00000000..c9c98c55 --- /dev/null +++ b/QueueMenu.cpp @@ -0,0 +1,155 @@ +#include +#define max 10 + +using namespace std; + +struct queue +{ + int data[max]; + int head; + int tail; +}; + +queue antrian; + +void create() +{ + antrian.head=antrian.tail=-1; +} + +int isempty() +{ + if(antrian.tail==-1) return 1; + else return 0; +} + +int isfull() +{ + if(antrian.tail==max-1) return 1; + else return 0; +} + +void enqueue(int data) +{ + if(isempty()==1) + { + antrian.head=antrian.tail=0; + antrian.data[antrian.tail]=data; + cout<>opt; + + + switch(opt) + { + + case 1: system("cls"); + { + cout<<"Number : "; + cin>>angka; + enqueue(angka); + break; + } + + case 2: system("cls"); + { + cout< - -void main(){ - printf("Hello World"); // prints Hello World to screen. +int main() +{ + printf("Hello, World!"); + return 0; } - - -// Uncomment lines below to practice printing to screen - -/* -void main() { - printf("This is a test to print to the screen"); - printf('Hello World'); -} -*/ diff --git a/hello-world/helloWorld.html b/hello-world/helloWorld.html index 1416a70f..193d371c 100644 --- a/hello-world/helloWorld.html +++ b/hello-world/helloWorld.html @@ -1,10 +1,13 @@ - - - - Hello World web page - - - -

Hello World!

- + + + + + + + Hello World! + + +

Hello World!

+ This is my first program.
+ From d70e78ca1275d62c4a245c2dd3141dfd1b7b2bb9 Mon Sep 17 00:00:00 2001 From: Laura Date: Thu, 11 Oct 2018 23:30:00 -0400 Subject: [PATCH 43/80] add palindrome php function --- palindrome/palindrome.php | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 palindrome/palindrome.php diff --git a/palindrome/palindrome.php b/palindrome/palindrome.php new file mode 100644 index 00000000..b2c76651 --- /dev/null +++ b/palindrome/palindrome.php @@ -0,0 +1,9 @@ + \ No newline at end of file From 0f4fda2ff405221caa396756f903a9b449f16f15 Mon Sep 17 00:00:00 2001 From: gahan9 Date: Fri, 12 Oct 2018 09:57:45 +0530 Subject: [PATCH 44/80] Implementation of Krushkal's algorithm in C program with disjoint set data structure --- graph/krushkal_disjoint_ds.c | 141 +++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 graph/krushkal_disjoint_ds.c diff --git a/graph/krushkal_disjoint_ds.c b/graph/krushkal_disjoint_ds.c new file mode 100644 index 00000000..42ae43a8 --- /dev/null +++ b/graph/krushkal_disjoint_ds.c @@ -0,0 +1,141 @@ +// Implementing Krushkal's Algorithm for minimum spanning tree with disjoint set data structure + +#include +#include +#include + +#define MAX 10 + +typedef struct Edge { + int node, another_node, weight; +} Edge; + +typedef struct EdgeList { + Edge data[MAX]; + int total_edges; +} EdgeList; + +int Graph[MAX][MAX]; + + +int find(int *array, int node1) { + return *(array + node1); +} + +//change all entries from arr[ A ] to arr[ B ]. +void _union(int array[], int number_of_nodes, int node1, int node2) { + for (int i = 0; i < number_of_nodes; i++) { + if (array[i] == node2) + array[i] = node1; + } +} + +void sort(EdgeList edge_list) { + Edge temp; + for (int i = 1; i < edge_list.total_edges; i++) { + for (int j = 0; j < edge_list.total_edges - 1; j++) + if (edge_list.data[j].weight > edge_list.data[j + 1].weight) { + temp = edge_list.data[j]; + edge_list.data[j] = edge_list.data[j + 1]; + edge_list.data[j + 1] = temp; + } + } +} + +EdgeList Krushkal(int n) { + /* + * n: total number of vertices + * returns edge list of minimum spanning tree + * + * */ + int disjoint_set[MAX], i, j; + EdgeList edge_list; + edge_list.total_edges = 0; + + // store adjacency matrix in to EdgeList structure + for (i = 1; i < n; i++) { + for (j = 0; j < i; j++) { + if (i != j){ // skip self loop (if accidental entry) + if (Graph[i][j] != 0) { // consider 0 weight as same node/vertices + edge_list.data[edge_list.total_edges].node = i; + edge_list.data[edge_list.total_edges].another_node = j; + edge_list.data[edge_list.total_edges].weight = Graph[i][j]; + edge_list.total_edges++; // increase count of total edges + } + } + } + } + + // sort edges by weight to pick minimum edge + sort(edge_list); + + for (i = 0; i < n; i++) + // initialize disjoint set to point at self + disjoint_set[i] = i; + + EdgeList span_list; + register int node1, node2; + span_list.total_edges = 0; + + for (i = 0; i < edge_list.total_edges; i++) { + node1 = find(disjoint_set, edge_list.data[i].node); + node2 = find(disjoint_set, edge_list.data[i].another_node); + if (node1 != node2) { + span_list.data[span_list.total_edges] = edge_list.data[i]; + span_list.total_edges++; + _union(disjoint_set, n, node1, node2); + } + } + return span_list; +} + +void pretty_print(EdgeList span_list) { + int cost = 0; + printf("\nNode\tNode\tWeight"); + for (int i = 0; i < span_list.total_edges; i++) { + printf("\n%d\t %d\t %d", span_list.data[i].node, span_list.data[i].another_node, span_list.data[i].weight); + cost = cost + span_list.data[i].weight; + } + printf("\n\nCost of minimum spanning tree : %d", cost); +} + +int main(int argc, char *argv[]) { + int number_of_vertices = 0; + int auto_mode = atoi(argv[1]); + if (auto_mode) + number_of_vertices = atoi(argv[1]); + int num; + int i, j, total_cost; + printf("\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-" + "\n-*- Krushkal's Algorithm for finding Minimum Spanning Tree.... -*-" + "\n-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-\n"); + printf("\nEnter number of vertices: "); + if (!auto_mode) + scanf("%d", &number_of_vertices); + else + printf("%d", number_of_vertices); + printf("\nEnter the adjacency matrix:\n"); + for (i = 0; i < number_of_vertices; i++) { + for (j = 0; j < number_of_vertices; j++) { + if (!auto_mode) + scanf("%d", &Graph[i][j]); + else { + if (i == j) { + printf("\t0"); + } else { + num = 1 + (rand() % 10); + printf("\t%d", num); + Graph[i][j] = num; + } + } + } + if (auto_mode) + printf("\n"); + } + printf("\n"); + + EdgeList mst_edges; + mst_edges = Krushkal(number_of_vertices); + pretty_print(mst_edges); // print edges picked for MST + return 1; +} From 564f2e1369febbf02e9544f0577f89dd9ab027a5 Mon Sep 17 00:00:00 2001 From: gahan9 Date: Fri, 12 Oct 2018 10:06:49 +0530 Subject: [PATCH 45/80] added name in contributors list --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..0f061806 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Gahan](https://github.com/gahan-nirmauni)
+Place: India
+About: Computer Engineer
+Programming Language: C, Python
+Email: 18mcec10@nirmauni.ac.in
From d40f796640ca87a8b84516dec362070631f99d33 Mon Sep 17 00:00:00 2001 From: Misco Date: Fri, 12 Oct 2018 10:26:05 +0530 Subject: [PATCH 46/80] 'done' --- CONTRIBUTORS.md | 8 +++++++- Fatorial_finding.java | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Fatorial_finding.java diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..f5b15a50 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -21,7 +21,13 @@ Name: [Santino](https://github.com/santinohu)
Place: Netherlands
About: Software engineer student!
Programming Language: Python, PHP, Java, PL/SQL
-Email: santino.b@live.nl
+Email: santino.b@live.nl
+Place: Sri lanka
+About: Software engineer student!
+Programming Language: Java ,React js,C
+Email: kmtsandeepanie@gmail.com
Name: [Rocarft](https://github.com/rocarft)
Place: Georgia
diff --git a/Fatorial_finding.java b/Fatorial_finding.java new file mode 100644 index 00000000..6d193c77 --- /dev/null +++ b/Fatorial_finding.java @@ -0,0 +1,24 @@ +import java.util.Scanner; + +class Factorial_finding +{ + public static void main(String args[]) + { + int n, c, fact = 1; + + System.out.println("Enter an integer to calculate it's factorial"); + Scanner in = new Scanner(System.in); + + n = in.nextInt(); + + if (n < 0) + System.out.println("Number should be non-negative."); + else + { + for (c = 1; c <= n; c++) + fact = fact*c; + + System.out.println("Factorial of "+n+" is = "+fact); + } + } +} \ No newline at end of file From 27e0a5f49e6c3ed7c39f071184fffdd971cbd021 Mon Sep 17 00:00:00 2001 From: Zul-abdin <37822602+Zul-abdin@users.noreply.github.com> Date: Fri, 12 Oct 2018 01:49:51 -0400 Subject: [PATCH 47/80] Created Hello World Written in Java --- hello-world/HelloWorld.java | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 hello-world/HelloWorld.java diff --git a/hello-world/HelloWorld.java b/hello-world/HelloWorld.java new file mode 100644 index 00000000..7013aa02 --- /dev/null +++ b/hello-world/HelloWorld.java @@ -0,0 +1,9 @@ +public class HelloWorld { + + public static void main(String[] args) { + + System.out.println("Hello World!"); + + } + +} From 0cd4ddfad660442c24f8b3df5ca4f9d00c64b46e Mon Sep 17 00:00:00 2001 From: MisterX22 <32390939+MisterX22@users.noreply.github.com> Date: Fri, 12 Oct 2018 09:15:17 +0200 Subject: [PATCH 48/80] Create hello_world.vhdl --- hello-world/hello_world.vhdl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 hello-world/hello_world.vhdl diff --git a/hello-world/hello_world.vhdl b/hello-world/hello_world.vhdl new file mode 100644 index 00000000..1ce99bb2 --- /dev/null +++ b/hello-world/hello_world.vhdl @@ -0,0 +1,12 @@ + entity hello_world is + end; + + architecture hello_world of hello_world is + begin + stimulus : process + begin + assert false report "Hello World By XLR" + severity note; + wait; + end process stimulus; + end hello_world; From 02f500489faf15a9e6c14c3aadb883597ae6082d Mon Sep 17 00:00:00 2001 From: MisterX22 <32390939+MisterX22@users.noreply.github.com> Date: Fri, 12 Oct 2018 09:49:53 +0200 Subject: [PATCH 49/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..327ea97b 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,8 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [MisterX22](https://github.com/MisterX22/) +Place: Lannion, France +About: Still looking what is behind the hill From 6a63e1e850368b7547845fa42de39061f6725364 Mon Sep 17 00:00:00 2001 From: MisterX22 <32390939+MisterX22@users.noreply.github.com> Date: Fri, 12 Oct 2018 09:50:27 +0200 Subject: [PATCH 50/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 327ea97b..f0a2ea01 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -961,6 +961,6 @@ About: Computer Engineer
Programming Language: C#, Python
Email: leeosena21@gmail.com
-Name: [MisterX22](https://github.com/MisterX22/) -Place: Lannion, France -About: Still looking what is behind the hill +Name: [MisterX22](https://github.com/MisterX22/)
+Place: Lannion, France
+About: Still looking what is behind the hill
From 06e1830573a03f7bc1cb2567e8394f4c3e8fcd6d Mon Sep 17 00:00:00 2001 From: Sarsiz Chauhan Date: Fri, 12 Oct 2018 13:43:52 +0530 Subject: [PATCH 51/80] Add Hello World using function in python --- hello-world/hello_world_people.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 hello-world/hello_world_people.py diff --git a/hello-world/hello_world_people.py b/hello-world/hello_world_people.py new file mode 100644 index 00000000..792235fe --- /dev/null +++ b/hello-world/hello_world_people.py @@ -0,0 +1,4 @@ +def Hello_people(str): + print(str) + +Hello_people('Hello World!!!') From 9b9a3ef20c4f43db409064e851c2930eb9eaf5be Mon Sep 17 00:00:00 2001 From: Phantom-Cluster Date: Fri, 12 Oct 2018 14:03:17 +0530 Subject: [PATCH 52/80] Phone Number Validation --- CONTRIBUTORS.md | 8 +++++++- check-number-Valid.py | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 check-number-Valid.py diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..f3a264ed 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Hitanshu Sahu](https://github.com/Phantom-Cluster)
+Place: Kanpur, India
+About: Developer, Designer
+Programming Language: Python, JS
+Email: hitansh.hacker1992@gmail.com
\ No newline at end of file diff --git a/check-number-Valid.py b/check-number-Valid.py new file mode 100644 index 00000000..95c031bd --- /dev/null +++ b/check-number-Valid.py @@ -0,0 +1,19 @@ +# Python3 program to check if +# given mobile number is valid +import re + +def isValid(s): + + # 1) Begins with 0 or 91 + # 2) Then contains 7 or 8 or 9. + # 3) Then contains 9 digits + Pattern = re.compile("(0/91)?[7-9][0-9]{9}") + return Pattern.match(s) + +# Driver Code +s = "347873923408" +if (isValid(s)): + print ("Valid Number") +else : + print ("Invalid Number") + From d66eaac3dfffa7de167cfebc8b61b8c735e15280 Mon Sep 17 00:00:00 2001 From: Phantom-Cluster Date: Fri, 12 Oct 2018 14:04:28 +0530 Subject: [PATCH 53/80] update all check numbr valid and C --- hello-world/helloworld.c | 17 +++++++++++++---- hello-world/helloworld.html | 21 +++++++++------------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/hello-world/helloworld.c b/hello-world/helloworld.c index 3b7617c2..6281daa8 100644 --- a/hello-world/helloworld.c +++ b/hello-world/helloworld.c @@ -1,6 +1,15 @@ #include -int main() -{ - printf("Hello, World!"); - return 0; + +void main(){ + printf("Hello World"); // prints Hello World to screen. } + + +// Uncomment lines below to practice printing to screen + +/* +void main() { + printf("This is a test to print to the screen"); + printf('Hello World'); +} +*/ diff --git a/hello-world/helloworld.html b/hello-world/helloworld.html index 193d371c..1416a70f 100644 --- a/hello-world/helloworld.html +++ b/hello-world/helloworld.html @@ -1,13 +1,10 @@ - - - - - - - Hello World! - - -

Hello World!

- This is my first program.
- + + + + Hello World web page + + + +

Hello World!

+ From ae808905a133820bd199ac10c0bf7af059a43a71 Mon Sep 17 00:00:00 2001 From: Cristi Cismas Date: Fri, 12 Oct 2018 11:53:37 +0300 Subject: [PATCH 54/80] Add comment and remove spacing. --- hello-world/Javascript.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hello-world/Javascript.js b/hello-world/Javascript.js index 3d6a4e73..b42be2be 100644 --- a/hello-world/Javascript.js +++ b/hello-world/Javascript.js @@ -1,2 +1,2 @@ - -console.log(' Hello World '); +// Prints "Hello World!" +console.log('Hello World!'); From 9716421904d90fdc37b9432d0a46d9ca3c2a555a Mon Sep 17 00:00:00 2001 From: Athulya Raj Date: Fri, 12 Oct 2018 14:29:29 +0530 Subject: [PATCH 55/80] Counting sort implementation in java --- sorting/CountingSort.java | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 sorting/CountingSort.java diff --git a/sorting/CountingSort.java b/sorting/CountingSort.java new file mode 100644 index 00000000..211e9fd5 --- /dev/null +++ b/sorting/CountingSort.java @@ -0,0 +1,42 @@ +import java.util.Scanner; +//Counting sort is a sorting technique based on keys between a specific range +public class CountingSort { + + static void countSort(char arr[]) + { + int n = arr.length; + char output[] = new char[n]; + //Creating the count array for each charecters + int count[] = new int[256]; + //initializing count array + for (int i=0; i<256; ++i) + count[i] = 0; + //incrementing the occurences of charecters in the array + for (int i=0; i=0; i--) + { + output[count[arr[i]]-1] = arr[i]; + --count[arr[i]]; + } + + //coping the result to original array + for (int i = 0; i Date: Fri, 12 Oct 2018 12:01:48 +0300 Subject: [PATCH 56/80] Replace "hello" with "Hello World!" --- hello-world/hello.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hello-world/hello.sh b/hello-world/hello.sh index ebfac678..cd162899 100755 --- a/hello-world/hello.sh +++ b/hello-world/hello.sh @@ -1,3 +1,3 @@ #!/bin/bash -echo Hello +echo "Hello World!" From 7b09f16683758626f3c453b398fcd5130944ee76 Mon Sep 17 00:00:00 2001 From: rosy Date: Fri, 12 Oct 2018 11:28:36 +0200 Subject: [PATCH 57/80] javascript one line implementation of checking of a string is a palindrome --- CONTRIBUTORS.md | 7 ++++++- palindrome/isPalindrome.js | 11 +++++++++++ palindrome/isPalindrome_test.js | 23 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 palindrome/isPalindrome.js create mode 100644 palindrome/isPalindrome_test.js diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..8159e584 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,9 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Rosy Sanby](https://github.com/rosy-sanby)
+Place: Cape Town, South Africa
+About: Computer Engineer
+Programming Language: Javascript
\ No newline at end of file diff --git a/palindrome/isPalindrome.js b/palindrome/isPalindrome.js new file mode 100644 index 00000000..4dba5b47 --- /dev/null +++ b/palindrome/isPalindrome.js @@ -0,0 +1,11 @@ +(function(){ +"use strict" + +const isPalindrome = function(word) { + //reverse the word, remove whitespace and check if it equals the original + return (word.split("").reverse().join("").replace(/\s+/g, '') === word.replace(/\s+/g, '')) +} + +module.exports = isPalindrome; + +})(); \ No newline at end of file diff --git a/palindrome/isPalindrome_test.js b/palindrome/isPalindrome_test.js new file mode 100644 index 00000000..dfb1a965 --- /dev/null +++ b/palindrome/isPalindrome_test.js @@ -0,0 +1,23 @@ +// use jasmine to run this file +// https://jasmine.github.io +// +// npm install -g jasmine +// jasmine + +const isPalindrome = require('./isPalindrome'); + +describe("Check if it is a palindrome", () => { + + it('should check recognise the palindrome', () => { + expect(isPalindrome("racecar")).toBe(true); + expect(isPalindrome("0011221100")).toBe(true); + expect(isPalindrome("a nut for a jar of tuna")).toBe(true); + }) + + it('should check recognise that it is not a palindrome', () => { + expect(isPalindrome("Racecar")).toBe(false); + expect(isPalindrome("0011223344")).toBe(false); + expect(isPalindrome("this is not a palindrome")).toBe(false); + }) + +}); \ No newline at end of file From 4da3860c54a426d34f498e9fec8cf5cb80471e24 Mon Sep 17 00:00:00 2001 From: jhartkopf Date: Fri, 12 Oct 2018 11:41:45 +0200 Subject: [PATCH 58/80] add hello world with for loop --- hello-world/helloworldfor.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 hello-world/helloworldfor.sh diff --git a/hello-world/helloworldfor.sh b/hello-world/helloworldfor.sh new file mode 100755 index 00000000..19da49a3 --- /dev/null +++ b/hello-world/helloworldfor.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +for word in Hello World; do + echo $word +done From bb176c88366fe2b91646bc18301457438d0c25d4 Mon Sep 17 00:00:00 2001 From: Paulo Lima Date: Fri, 12 Oct 2018 07:43:39 -0300 Subject: [PATCH 59/80] Add Paulo Bruny to contributors --- CONTRIBUTORS.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..35eb1402 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,11 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ + +Name: [Paulo Bruny](https://github.com/pbruny)
+Place: Petrolina, Brazil
+About: Computer Engineering Student
+Programming Language: C, Javascript, Java
+Email: paulobruny@gmail.com
\ No newline at end of file From b098dc4cbdae327a2e34aff0786902f479226ad7 Mon Sep 17 00:00:00 2001 From: Aye Mya Han Date: Fri, 12 Oct 2018 17:40:30 +0630 Subject: [PATCH 60/80] Add factorial program using functional programming --- factorial/functional_factorial.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 factorial/functional_factorial.js diff --git a/factorial/functional_factorial.js b/factorial/functional_factorial.js new file mode 100644 index 00000000..f058e587 --- /dev/null +++ b/factorial/functional_factorial.js @@ -0,0 +1,5 @@ +function factorial(n){ + if(n<=1) + return 1; + return n*factorial(n-1); +}; \ No newline at end of file From 85e4e8257f429b59f822bee8b0fd254777defa7a Mon Sep 17 00:00:00 2001 From: arthursvpb Date: Fri, 12 Oct 2018 08:17:36 -0300 Subject: [PATCH 61/80] add arthur vasconcellos contributor --- CONTRIBUTORS.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..4ab31d26 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -66,6 +66,11 @@ About: I'm web developer which develop passive-income projects
Programming Language: Php,Javascript
Email: eren.sertkaya.es@gmail.com
+Name: [Arthur Vasconcellos](https://github.com/arthursvpb) +Place: João Pessoa, Brasil +About: Hey! I am a computer science student from Brazil. +Programming Language: C, Python and JavaScript. +Email: contatoarthursilveira@gmail.com Name: [Adit Mehta](https://github.com/aditmehta9)
Place: Rajkot, Gujarat
From 7a773c81e5bf197936e4cb5c15f8d7ca838ad1ac Mon Sep 17 00:00:00 2001 From: Raju Kumar Date: Fri, 12 Oct 2018 17:26:27 +0530 Subject: [PATCH 62/80] Rename file renamed file --- simple interest => SimpleInterest.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename simple interest => SimpleInterest.c (100%) diff --git a/simple interest b/SimpleInterest.c similarity index 100% rename from simple interest rename to SimpleInterest.c From 1d01d71d332902ad30536e580d7010973c447f52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20G=C3=B6ksel?= Date: Fri, 12 Oct 2018 15:07:42 +0300 Subject: [PATCH 63/80] Adding a C program which capitalizes string --- Capitalize | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Capitalize diff --git a/Capitalize b/Capitalize new file mode 100644 index 00000000..aaef3f8d --- /dev/null +++ b/Capitalize @@ -0,0 +1,15 @@ +#include +void capitalize(char *arr) { + int i; + for (i = 0; arr[i] != '\0'; i++) { + if(arr[i]>='a' && arr[i]<='z') + arr[i] -= 32; + } +} +int main () { + char arr[] = "winter is coming"; + printf("%s\n",arr); + capitalize(arr); + printf("%s\n",arr); + return 0; +} From 2c70aa4d0c2d54d7fe4b5927e28e20996907e0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20G=C3=B6ksel?= Date: Fri, 12 Oct 2018 15:09:41 +0300 Subject: [PATCH 64/80] Reverse Alghoritm for c --- reverse/reverseString.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 reverse/reverseString.c diff --git a/reverse/reverseString.c b/reverse/reverseString.c new file mode 100644 index 00000000..21c3f17a --- /dev/null +++ b/reverse/reverseString.c @@ -0,0 +1,28 @@ +#include +#include + +/* Reverses the given string in place */ +void reverse(char str[]) { + int front = 0; + int back = strlen(str) - 1; + + char t; + + while(front < back) { + t = str[front]; + str[front] = str[back]; + str[back] = t; + front++; + back--; + } +} + + +int main() { + char str[] = "Programming is fun!"; + printf("%s\n", str); + reverse(str); + printf("%s\n", str); + + return 0; +} From 4429469a8c676870dfd18b9737f8e7718589dcbf Mon Sep 17 00:00:00 2001 From: Arvind Rachuri Date: Fri, 12 Oct 2018 17:47:24 +0530 Subject: [PATCH 65/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index ad53a3e5..fb7acb80 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -959,4 +959,10 @@ Name: [Leonardo Sena](https://github.com/leosena21)
Place: Salvador, Brazil
About: Computer Engineer
Programming Language: C#, Python
-Email: leeosena21@gmail.com
\ No newline at end of file +Email: leeosena21@gmail.com
+ +Name: [Arvind Rachuri](https://github.com/arealdeadone)
+Place: Gwalior, India
+About: IT student at ABV - Indian Institute of Information Technology and Management, Gwalior
+Programming Languages: C++, C, JAVA, Ruby, Python, JavaScript, Golang
+Email: ari0997@gmail.com
From 2889da13d908a716fd9baadf46161da124be24bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20G=C3=B6ksel?= Date: Fri, 12 Oct 2018 15:21:42 +0300 Subject: [PATCH 66/80] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0128fc6c..cb958a13 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -978,4 +978,10 @@ Name: [Arvind Rachuri](https://github.com/arealdeadone)
Place: Gwalior, India
About: IT student at ABV - Indian Institute of Information Technology and Management, Gwalior
Programming Languages: C++, C, JAVA, Ruby, Python, JavaScript, Golang
-Email: ari0997@gmail.com
\ No newline at end of file +Email: ari0997@gmail.com
+ +Name: [Furkan Göksel](https://github.com/FireHunter27) +Place: Ankara, Turkey +About: Computer Engineering Student +Programming Language: python, java, c, c++ +Email: furkan.goksel27@gmail.com From 9f1d15229620581f476c9edca61d861671e961d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20G=C3=B6ksel?= Date: Fri, 12 Oct 2018 15:23:44 +0300 Subject: [PATCH 67/80] Linked List --- linkedlist operations./Node | 158 ++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 linkedlist operations./Node diff --git a/linkedlist operations./Node b/linkedlist operations./Node new file mode 100644 index 00000000..a8b2e7d6 --- /dev/null +++ b/linkedlist operations./Node @@ -0,0 +1,158 @@ +#include +#include + +struct Node { + int value; + struct Node *next; +}; + +struct Node* createNode( int n){ + struct Node *newNode = malloc(sizeof(struct Node)); + if(newNode) + { + newNode->value = n; + newNode->next = NULL; + } + return newNode; +} + +int sizeofList(struct Node *head) +{ + int count; + struct Node *curr; + if(head==NULL) + return 0; + if(head->next==NULL) + return 1; + + count=1; + curr=head; + while ( (curr = curr->next) != NULL ) + count++; + + return count; +} + + +void addNode(struct Node **head, int val){ + + struct Node *newNode = createNode(val); + struct Node *curr; + + if((*head)==NULL) + { + *head=newNode; + (*head)->next=NULL; + } + + else + { + curr = *head; + while((curr->next)!=NULL) + curr=curr->next; + curr->next=newNode; + } +} + + +void deleteNode(struct Node **head,int index){ + + struct Node *tmp; + struct Node *curr; + int i; + + + if(index>=sizeofList(*head)) + return; + + if(sizeofList(*head)==0) + return; + + else if(sizeofList(*head)==1) + { + free(*head); + *head=NULL; + return; + } + + else + { + if(index==0) + { + curr=(*head)->next; + (*head)->next=NULL; + free(*head); + *head=curr; + } + + else + { + curr=*head; + for(i=0;inext; + + tmp=curr->next; + curr->next=tmp->next; + tmp->next=NULL; + free(tmp); + } + } + + return; +} + +void printList(struct Node *head) +{ + int listSize=sizeofList(head); + + int i; + struct Node *curr; + if(listSize==0) + { + printf("Nothing to print!\n"); + return; + } + + curr=head; + for(i=0;ivalue); + curr=curr->next; + } +} + + +int main(int argc, char* argv[]) +{ + + struct Node *head; + + head=NULL; + printf("Initial list size: %d\n",sizeofList(head)); + printList(head); + printf("\n"); + + addNode(&head,10); + addNode(&head,20); + printf("List size after insertions: %d\n",sizeofList(head)); + printList(head); + printf("\n"); + + deleteNode(&head,0); + printf("List size after deletion: %d\n",sizeofList(head)); + printList(head); + printf("\n"); + + deleteNode(&head,0); + printf("List size after deletion: %d\n",sizeofList(head)); + printList(head); + printf("\n"); + + addNode(&head,30); + printf("List size after insertion: %d\n",sizeofList(head)); + printList(head); + printf("\n"); + + return 0; + +} From 70b0d7ce88ac0dfd6e56b40033d7bf263b74f6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20G=C3=B6ksel?= Date: Fri, 12 Oct 2018 15:24:23 +0300 Subject: [PATCH 68/80] Create Binary Tree --- Tree/Binary Search Tree/Binary Tree | 110 ++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Tree/Binary Search Tree/Binary Tree diff --git a/Tree/Binary Search Tree/Binary Tree b/Tree/Binary Search Tree/Binary Tree new file mode 100644 index 00000000..7b151195 --- /dev/null +++ b/Tree/Binary Search Tree/Binary Tree @@ -0,0 +1,110 @@ +/* Binary Search Tree Example */ + +#include +#include + +struct bin_tree { + int data; + struct bin_tree * right, * left; +}; + +typedef struct bin_tree node; + +void insert(node ** tree, int val) +{ + node *temp = NULL; + + if(*tree==NULL) + { + temp = (node *)malloc(sizeof(node)); + temp->left = temp->right = NULL; + temp->data = val; + *tree = temp; + return; + } + + if(val < (*tree)->data) + { + insert(&(*tree)->left, val); + } + + else if(val > (*tree)->data) + { + insert(&(*tree)->right, val); + } + +} + +void print_preorder(node * tree) +{ + if (tree!=NULL) + { + printf("%d\n",tree->data); + print_preorder(tree->left); + print_preorder(tree->right); + } + +} + +void print_inorder(node * tree) +{ + if (tree!=NULL) + { + print_inorder(tree->left); + printf("%d\n",tree->data); + print_inorder(tree->right); + } +} + +void print_postorder(node * tree) +{ + if (tree!=NULL) + { + print_postorder(tree->left); + print_postorder(tree->right); + printf("%d\n",tree->data); + } +} + +void deltree(node * tree) +{ + if (tree!=NULL) + { + deltree(tree->left); + deltree(tree->right); + free(tree); + } +} + + +int main() +{ + node *root; + + root = NULL; + + /* Inserting nodes into tree */ + insert(&root, 9); + insert(&root, 4); + insert(&root, 15); + insert(&root, 6); + insert(&root, 12); + insert(&root, 17); + insert(&root, 2); + + /* Printing nodes of tree */ + printf("Pre Order Display\n"); + print_preorder(root); + + printf("In Order Display\n"); + print_inorder(root); + + printf("Post Order Display\n"); + print_postorder(root); + + + /* Deleting all nodes of tree */ + deltree(root); + + return 0; +} From 7694e03fa1a6f7c064ce38cb9b801ac061a67896 Mon Sep 17 00:00:00 2001 From: Amitabh Kumar Date: Fri, 12 Oct 2018 18:28:33 +0530 Subject: [PATCH 69/80] code to create table --- html/table.html | 50 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 html/table.html diff --git a/html/table.html b/html/table.html new file mode 100644 index 00000000..3d146140 --- /dev/null +++ b/html/table.html @@ -0,0 +1,50 @@ + + + + + + + +

first edition auctions

+ + + + + + + + + + + + + + + + + + + + + + + + + +
AuthorTitle12241334
sahilabc14441554
utsavbcd16641774
navneetcde12251448
+ + \ No newline at end of file From a2807cb3242297eba68c3ff8c842825770d97bfe Mon Sep 17 00:00:00 2001 From: pnjha Date: Fri, 12 Oct 2018 18:30:32 +0530 Subject: [PATCH 70/80] Added postorder and preorder function --- binary_search_tree.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/binary_search_tree.cpp b/binary_search_tree.cpp index b016e656..9b7d420f 100644 --- a/binary_search_tree.cpp +++ b/binary_search_tree.cpp @@ -50,6 +50,29 @@ class bst inorder(root->r); } } + + void preorder(node*root) + { + if(root!=NULL) + { + t n = root->val; + cout<<"\t"<l); + preorder(root->r); + } + } + + + void postorder(node*root) + { + if(root!=NULL) + { + postorder(root->l); + postorder(root->r); + t n = root->val; + cout<<"\t"< Date: Fri, 12 Oct 2018 18:52:27 +0530 Subject: [PATCH 71/80] Fixed errors and made more readable --- fibonacci/Fib-Iterative.cpp | 38 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/fibonacci/Fib-Iterative.cpp b/fibonacci/Fib-Iterative.cpp index d4dd48a3..b849c468 100644 --- a/fibonacci/Fib-Iterative.cpp +++ b/fibonacci/Fib-Iterative.cpp @@ -3,31 +3,39 @@ using namespace std; -int main() +void fibonacci(int n) { - int f1=1; - int f2=1; - int f3; - int n; - cout<<"Enter the terms upto which the Fibonnaci Series has to be printed\n"; - cin>>n; + + int f1 = 0; + int f2 = 1; + int f3 = 0; + if(n==1) - { cout<>n; + fibonacci(n); + + return 0; } From 9530d78ab7b09d596df78d01b97321992eff1b7d Mon Sep 17 00:00:00 2001 From: pnjha Date: Fri, 12 Oct 2018 18:54:54 +0530 Subject: [PATCH 72/80] Updated code to more readable form --- factorial/Anup_fact.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/factorial/Anup_fact.cpp b/factorial/Anup_fact.cpp index 0615c31c..9eba59fb 100644 --- a/factorial/Anup_fact.cpp +++ b/factorial/Anup_fact.cpp @@ -4,8 +4,10 @@ using namespace std; long int factorial(int n) { - if(n==0) return 1; - else return n*factorial(n-1); + if(n==0) + return 1; + + return n*factorial(n-1); } int main() @@ -15,4 +17,4 @@ int main() cin>>n; cout<<"The factorial of "< Date: Fri, 12 Oct 2018 19:06:18 +0530 Subject: [PATCH 73/80] updated details of https://github.com/pnjha --- CONTRIBUTORS.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0128fc6c..ddbfa0dd 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,3 +1,8 @@ +Name: [pnjha](https://github.com/pnjha)
+Place: India
+About: Computer science student, excited about AI and ML
+Programming Language:C, C++, JAVA, R, Python, JS, HTML, CSS
+Email: prakash.nath@students.iiit.ac.in
Name: [Bardr](https://github.com/Bardr)
Place: Poland
@@ -978,4 +983,4 @@ Name: [Arvind Rachuri](https://github.com/arealdeadone)
Place: Gwalior, India
About: IT student at ABV - Indian Institute of Information Technology and Management, Gwalior
Programming Languages: C++, C, JAVA, Ruby, Python, JavaScript, Golang
-Email: ari0997@gmail.com
\ No newline at end of file +Email: ari0997@gmail.com
From 499142a7668e11e8e3e3cc6254e375bff6b1ac56 Mon Sep 17 00:00:00 2001 From: Deepak Pandey <43467891+zach-assassino@users.noreply.github.com> Date: Fri, 12 Oct 2018 19:08:59 +0530 Subject: [PATCH 74/80] total prime numbers in n --- Prime_No. | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Prime_No. diff --git a/Prime_No. b/Prime_No. new file mode 100644 index 00000000..d5243879 --- /dev/null +++ b/Prime_No. @@ -0,0 +1,17 @@ +l=[1,2] +import time +n=int(input()) +for i in range(3,n): + if i%2==0: + pass + else: + for j in range(3,i+1,2): + if i%j==0 and j!=i: + break + elif j==i: + l.append(j) + #print(j,end=" ") + else: + pass +l.sort(key=int) +print(" ".join(map(str,l))) From 3e0afa48298d5ffcb4591c456a9563b64fcf76f8 Mon Sep 17 00:00:00 2001 From: Deepak Pandey <43467891+zach-assassino@users.noreply.github.com> Date: Fri, 12 Oct 2018 19:16:00 +0530 Subject: [PATCH 75/80] Rename Prime_No. to Prime_No.py Enter any no. and this program bring yo all the prime no found in exclusive range of that no. --- Prime_No. => Prime_No.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Prime_No. => Prime_No.py (100%) diff --git a/Prime_No. b/Prime_No.py similarity index 100% rename from Prime_No. rename to Prime_No.py From 3b18ad2da1f603d7e902dd90d38b8c537d3ee8cb Mon Sep 17 00:00:00 2001 From: Jianhao Tan Date: Fri, 12 Oct 2018 22:13:27 +0800 Subject: [PATCH 76/80] added palindrome --- palindrome.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 palindrome.js diff --git a/palindrome.js b/palindrome.js new file mode 100644 index 00000000..3208fd93 --- /dev/null +++ b/palindrome.js @@ -0,0 +1,10 @@ + +function palindrome(str) { + var re = /[\W_]/g; + var lowRegStr = str.toLowerCase().replace(re, ''); + var reverseStr = lowRegStr.split('').reverse().join(''); + return reverseStr === lowRegStr; +} + +palindrome("Ana voli Milovana"); + From ad8890b959b585b4780633aee3a5ad718eda2560 Mon Sep 17 00:00:00 2001 From: root <350t3r13@gmail.com> Date: Fri, 12 Oct 2018 17:34:13 +0200 Subject: [PATCH 77/80] Add johanvT --- palindrome2.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 palindrome2.py diff --git a/palindrome2.py b/palindrome2.py new file mode 100644 index 00000000..be93f4cf --- /dev/null +++ b/palindrome2.py @@ -0,0 +1,17 @@ +#import reverse_string +def palindrome(string): + num = len(string) - 1 + second_half = '' + mid = len(string) - 1 + while (num > mid/2): + second_half += string[num] + num -=1 + + first_half = string[:len(string)/2] + if first_half == second_half: + return True + else: + return False + +print palindrome("racecar") +print palindrome("poop") From 916f3df3ec2d71240b4ccbdae77cf1cac72ebb22 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Fri, 12 Oct 2018 21:31:36 +0500 Subject: [PATCH 78/80] Binary Search in java --- binary_search/binary_search.java | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 binary_search/binary_search.java diff --git a/binary_search/binary_search.java b/binary_search/binary_search.java new file mode 100644 index 00000000..2ae10d2a --- /dev/null +++ b/binary_search/binary_search.java @@ -0,0 +1,23 @@ +public class binary_search { + public static int binarySearch(int arr[], int val){ + int l = 0, r = arr.length - 1; + while(l <= r){ + int mid = (l + r) >> 1; + if (arr[mid] == val){ + return mid; + } else if(arr[mid] < val){ + l = mid + 1; + }else{ + r = mid - 1; + } + } + return -1; + } + public static void main(String args[]){ + int arr[] = {10,20,30,40,50}; + int val = 30; + int ans = binarySearch(arr,val); + System.out.println((ans == -1) ? "Element not found" : "Element is found at index: " + ans); + } +} + From 0358dae64968969c65bd5e20d48a7c24fa67df82 Mon Sep 17 00:00:00 2001 From: abhishek verma Date: Fri, 12 Oct 2018 22:02:39 +0530 Subject: [PATCH 79/80] Create balanced_string.rb --- balanced_string.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 balanced_string.rb diff --git a/balanced_string.rb b/balanced_string.rb new file mode 100644 index 00000000..c807ccee --- /dev/null +++ b/balanced_string.rb @@ -0,0 +1,17 @@ +def balanced?(string) + return false if string.length.odd? + return false if string =~ /[^\[\]\(\)\{\}]/ + + pairs = { '{' => '}', '[' => ']', '(' => ')' } + + stack = [] + string.chars do |bracket| + if expectation = pairs[bracket] + stack << expectation + else + return false unless stack.pop == bracket + end + end + + stack.empty? +end From fdffaaa21a0a4172a96df629441d00946d5c4f8d Mon Sep 17 00:00:00 2001 From: waahm7 Date: Fri, 12 Oct 2018 21:45:18 +0500 Subject: [PATCH 80/80] Add my named to contributors --- CONTRIBUTORS.md | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index afe9a1bb..6cac5f5f 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -1,3 +1,9 @@ +Name: [Waqar Ahmed](https://github.com/waahm7)
+Place: Pakistan
+About: Computer sceince sutdent, intrested in logical & mathematical concepts.
+Programming Language:C, C++, JAVA, Kotlin, Java
+Email: waahm7@gmail.com
+ Name: [pnjha](https://github.com/pnjha)
Place: India
About: Computer science student, excited about AI and ML
@@ -984,25 +990,6 @@ Programming Language: C#, Python
Email: leeosena21@gmail.com
-Name: [Anadi Kashyap](https://github.com/anadi198)
-Place: Kalyani, India
-About: 2nd year Computer Science student
-Programming Language: C, C++, Python
-Email: anadi.kashyap1598@gmail.com
- -Name: [Jayesh Valbhani](https://github.com/jvalbhani) -Place: Vadodara, India -About: Student, Pursuing MS in Information Technology from DA-IICT. Back-end Develeoper -Programming Language: Java -Email: jayeshvalbhani1711@gmail.com - - -Name: [rame54](https://github.com/rame54) -Place: Milan, Italy -About: It systems and network security student -Programming Language: Assembly, python, c, php - - Name: [LCaleb Conrad](https://github.com/ccconrad)
Place: Ohio, United States. About: Programmer and avid drinker.