├── Profiles ├── akshat.py ├── file.scala ├── subha.py ├── Divanshi.py ├── Isha.js ├── Jitesh.py ├── Nikhil.py ├── RaghavJ.py ├── Shubham.py ├── Urmilla.py ├── Dibyendu.py ├── pavel_slabko.py ├── file.py ├── file.swift ├── sarthak_narang.py ├── gatuam.c ├── gautam.cpp ├── Nikhil.c ├── Nikhil.cpp ├── ashwin.cpp ├── Sudhanshu.cpp ├── sourabh.c ├── yash16.cpp ├── prog.cpp ├── prog2.cpp ├── danny.cpp ├── sourabh.cpp ├── farhan.cpp ├── sourabh.py ├── sarth.cpp ├── parul.js ├── Rishik.py ├── Rishik.cpp ├── Rishik.c ├── mccar085.cpp ├── omang.c ├── fibonacci.js ├── Ackerman.c ├── linked_list.py ├── linked_listagain.py ├── diamond_cpp ├── Gaurav2.c ├── vishesh.c ├── sourabh.java ├── Multiple_left_rotations.js ├── Gaurav3.c ├── Rishik.scala ├── Print1toN ├── Gaurav.c ├── factorial of a number ├── Linear Search.C ├── ArrayDemo.java ├── Cyclic_rotation.java ├── Binary Search.C ├── longestPalin.cpp ├── atul.c ├── README.md ├── string is a Palindro ├── string is a Palindrome ├── string is a Palindrome in a function.java ├── bubble_sort.cpp ├── farha.java ├── Anagrams.java ├── convert an Array to String ├── akshay.cpp ├── CoinExchange.scala ├── Rotation_by_juggling.scala ├── Count_rotation.java ├── BinaryIndexedTree.cxx ├── Nikhil.css ├── QueueArray.cxx ├── QueueLinkedList.cxx ├── StackusingLinkedLists.cpp ├── shubham.html ├── PostfixEvaluation.cxx ├── Dynamic Input linkedList.scala ├── BITApplication.c ├── counting_sort.cpp ├── Nikhil.html ├── Queue.cxx ├── Stack Implementation.c ├── double_linked_list.cpp ├── HeapSort.cs ├── InfixToPostfix.cxx ├── add_delete_median.cpp ├── Linked-list_sandy.c ├── stack_using_dll.py ├── timsort.py ├── Doubly_linked_list.py ├── Doubly_linkedlist.py ├── binary_search_tree.py ├── LinkedList.cxx └── DoublyLinkedList.java ├── video.png ├── LICENSE ├── README.md ├── contributors.md ├── Mansi └── CODE_OF_CONDUCT.md /Profiles/akshat.py: -------------------------------------------------------------------------------- 1 | print "Hey!" 2 | -------------------------------------------------------------------------------- /Profiles/file.scala: -------------------------------------------------------------------------------- 1 | print("Hello") 2 | -------------------------------------------------------------------------------- /Profiles/subha.py: -------------------------------------------------------------------------------- 1 | print("Hello World!") 2 | -------------------------------------------------------------------------------- /Profiles/Divanshi.py: -------------------------------------------------------------------------------- 1 | printf("Hello WOrld") 2 | -------------------------------------------------------------------------------- /Profiles/Isha.js: -------------------------------------------------------------------------------- 1 | Console.log("hello world") 2 | -------------------------------------------------------------------------------- /Profiles/Jitesh.py: -------------------------------------------------------------------------------- 1 | print("Hello World!!") 2 | -------------------------------------------------------------------------------- /Profiles/Nikhil.py: -------------------------------------------------------------------------------- 1 | print("Hi I am Nikhil") 2 | -------------------------------------------------------------------------------- /Profiles/RaghavJ.py: -------------------------------------------------------------------------------- 1 | print("Hello World ") 2 | -------------------------------------------------------------------------------- /Profiles/Shubham.py: -------------------------------------------------------------------------------- 1 | print("Hello World!!") 2 | -------------------------------------------------------------------------------- /Profiles/Urmilla.py: -------------------------------------------------------------------------------- 1 | print("Hello World!!!") 2 | -------------------------------------------------------------------------------- /Profiles/Dibyendu.py: -------------------------------------------------------------------------------- 1 | print("Hi I am Dibyendu") 2 | -------------------------------------------------------------------------------- /Profiles/pavel_slabko.py: -------------------------------------------------------------------------------- 1 | print("Hi! I'm Pavel.") 2 | -------------------------------------------------------------------------------- /Profiles/file.py: -------------------------------------------------------------------------------- 1 | import flask; 2 | print("Hello World") 3 | -------------------------------------------------------------------------------- /Profiles/file.swift: -------------------------------------------------------------------------------- 1 | import swift; 2 | console.log("Hello World"); 3 | -------------------------------------------------------------------------------- /Profiles/sarthak_narang.py: -------------------------------------------------------------------------------- 1 | print("Hello World I am Sarthak Narang") 2 | -------------------------------------------------------------------------------- /Profiles/gatuam.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { printf("Hello World"); } 3 | -------------------------------------------------------------------------------- /Profiles/gautam.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { cout << "Hello World"; } 3 | -------------------------------------------------------------------------------- /video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HrithikMittal/Hacktoberfest2k19/HEAD/video.png -------------------------------------------------------------------------------- /Profiles/Nikhil.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | printf('Hello World'); 5 | } 6 | -------------------------------------------------------------------------------- /Profiles/Nikhil.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | cout<<"Hello World"; 5 | } 6 | -------------------------------------------------------------------------------- /Profiles/ashwin.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | cout<<"Hello World"; 5 | } 6 | -------------------------------------------------------------------------------- /Profiles/Sudhanshu.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | printf("Hello World"); 5 | } 6 | -------------------------------------------------------------------------------- /Profiles/sourabh.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | printf("Hello Universe! \n"); 5 | } 6 | -------------------------------------------------------------------------------- /Profiles/yash16.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | cout<<"Hello World"; 5 | } 6 | -------------------------------------------------------------------------------- /Profiles/prog.cpp: -------------------------------------------------------------------------------- 1 | include 2 | int main() 3 | { 4 | cout<<"1"; 5 | cout<<"Hello"; 6 | } 7 | -------------------------------------------------------------------------------- /Profiles/prog2.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | cout<<"HEllo"; 5 | cout<<"2"; 6 | } 7 | -------------------------------------------------------------------------------- /Profiles/danny.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | cout<<"El Camino"; 5 | 6 | return 0; 7 | } -------------------------------------------------------------------------------- /Profiles/sourabh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main(void) 4 | { 5 | cout << "Hello World"; 6 | } 7 | -------------------------------------------------------------------------------- /Profiles/farhan.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | cout << "Hello, World!"; 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /Profiles/sourabh.py: -------------------------------------------------------------------------------- 1 | arr = map(int, input().split()) 2 | arr = list(arr) 3 | arr = list(dict.fromkeys(arr)) 4 | arr.sort() 5 | print(arr[-2]) 6 | -------------------------------------------------------------------------------- /Profiles/sarth.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int i,n=5; 5 | for(i=0;i 2 | 3 | using namespace std; 4 | 5 | int main() 6 | { 7 | int a,b,c; 8 | cout<<"enter the numbers to add"; 9 | cin>>a>>b; 10 | c=a+b; 11 | cout<<"The sum is "< 2 | 3 | int main() 4 | { 5 | int a, b, c; 6 | 7 | printf("Enter two numbers to add\n"); 8 | scanf("%d%d", &a, &b); 9 | 10 | c = a + b; 11 | 12 | printf("Sum of the numbers = %d\n", c); 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /Profiles/mccar085.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | int main() 4 | { 5 | int n; 6 | cout << "Enter an integer: "; 7 | cin >> n; 8 | if ( n % 2 == 0) 9 | cout << n << " is even."; 10 | else 11 | cout << n << " is odd."; 12 | return 0; 13 | } -------------------------------------------------------------------------------- /Profiles/omang.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | char ch; 5 | printf("enter a character"); 6 | scanf("%s",&ch); 7 | if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u') 8 | printf("character entered is a vowel"); 9 | else 10 | printf("character entered is consonant"); 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /Profiles/fibonacci.js: -------------------------------------------------------------------------------- 1 | function fibonacci (number) { 2 | var varFibonacci = [0, 1]; 3 | 4 | if (number <= 2) return 1; 5 | 6 | for (var i = 2; i <= number; i++) { 7 | varFibonacci[i] = varFibonacci[i-1] + varFibonacci[i-2]; 8 | } 9 | 10 | return varFibonacci[number]; 11 | } -------------------------------------------------------------------------------- /Profiles/Ackerman.c: -------------------------------------------------------------------------------- 1 | #include 2 | unsigned long ack(unsigned long m, unsigned long n){ 3 | unsigned long ans; 4 | if(m==0) 5 | ans = n + 1; 6 | else if (n==0) 7 | ans = ack(m -1 , 1); 8 | else ans = ack(m-1, ack(m , n -1)); 9 | return ans; 10 | } 11 | 12 | int main(){ 13 | int i,j; 14 | for (i=0;i<6;i++) 15 | for (j=0;j<6;j++) 16 | printf ("Ackerman of (%d, %d) is %d\n", i, j, ack(i, j)); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /Profiles/linked_list.py: -------------------------------------------------------------------------------- 1 | 2 | # Node class 3 | class Node: 4 | 5 | # Function to initialize the node object 6 | def __init__(self, data): 7 | self.data = data 8 | self.next = None 9 | 10 | 11 | # Linked List class 12 | class LinkedList: 13 | 14 | # Function to initialize the Linked 15 | # List object 16 | def __init__(self): 17 | self.head = None -------------------------------------------------------------------------------- /Profiles/linked_listagain.py: -------------------------------------------------------------------------------- 1 | 2 | # Node class 3 | class Node: 4 | 5 | # Function to initialize the node object 6 | def __init__(self, data): 7 | self.data = data 8 | self.next = None 9 | 10 | 11 | # Linked List class 12 | class LinkedList: 13 | 14 | # Function to initialize the Linked 15 | # List object 16 | def __init__(self): 17 | self.head = None 18 | -------------------------------------------------------------------------------- /Profiles/diamond_cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | int main(int arr, char** ch){ 5 | int n; 6 | cin>>n; 7 | vectorarr(n ,0); 8 | for (int i=0; i>arr[i]; 10 | 11 | } 12 | for(int i=0;iarr[j]){ 15 | swap(arr[i],arr[j]); 16 | int bound=0; 17 | bound++; 18 | } 19 | } 20 | } 21 | for(int p=0; p 2 | int main() 3 | { 4 | char ch; 5 | bool isVowel = false; 6 | 7 | printf("Enter an alphabet: "); 8 | scanf("%c",&ch); 9 | 10 | if(ch=='a'||ch=='A'||ch=='e'||ch=='E'||ch=='i'||ch=='I' 11 | ||ch=='o'||ch=='O'||ch=='u'||ch=='U') 12 | { 13 | isVowel = true; 14 | 15 | } 16 | if (isVowel == true) 17 | printf("%c is a Vowel", ch); 18 | else 19 | printf("%c is a Consonant", ch); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Profiles/vishesh.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | int main(){int a,b,t,c,n; 4 | scanf("%d",&n);t=1;b=0; 5 | for(int i=1;i<=((2*n)+1);i++) 6 | {for(c=n-t+1;c>=1;c--) 7 | printf(" "); 8 | for(a=1;a<=(2*t)-1;a++) 9 | {if((a==1)||(a==((2*t)-1))) 10 | printf("*"); 11 | else 12 | printf("o"); 13 | 14 | } 15 | printf("\n"); 16 | if(t==(n+1)) 17 | b++; 18 | if(b==0) 19 | t++; 20 | else 21 | t--; 22 | 23 | 24 | } 25 | return 0;} 26 | -------------------------------------------------------------------------------- /Profiles/sourabh.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | class main 4 | { 5 | 6 | public static int gcd(int m, int n) 7 | { 8 | if (m > n) return gcd(n,m); 9 | if (m == n) return m; 10 | if (m == 0) return n; 11 | if (m == 1) return 1; 12 | 13 | return gcd(m, n%m); 14 | } 15 | 16 | 17 | public static void main(String[] args) 18 | { 19 | 20 | Scanner sc = new Scanner(System.in); 21 | 22 | int m = sc.nextInt(); 23 | int n = sc.nextInt(); 24 | 25 | System.out.println(gcd(m,n)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Profiles/Multiple_left_rotations.js: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Multiple_left_rotations { 4 | void leftRotate(int arr[],int n, int k) 5 | { 6 | for (int i = k; i < k + n; i++) 7 | System.out.print(arr[i % n] + " "); 8 | } 9 | 10 | public static void main (String[] args) 11 | { Multiple_left_rotations multiple = new Multiple_left_rotations(); 12 | int arr[] = {1, 3, 5, 7, 9}; 13 | int n = arr.length; 14 | int k = 2; 15 | multiple.leftRotate(arr, n, k); 16 | System.out.println(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Profiles/Gaurav3.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | char ch; 5 | printf("Enter any character:"); 6 | 7 | /* Reads the entered character and stores it 8 | * into the char variable ch 9 | */ 10 | scanf("%c", &ch); 11 | 12 | /* Using the format specifiers we can get the ASCII code 13 | * of a character. When we use %d format specifier for a 14 | * char variable then it displays the ASCII value of a char 15 | */ 16 | printf("ASCII value of character %c is: %d", ch, ch); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Profiles/Rishik.scala: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class AddTwoNumbers2 { 3 | 4 | public static void main(String[] args) { 5 | 6 | int num1, num2, sum; 7 | Scanner sc = new Scanner(System.in); 8 | System.out.println("Enter First Number: "); 9 | num1 = sc.nextInt(); 10 | 11 | System.out.println("Enter Second Number: "); 12 | num2 = sc.nextInt(); 13 | 14 | sc.close(); 15 | sum = num1 + num2; 16 | System.out.println("Sum of these numbers: "+sum); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Profiles/Print1toN: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | template 5 | class PrintOneToN 6 | { 7 | public: 8 | static void print() 9 | { 10 | PrintOneToN::print(); // Note that this is not recursion 11 | cout << N << endl; 12 | } 13 | }; 14 | 15 | template<> 16 | class PrintOneToN<1> 17 | { 18 | public: 19 | static void print() 20 | { 21 | cout << 1 << endl; 22 | } 23 | }; 24 | int main() 25 | { 26 | const int N = 100; 27 | PrintOneToN::print(); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Profiles/Gaurav.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int y; 5 | 6 | printf("Enter year: "); 7 | scanf("%d",&y); 8 | 9 | if(y % 4 == 0) 10 | { 11 | //Nested if else 12 | if( y % 100 == 0) 13 | { 14 | if ( y % 400 == 0) 15 | printf("%d is a Leap Year", y); 16 | else 17 | printf("%d is not a Leap Year", y); 18 | } 19 | else 20 | printf("%d is a Leap Year", y ); 21 | } 22 | else 23 | printf("%d is not a Leap Year", y); 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Profiles/factorial of a number: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int n, i; 5 | unsigned long long factorial = 1; 6 | printf("Enter an integer: "); 7 | scanf("%d",&n); 8 | // show error if the user enters a negative integer 9 | if (n < 0) 10 | printf("Error! Factorial of a negative number doesn't exist."); 11 | else 12 | { 13 | for(i=1; i<=n; ++i) 14 | { 15 | factorial *= i; // factorial = factorial*i; 16 | } 17 | printf("Factorial of %d = %llu", n, factorial); 18 | } 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Profiles/Linear Search.C: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | int a[100],element,i,n; 4 | printf("Enter The No Of Elements You Want To Enter: "); 5 | scanf("%d",&n); 6 | printf("Enter The Elements: "); 7 | for(i=0;i0;i--){ 7 | arr[i]=arr[i-1]; 8 | } 9 | arr[0]=temp; 10 | } 11 | void display(int arr[],int n){ 12 | for(int i=0;i0;i--){ 7 | arr[i]=arr[i-1]; 8 | } 9 | arr[0]=temp; 10 | } 11 | void print(int arr[],int n){ 12 | for(int i=0;i 3 | int main(){ 4 | int a[100],c=0,mid,element,i,n,top,bottom; 5 | printf("Enter The No Of Elements You Want To Enter: "); 6 | scanf("%d",&n); 7 | printf("Enter The Elements: "); 8 | for(i=0;itop){ 17 | if(a[mid]==element){ 18 | printf("Element Is Found"); 19 | c++; 20 | break; 21 | } 22 | else if(a[mid]= 0 && right < n && s[left] == s[right]) left--, right++; 6 | return s.substr(left + 1, right - left - 1); 7 | } 8 | string longestPalindrome(string s) { 9 | const size_t n = s.length(); 10 | if(n == 0) return ""; 11 | string res = s.substr(0, 1), temp; 12 | for(int i = 0; i < n - 1; ++i){ 13 | temp = expand(s, i, i); 14 | if(temp.length() > res.length()) res = temp; 15 | temp = expand(s, i, i + 1); 16 | if(temp.length() > res.length()) res = temp; 17 | } 18 | return res; 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /Profiles/atul.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | int main() 4 | { 5 | int a,b,c; 6 | 7 | printf("enter 1at num"); 8 | scanf("%d",&a); 9 | printf("enter 2nd num"); 10 | scanf("%d",&b); 11 | c=a+b; 12 | printf("sum is %d",c); 13 | 14 | //flip 2 degit number 15 | #include 16 | int main() 17 | { 18 | int a,b,c,d; 19 | printf("enter 2 degit number"); 20 | scanf("%d",&a); 21 | b=a%10; 22 | c=a/10; 23 | 24 | if ((b+c)>10) 25 | { 26 | printf("success"); 27 | } 28 | else 29 | { 30 | printf("not success"); 31 | } 32 | d=10*b+c; 33 | printf("%d",d); 34 | 35 | #include 36 | int main() 37 | { 38 | int a; 39 | printf("enter a number"); 40 | scanf("%d",a); 41 | if(a%2==0) 42 | printf("%d is even",a); 43 | else 44 | printf("%d is odd",a); 45 | 46 | return 0; 47 | } 48 | -------------------------------------------------------------------------------- /Profiles/README.md: -------------------------------------------------------------------------------- 1 | # How to do? 2 | ### Example for files are given below 3 | 4 | #### C 5 | ``` 6 | #include 7 | #include 8 | void main(){ 9 | printf("Hello World"); 10 | } 11 | ``` 12 | 13 | #### C++ 14 | ``` 15 | #include 16 | using namespace std; 17 | int main(){ 18 | cout<<"Hello World"; 19 | } 20 | ``` 21 | 22 | #### Java 23 | ``` 24 | import java.util.*; 25 | class Example{ 26 | public static void main(String args[]) 27 | { 28 | System.out.println("Hello World); 29 | } 30 | } 31 | ``` 32 | 33 | #### Scala 34 | ``` 35 | object Example 36 | { 37 | def main(args: Array[String]) 38 | { 39 | println("Hello World!") 40 | } 41 | } 42 | ``` 43 | 44 | #### Swift 45 | ``` 46 | import Swift 47 | print("Hello, World!") 48 | ``` 49 | 50 | #### Python 51 | ``` 52 | print('hello world') 53 | ``` 54 | 55 | #### JavaScript 56 | ``` 57 | console.log('Hello World'); 58 | ``` 59 | -------------------------------------------------------------------------------- /Profiles/string is a Palindro: -------------------------------------------------------------------------------- 1 | // Java implementation of the approach 2 | public class GFG { 3 | 4 | // Function that returns true if 5 | // str is a palindrome 6 | static boolean isPalindrome(String str) 7 | { 8 | 9 | // Pointers pointing to the beginning 10 | // and the end of the string 11 | int i = 0, j = str.length() - 1; 12 | 13 | // While there are characters toc compare 14 | while (i < j) { 15 | 16 | // If there is a mismatch 17 | if (str.charAt(i) != str.charAt(j)) 18 | return false; 19 | 20 | // Increment first pointer and 21 | // decrement the other 22 | i++; 23 | j--; 24 | } 25 | 26 | // Given string is a palindrome 27 | return true; 28 | } 29 | 30 | // Driver code 31 | public static void main(String[] args) 32 | { 33 | String str = "geeks"; 34 | 35 | if (isPalindrome(str)) 36 | System.out.print("Yes"); 37 | else 38 | System.out.print("No"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Profiles/string is a Palindrome: -------------------------------------------------------------------------------- 1 | // Java implementation of the approach 2 | public class GFG { 3 | 4 | // Function that returns true if 5 | // str is a palindrome 6 | static boolean isPalindrome(String str) 7 | { 8 | 9 | // Pointers pointing to the beginning 10 | // and the end of the string 11 | int i = 0, j = str.length() - 1; 12 | 13 | // While there are characters toc compare 14 | while (i < j) { 15 | 16 | // If there is a mismatch 17 | if (str.charAt(i) != str.charAt(j)) 18 | return false; 19 | 20 | // Increment first pointer and 21 | // decrement the other 22 | i++; 23 | j--; 24 | } 25 | 26 | // Given string is a palindrome 27 | return true; 28 | } 29 | 30 | // Driver code 31 | public static void main(String[] args) 32 | { 33 | String str = "geeks"; 34 | 35 | if (isPalindrome(str)) 36 | System.out.print("Yes"); 37 | else 38 | System.out.print("No"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Profiles/string is a Palindrome in a function.java: -------------------------------------------------------------------------------- 1 | // Java implementation of the approach 2 | public class GFG { 3 | 4 | // Function that returns true if 5 | // str is a palindrome 6 | static boolean isPalindrome(String str) 7 | { 8 | 9 | // Pointers pointing to the beginning 10 | // and the end of the string 11 | int i = 0, j = str.length() - 1; 12 | 13 | // While there are characters toc compare 14 | while (i < j) { 15 | 16 | // If there is a mismatch 17 | if (str.charAt(i) != str.charAt(j)) 18 | return false; 19 | 20 | // Increment first pointer and 21 | // decrement the other 22 | i++; 23 | j--; 24 | } 25 | 26 | // Given string is a palindrome 27 | return true; 28 | } 29 | 30 | // Driver code 31 | public static void main(String[] args) 32 | { 33 | String str = "geeks"; 34 | 35 | if (isPalindrome(str)) 36 | System.out.print("Yes"); 37 | else 38 | System.out.print("No"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Profiles/bubble_sort.cpp: -------------------------------------------------------------------------------- 1 | // C++ program for implementation of Bubble sort 2 | #include 3 | using namespace std; 4 | 5 | void swap(int *xp, int *yp) 6 | { 7 | int temp = *xp; 8 | *xp = *yp; 9 | *yp = temp; 10 | } 11 | 12 | // A function to implement bubble sort 13 | void bubbleSort(int arr[], int n) 14 | { 15 | int i, j; 16 | for (i = 0; i < n-1; i++) 17 | 18 | // Last i elements are already in place 19 | for (j = 0; j < n-i-1; j++) 20 | if (arr[j] > arr[j+1]) 21 | swap(&arr[j], &arr[j+1]); 22 | } 23 | 24 | /* Function to print an array */ 25 | void printArray(int arr[], int size) 26 | { 27 | int i; 28 | for (i = 0; i < size; i++) 29 | cout << arr[i] << " "; 30 | cout << endl; 31 | } 32 | 33 | // Driver code 34 | int main() 35 | { 36 | int arr[] = {64, 34, 25, 12, 22, 11, 90}; 37 | int n = sizeof(arr)/sizeof(arr[0]); 38 | bubbleSort(arr, n); 39 | cout<<"Sorted array: \n"; 40 | printArray(arr, n); 41 | return 0; 42 | } 43 | 44 | // This code is contributed by rathbhupendra 45 | 46 | -------------------------------------------------------------------------------- /Profiles/farha.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Anagrams { 4 | static final int MAX = 256; 5 | static boolean compare(char arr1[], char arr2[]) { 6 | for (int i = 0; i < MAX; i++) 7 | if (arr1[i] != arr2[i]) 8 | return false; 9 | return true; 10 | } 11 | 12 | static void search(String pat, String txt) { 13 | int M = pat.length(); 14 | int N = txt.length(); 15 | 16 | char[] countP = new char[MAX]; 17 | char[] countTW = new char[MAX]; 18 | for (int i = 0; i < M; i++) { 19 | (countP[pat.charAt(i)])++; 20 | (countTW[txt.charAt(i)])++; 21 | } 22 | 23 | for (int i = M; i < N; i++) { 24 | 25 | if (compare(countP, countTW)) 26 | System.out.println("Found at Index " + (i - M)); 27 | 28 | (countTW[txt.charAt(i)])++; 29 | 30 | countTW[txt.charAt(i - M)]--; 31 | } 32 | 33 | if (compare(countP, countTW)) 34 | System.out.println("Found at Index " + (N - M)); 35 | } 36 | public static void main(String args[]) { 37 | String txt = "BACDGABCDA"; 38 | String pat = "ABCD"; 39 | search(pat, txt); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Profiles/Anagrams.java: -------------------------------------------------------------------------------- 1 | package Array; 2 | 3 | public class Anagrams { 4 | static final int MAX = 256; 5 | static boolean compare(char arr1[], char arr2[]) { 6 | for (int i = 0; i < MAX; i++) 7 | if (arr1[i] != arr2[i]) 8 | return false; 9 | return true; 10 | } 11 | 12 | static void search(String pat, String txt) { 13 | int M = pat.length(); 14 | int N = txt.length(); 15 | 16 | char[] countP = new char[MAX]; 17 | char[] countTW = new char[MAX]; 18 | for (int i = 0; i < M; i++) { 19 | (countP[pat.charAt(i)])++; 20 | (countTW[txt.charAt(i)])++; 21 | } 22 | 23 | for (int i = M; i < N; i++) { 24 | 25 | if (compare(countP, countTW)) 26 | System.out.println("Found at Index " + (i - M)); 27 | 28 | (countTW[txt.charAt(i)])++; 29 | 30 | countTW[txt.charAt(i - M)]--; 31 | } 32 | 33 | if (compare(countP, countTW)) 34 | System.out.println("Found at Index " + (N - M)); 35 | } 36 | public static void main(String args[]) { 37 | String txt = "BACDGABCDA"; 38 | String pat = "ABCD"; 39 | search(pat, txt); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Profiles/convert an Array to String: -------------------------------------------------------------------------------- 1 | // Java program to demonstrate 2 | // working of Arrays.toString() 3 | 4 | import java.io.*; 5 | import java.util.*; 6 | 7 | class GFG { 8 | public static void main(String[] args) 9 | { 10 | 11 | // Let us create different types of arrays and 12 | // print their contents using Arrays.toString() 13 | boolean[] boolArr 14 | = new boolean[] { true, true, false, true }; 15 | char[] charArr 16 | = new char[] { 'g', 'e', 'e', 'k', 's' }; 17 | double[] dblArr 18 | = new double[] { 1, 2, 3, 4 }; 19 | int[] intArr 20 | = new int[] { 1, 2, 3, 4 }; 21 | Object[] objArr 22 | = new Object[] { 1, 2, 3, 4 }; 23 | 24 | System.out.println( 25 | "Boolean Array: " 26 | + Arrays.toString(boolArr)); 27 | System.out.println( 28 | "Character Array: " 29 | + Arrays.toString(charArr)); 30 | System.out.println( 31 | "Double Array: " 32 | + Arrays.toString(dblArr)); 33 | System.out.println( 34 | "Integer Array: " 35 | + Arrays.toString(intArr)); 36 | System.out.println( 37 | "Object Array: " 38 | + Arrays.toString(objArr)); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Adhikansh Mittal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Profiles/akshay.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int bubble_sort_swap(int array[],int size){ 5 | 6 | int swap =0; 7 | for(int i = size-2;i>=0;i--){ 8 | for(int j=0;j<=i;j++){ 9 | 10 | if(array[j] >array[j+1]){ 11 | 12 | swap++; 13 | // cout<<"Swap:"<=n) 17 | k=k-n; 18 | if(k==i) 19 | break; 20 | arr[j]=arr[k]; 21 | j=k; 22 | } 23 | arr[j]=temp; 24 | } 25 | } 26 | public void print(int arr[],int n){ 27 | for(int i=0;i arr[i]) { 9 | min = arr[i]; 10 | min_index = i; 11 | } 12 | } 13 | return min_index; 14 | } 15 | // Time Complexity : O(n) 16 | // Binary search 17 | // int countRotations(int arr[],int low, int high) { 18 | // if(high low && arr[mid] < arr[mid - 1]) 26 | // return mid; 27 | // if (arr[high] > arr[mid]) 28 | // return countRotations(arr, low, mid-1); 29 | // return countRotations(arr, mid+1, high); 30 | // 31 | // } 32 | 33 | public static void main(String[] args) { 34 | Count_rotation count = new Count_rotation(); 35 | int arr[] = {2, 3, 6, 12}; 36 | int n = arr.length; 37 | System.out.println(count.countRotations(arr, n)); 38 | // System.out.println(count.countRotations(arr, 0 , n-1)); 39 | } 40 | } 41 | // Time Complexity : O(log n) -------------------------------------------------------------------------------- /Profiles/BinaryIndexedTree.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | // Binary Indexed Tree / Fenwick Tree 5 | // 1-indexed BIT and input array 6 | 7 | int MAXN = 100000; 8 | int BIT[100005], arr[100005]; 9 | 10 | inline void update (int x, int val) 11 | { 12 | for (;x<=MAXN;x+=(x&(-x))) 13 | BIT[x]+=val; 14 | } 15 | 16 | 17 | inline int query(int x) 18 | { 19 | int sum=0; 20 | for (;x>0;x-=(x&(-x))) 21 | sum+=BIT[x]; 22 | return sum; 23 | } 24 | 25 | int main() { 26 | 27 | int a, b, n, val, ans; 28 | memset(BIT, 0, sizeof(BIT)); 29 | // Take Input 30 | 31 | cin >> n; 32 | for (int i = 1; i <= n; i++) 33 | { 34 | cin >> arr[i]; 35 | update(i, arr[i]); 36 | } 37 | 38 | // Point Update, Point Query 39 | // Add val to element at index a 40 | cin >> val >> a; 41 | update(a, val); 42 | // Query element at index a 43 | cin >> a; 44 | ans = query(a)-query(a-1); 45 | cout << ans << endl; 46 | 47 | // Point Update, Range Query 48 | // Add val to element at index a 49 | cin >> val >> a; 50 | update(a, val); 51 | // Query sum of elements from index a to b inclusive 52 | cin >> a >> b; 53 | ans = query(b)-query(a-1); 54 | cout << ans << endl; 55 | 56 | // 5 57 | // 1 2 3 4 5 58 | // 1 1 -> 2 2 3 4 5 59 | // 1 -> ans = 2 60 | // 2 2 -> 2 4 3 4 5 61 | // 2 5 -> ans = 16 62 | 63 | return 0; 64 | } -------------------------------------------------------------------------------- /Profiles/Nikhil.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background: url(image-1.png) no-repeat; 3 | background-size: cover; 4 | 5 | } 6 | p{ 7 | width: 50%; 8 | margin-left: 400px; 9 | font-family: Verdana, Geneva, Tahoma, sans-serif; 10 | color: aliceblue; 11 | border: 2px solid; 12 | padding: 5px; 13 | 14 | } 15 | p:hover{ 16 | margin-left: 400px; 17 | font-family: Verdana, Geneva, Tahoma, sans-serif; 18 | color: #FF00AA; 19 | } 20 | li{ 21 | width: 50%; 22 | margin-left: 400px; 23 | font-family: Verdana, Geneva, Tahoma, sans-serif; 24 | color: aliceblue; 25 | } 26 | li:hover{ 27 | margin-left: 400px; 28 | font-family: Verdana, Geneva, Tahoma, sans-serif; 29 | color: #FF00AA; 30 | 31 | } 32 | h1{ 33 | font-family: Verdana, Geneva, Tahoma, sans-serif; 34 | text-align: center; 35 | margin-top: 40px; 36 | font-size: 60px; 37 | color: azure; 38 | padding: 30px; 39 | padding-left: 60px; 40 | } 41 | h2{ 42 | width: 50%; 43 | margin-left: 400px; 44 | font-family: Verdana, Geneva, Tahoma, sans-serif; 45 | color: aliceblue; 46 | 47 | } 48 | hr{ 49 | width: 51%; 50 | margin-left: 400px; 51 | border: 2px solid white; 52 | } 53 | a{ 54 | margin-left: 600px; 55 | font-size: 50px; 56 | color: white; 57 | } 58 | a:hover{ 59 | color: #FF00AA; 60 | } 61 | .second{ 62 | font-size: 30px; 63 | margin-left: 510px; 64 | } 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Please don't create PR in this repo. This is mark as spam and if you want to create PR please check this repo (https://github.com/HrithikMittal/Hacktoberfest2k20) 2 | 3 | # Welcome to HacktoberFest 2019! 4 | 5 | ### Important Notice 6 | #### Please don't forget to add your name in contributors.md file (https://github.com/HrithikMittal/Hacktoberfest2k19/blob/master/contributors.md) 7 | 8 | ### How to do? 9 | Firstly you have to register here: https://hacktoberfest.digitalocean.com/ 10 |
11 | Follow these steps to make your first pull request- 12 | 13 | 1. Fork this repository. 14 | 2. Clone your forked repository to your local machine. 15 | 3. Add your name in Contributors.md file. 16 | 4. Write these command on your terminal- 17 | 18 | ``` 19 | git add -A 20 | git commit -m "your name" 21 | git push origin master 22 | ``` 23 | 24 | 5. Then create your pull request. 25 | 6. Star my [repository](https://github.com/HrithikMittal/Hacktoberfest2k19/). 26 | 7. Congratulations!! You have successfully created your first pull request. 27 | 8. Check your progress here (https://hacktoberfest.digitalocean.com/profile) 28 | 9. Wait for your t-shirt 29 | 10. Follow me on Github (https://github.com/HrithikMittal) 30 | 31 | Regards, Adhikansh Mittal 32 | 33 | # How to do? 34 | ### Watch this video to learn how to Create a Pull Request. 35 | (Click on the image below) 36 | [![Watch the video](https://github.com/HrithikMittal/Hacktoberfest2k19/blob/master/video.png)](https://youtu.be/4HlkuXblCfI) 37 | -------------------------------------------------------------------------------- /contributors.md: -------------------------------------------------------------------------------- 1 | # Contributors 2 | 3 |
    4 |
  1. Raghav Jindal
  2. 5 |
  3. Sarthak Narang
  4. 6 |
  5. Arjun Sanjeev
  6. 7 |
  7. Marreddy
  8. 8 |
  9. sai nikhil reddy
  10. 9 |
  11. Syed Afroz
  12. 10 |
  13. Gatuam
  14. 11 |
  15. Subha Ilamathy
  16. 12 |
  17. Dibyendu Maji
  18. 13 |
  19. Khushboo Garg
  20. 14 |
  21. Vivek Chauhan
  22. 15 |
  23. Jitesh Kumar
  24. 16 |
  25. Arpit Choudhary
  26. 17 |
  27. Sujith Akshay
  28. 18 |
  29. Aadi S
  30. 19 |
  31. Divanshi Sethi
  32. 20 |
  33. Urmilla Kalita
  34. 21 |
  35. Tej
  36. 22 |
  37. Rishik
  38. 23 |
  39. Shubham
  40. 24 |
  41. Parul Mathur
  42. 25 |
  43. Elyse Segebart
  44. 26 |
  45. Isha yadav
  46. 27 |
  47. Richa
  48. 28 |
  49. Anusha
  50. 29 |
  51. vaishnavi manambat kaloor
  52. 30 |
  53. Yash Raj
  54. 31 |
  55. Debajit Datta
  56. 32 |
  57. Sanchi Chopra
  58. 33 |
  59. Borja Giraldez
  60. 34 |
  61. Justin McCarthy
  62. 35 |
  63. Sudhanshu Kumar
  64. 36 |
  65. sShreyans Jain
  66. 37 |
  67. Vishesh Sharma
  68. 38 |
  69. Omang Rawat
  70. 39 |
  71. Mayur Rajwani
  72. 40 |
  73. Sourabh Gehlot
  74. \ 41 |
  75. ammuharitha
  76. 42 |
  77. Jose Luis
  78. 43 |
  79. Divyansh
  80. 44 |
  81. Shriya
  82. 45 |
  83. Nidhi B
  84. 46 |
  85. Sid
  86. 47 |
  87. Dmitriy Derepko
  88. 48 |
  89. Alex
  90. 49 |
  91. Shubham Arora
  92. 50 |
  93. Prashant Agheda
  94. 51 |
  95. Hemish Veeraboina
  96. 52 |
  97. Ryan McGuire
  98. 53 |
  99. Amit Kumar
  100. 54 |
  101. Muhammad Alwi
  102. 55 |
  103. Juan Huertas
  104. 56 |
  105. NeoxN3il
  106. 57 |
58 | -------------------------------------------------------------------------------- /Profiles/QueueArray.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Node{ 5 | public: 6 | int data; 7 | Node* next; 8 | }; 9 | 10 | class QueueLinkedList 11 | { 12 | private: 13 | Node *head,*tail; 14 | public: 15 | QueueLinkedList(){ 16 | head=NULL; 17 | tail=NULL; 18 | } 19 | Node *getHead(){ 20 | return head; 21 | } 22 | void Queue(int element){ 23 | Node *temp=new Node; 24 | temp->data=element; 25 | temp->next=NULL; 26 | if(head==NULL){ 27 | head=temp; 28 | tail=temp; 29 | } 30 | else{ 31 | tail->next=temp; 32 | tail=tail->next; 33 | } 34 | } 35 | void Dequeue(){ 36 | if(head->next==NULL){ 37 | head=NULL; 38 | cout<<"List is empty."; 39 | return; 40 | } 41 | Node *n=head; 42 | cout<<"deleted node is "<data<next; 44 | 45 | delete head; 46 | head=n; 47 | } 48 | void peekQueue(){ 49 | cout<data<data<>size; 59 | 60 | cout<<"Enter the elements of Queue\n"; 61 | QueueLinkedList list; 62 | int element;int position; 63 | for(int i=0;i>element; 65 | list.Queue(element); 66 | } 67 | list.Dequeue(); 68 | 69 | cout<<"First element of Queue is ";list.peekQueue(); 70 | cout<<"Last element of Queue is ";list.peekDequeue(); 71 | 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /Profiles/QueueLinkedList.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | struct Node{ 5 | public: 6 | int data; 7 | Node* next; 8 | }; 9 | 10 | class QueueLinkedList 11 | { 12 | private: 13 | Node *head,*tail; 14 | public: 15 | QueueLinkedList(){ 16 | head=NULL; 17 | tail=NULL; 18 | } 19 | Node *getHead(){ 20 | return head; 21 | } 22 | void Queue(int element){ 23 | Node *temp=new Node; 24 | temp->data=element; 25 | temp->next=NULL; 26 | if(head==NULL){ 27 | head=temp; 28 | tail=temp; 29 | } 30 | else{ 31 | tail->next=temp; 32 | tail=tail->next; 33 | } 34 | } 35 | void Dequeue(){ 36 | if(head->next==NULL){ 37 | head=NULL; 38 | cout<<"List is empty."; 39 | return; 40 | } 41 | Node *n=head; 42 | cout<<"deleted node is "<data<next; 44 | 45 | delete head; 46 | head=n; 47 | } 48 | void peekQueue(){ 49 | cout<data<data<>size; 59 | 60 | cout<<"Enter the elements of Queue\n"; 61 | QueueLinkedList list; 62 | int element;int position; 63 | for(int i=0;i>element; 65 | list.Queue(element); 66 | } 67 | list.Dequeue(); 68 | 69 | cout<<"First element of Queue is ";list.peekQueue(); 70 | cout<<"Last element of Queue is ";list.peekDequeue(); 71 | 72 | return 0; 73 | } 74 | -------------------------------------------------------------------------------- /Profiles/StackusingLinkedLists.cpp: -------------------------------------------------------------------------------- 1 | // C program for linked list implementation of stack 2 | #include 3 | #include 4 | #include 5 | 6 | struct StackNode 7 | { 8 | int data; 9 | struct StackNode* next; 10 | }; 11 | 12 | struct StackNode* newNode(int data) 13 | { 14 | struct StackNode* stackNode = (struct StackNode*) malloc(sizeof(struct StackNode)); 15 | stackNode->data = data; 16 | stackNode->next = NULL; 17 | return stackNode; 18 | } 19 | 20 | int isEmpty(struct StackNode *root) 21 | { 22 | return !root; 23 | } 24 | 25 | void push(struct StackNode** root, int data) 26 | { 27 | struct StackNode* stackNode = newNode(data); 28 | stackNode->next = *root; 29 | *root = stackNode; 30 | printf("%d pushed to stack\n", data); 31 | } 32 | 33 | int pop(struct StackNode** root) 34 | { 35 | if (isEmpty(*root)) 36 | return INT_MIN; 37 | struct StackNode* temp = *root; 38 | *root = (*root)->next; 39 | int popped = temp->data; 40 | free(temp); 41 | 42 | return popped; 43 | } 44 | 45 | int peek(struct StackNode* root) 46 | { 47 | if (isEmpty(root)) 48 | return INT_MIN; 49 | return root->data; 50 | } 51 | 52 | int main() 53 | { 54 | struct StackNode* root = NULL; 55 | 56 | push(&root, 100); 57 | push(&root, 200); 58 | push(&root, 300); 59 | 60 | printf("%d popped from stack\n", pop(&root)); 61 | 62 | printf("Top element is %d\n", peek(root)); 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /Profiles/shubham.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Hacktoberfest 2019 7 | 58 | 59 | 60 | 61 |

Welcome to Hacktoberfest 2019

62 |
63 | Hacktoberfest-img 64 |
65 |

Thanks @HrithikMittal for creating this Hacktoberfest2019 repo.

66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Profiles/PostfixEvaluation.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define max 100 4 | class PostfixEvaluation 5 | { 6 | int a[max]; 7 | int top; 8 | public: 9 | PostfixEvaluation(){ 10 | top=-1; 11 | } 12 | void push(int element){ 13 | if(top==max){ 14 | cout<<"Stack Overflow"<>exp; 63 | cout<<"Evaluation is "; 64 | cout< 10 | using namespace std; 11 | 12 | class Node 13 | { 14 | public: 15 | int data; 16 | Node *next; 17 | }; 18 | 19 | main() { 20 | Node *temp = new Node(); 21 | Node *first = NULL; 22 | 23 | int n; 24 | 25 | while(true) 26 | {//*** 27 | cin >> n; 28 | //Linked list creation stops if entered value is -1 29 | if(n < 0) 30 | break; 31 | 32 | else { 33 | //if first is null, linked list is not created 34 | if(first == NULL) { 35 | first = new Node(); 36 | first->data = n; 37 | first->next = NULL; 38 | } 39 | else { 40 | for(temp = first; temp->next != NULL; temp = temp->next){ 41 | //temp takes us to the node that has null in its "next" part, i.e, the last node 42 | } 43 | temp->next = new Node; 44 | temp->next->data = n; 45 | temp->next->next = NULL; 46 | 47 | } 48 | } 49 | }//*** 50 | 51 | if(first != NULL) { 52 | for(temp = first; temp != NULL; temp = temp->next) { 53 | cout << temp->data << "\t"; 54 | } 55 | } 56 | } 57 | 58 | 59 | /* 60 | 61 | Output 62 | 63 | 1 64 | 2 65 | 3 66 | 4 67 | 5 68 | -1 69 | 70 | 1 2 3 4 5 71 | 72 | */ 73 | -------------------------------------------------------------------------------- /Profiles/BITApplication.c: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | struct Query 4 | { 5 | int l, r, x, idx; 6 | }; 7 | struct ArrayElement 8 | { 9 | int val, idx; 10 | }; 11 | bool cmp1(Query q1, Query q2) 12 | { 13 | return q1.x < q2.x; 14 | } 15 | bool cmp2(ArrayElement x, ArrayElement y) 16 | { 17 | return x.val < y.val; 18 | } 19 | void update(int bit[], int idx, int val, int n) 20 | { 21 | for (; idx<=n; idx +=idx&-idx) 22 | bit[idx] += val; 23 | } 24 | int query(int bit[], int idx, int n) 25 | { 26 | int sum = 0; 27 | for (; idx > 0; idx -= idx&-idx) 28 | sum += bit[idx]; 29 | return sum; 30 | } 31 | 32 | void answerQueries(int n, Query queries[], int q, 33 | ArrayElement arr[]) 34 | { 35 | int bit[n+1]; 36 | memset(bit, 0, sizeof(bit)); 37 | 38 | sort(arr, arr+n, cmp2); 39 | 40 | sort(queries, queries+q, cmp1); 41 | 42 | int curr = 0; 43 | 44 | int ans[q]; 45 | 46 | for (int i=0; i 2 | #include 3 | using namespace std; 4 | void display(int *array, int size) { 5 | for(int i = 1; i<=size; i++) 6 | cout << array[i] << " "; 7 | cout << endl; 8 | } 9 | int getMax(int array[], int size) { 10 | int max = array[1]; 11 | for(int i = 2; i<=size; i++) { 12 | if(array[i] > max) 13 | max = array[i]; 14 | } 15 | return max; //the max element from the array 16 | } 17 | void countSort(int *array, int size) { 18 | int output[size+1]; 19 | int max = getMax(array, size); 20 | int count[max+1]; //create count array (max+1 number of elements) 21 | for(int i = 0; i<=max; i++) 22 | count[i] = 0; //initialize count array to all zero 23 | for(int i = 1; i <=size; i++) 24 | count[array[i]]++; //increase number count in count array. 25 | for(int i = 1; i<=max; i++) 26 | count[i] += count[i-1]; //find cumulative frequency 27 | for(int i = size; i>=1; i--) { 28 | output[count[array[i]]] = array[i]; 29 | count[array[i]] -= 1; //decrease count for same numbers 30 | } 31 | for(int i = 1; i<=size; i++) { 32 | array[i] = output[i]; //store output array to main array 33 | } 34 | } 35 | int main() { 36 | int n; 37 | cout << "Enter the number of elements: "; 38 | cin >> n; 39 | int arr[n+1]; //create an array with given number of elements 40 | cout << "Enter elements:" << endl; 41 | for(int i = 1; i<=n; i++) { 42 | cin >> arr[i]; 43 | } 44 | cout << "Array before Sorting: "; 45 | display(arr, n); 46 | countSort(arr, n); 47 | cout << "Array after Sorting: "; 48 | display(arr, n); 49 | } 50 | 51 | /* OUTPUT:- 52 | 53 | Enter the number of elements: 10 54 | Enter elements: 55 | 2 5 6 2 3 10 3 6 7 8 56 | Array before Sorting: 2 5 6 2 3 10 3 6 7 8 57 | Array after Sorting: 2 2 3 3 5 6 6 7 8 10 58 | 59 | */ 60 | -------------------------------------------------------------------------------- /Profiles/Nikhil.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | PAGE 8 | 9 | 10 | 11 |

Hacktoberfest2k19

12 |

A chance to Win a T-Shirt form github

13 |

Event Details

14 |

Hacktoberfest® is open to everyone in our global community. Whether you’re a developer, student learning to code, event 15 | host, or company of any size, you can help drive growth of open source and make positive contributions to an 16 | ever-growing community. All backgrounds and skill levels are encouraged to complete the challenge.

17 |
18 |
    19 |
  • Hacktoberfest is open to everyone in our global community!
  • 20 |
  • Pull requests can be made in any GitHub-hosted repositories/projects.
  • 21 |
  • Sign up anytime between October 1 and October 31.
  • 22 |
23 |
24 |

Rules

25 |

To qualify for the official limited edition Hacktoberfest shirt, you must register and make four pull requests (PRs) 26 | between October 1-31 (in any time zone). PRs can be made to any public repo on GitHub, not only the ones with issues 27 | labeled Hacktoberfest. If a maintainer reports your pull request as spam or behavior not in line with the project’s code 28 | of conduct, you will be ineligible to participate. This year, the first 50,000 participants who successfully complete 29 | the challenge will earn a T-shirt.

30 | Registration Link 31 | 32 | For more Details regarding participation! Click Here 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Profiles/Queue.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define MAX 5 4 | class Queue 5 | { 6 | private: 7 | int front,rear; 8 | int ele[MAX]; 9 | public: 10 | Queue() 11 | { 12 | front = 0; 13 | rear = -1; 14 | } 15 | 16 | int isFull(); 17 | int isEmpty(); 18 | void insertQueue(int item); 19 | int deleteQueue(int *item); 20 | }; 21 | int Queue::isFull() 22 | { 23 | int full = 0 ; 24 | 25 | if( rear == MAX-1 ) 26 | full = 1; 27 | 28 | return full; 29 | } 30 | int Queue::isEmpty() 31 | { 32 | int empty = 0 ; 33 | 34 | if( front == rear + 1 ) 35 | empty = 1; 36 | 37 | return empty; 38 | } 39 | void Queue:: insertQueue(int item) 40 | { 41 | if( isFull() ) 42 | { 43 | cout<<"\nQueue OverFlow" << endl; 44 | return; 45 | } 46 | 47 | ele[++rear]=item; 48 | cout<<"\ninserted Value :" << item; 49 | } 50 | int Queue:: deleteQueue(int *item) 51 | { 52 | if( isEmpty() ) 53 | { 54 | cout<<"\nQueue Underflow" << endl; 55 | return -1; 56 | } 57 | 58 | *item = ele[front++]; 59 | return 0; 60 | } 61 | 62 | int main() 63 | { 64 | int item=0; 65 | 66 | Queue q = Queue(); 67 | 68 | q.insertQueue(10); 69 | q.insertQueue(20); 70 | q.insertQueue(30); 71 | q.insertQueue(40); 72 | q.insertQueue(50); 73 | q.insertQueue(60); 74 | 75 | if(q.deleteQueue( &item)==0) 76 | cout<<"\nDeleted item : "<< item; 77 | 78 | if(q.deleteQueue( &item)==0) 79 | cout<<"\nDeleted item : "<< item; 80 | 81 | if(q.deleteQueue( &item)==0) 82 | cout<<"\nDeleted item : "<< item; 83 | 84 | if(q.deleteQueue( &item)==0) 85 | cout<<"\nDeleted item : "<< item; 86 | 87 | if(q.deleteQueue( &item)==0) 88 | cout<<"\nDeleted item : "<< item; 89 | 90 | if(q.deleteQueue( &item)==0) 91 | cout<<"\nDeleted item : "<< item; 92 | 93 | cout<< endl; 94 | return 0; 95 | } 96 | -------------------------------------------------------------------------------- /Profiles/Stack Implementation.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int top=0; 4 | int stack[]; 5 | void traverse(); 6 | void peek(); 7 | void pop(); 8 | void push(); 9 | int isFull(); 10 | int isEmpty(); 11 | 12 | void main(){ 13 | int i=0,data,n=0; 14 | printf("Enter The Size:\n"); 15 | scanf("%d",&n); 16 | while(1){ 17 | printf("1: Push\n2: Pop\n3: Peek\n4: Traverse\n5: Exit\n"); 18 | scanf("%d",&i); 19 | switch(i){ 20 | case 1: { 21 | printf("Enter The Data\n"); 22 | scanf("%d",&data); 23 | push(data,n); 24 | break; 25 | } 26 | case 2: { 27 | pop(); 28 | break; 29 | } 30 | case 3:{ 31 | peek(); 32 | break; 33 | } 34 | case 4:{ 35 | traverse(); 36 | break; 37 | } 38 | case 5:{ 39 | exit(0); 40 | } 41 | default: printf("Come Again!!"); 42 | } 43 | } 44 | } 45 | void push(int data, int n){ 46 | if(isFull(n+1)){ 47 | printf("Stack is Full\n\n"); 48 | } 49 | else{ 50 | stack[++top]=data; 51 | printf("\n%d is pushed\n\n",data); 52 | } 53 | } 54 | 55 | int isFull(int n){ 56 | return (top==n-1)?1:0; 57 | } 58 | 59 | void pop(){ 60 | int data; 61 | if(isEmpty()){ 62 | printf("Stack is Empty\n"); 63 | } 64 | else{ 65 | if(top==0){ 66 | printf("Stack is Empty\n"); 67 | } 68 | else{ 69 | data=stack[top--]; 70 | printf("%d is popped\n",data); 71 | } 72 | } 73 | } 74 | 75 | int isEmpty(){ 76 | return (top==-1)?1:0; 77 | } 78 | 79 | void peek(){ 80 | if(isEmpty()){ 81 | printf("Cannot Peek Further\n"); 82 | } 83 | else{ 84 | printf("Peek = %d\n",stack[top]); 85 | } 86 | } 87 | 88 | void traverse(){ 89 | int i; 90 | if(isEmpty()){ 91 | printf("Cannot be Traversed\n"); 92 | } 93 | else{ 94 | for(i=top;i>0;i--){ 95 | printf("%d ",stack[i]); 96 | } 97 | printf("\n\n"); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Mansi: -------------------------------------------------------------------------------- 1 | 2 | 3 | FORM PRACTICE 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 35 | 36 | 37 | 38 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 57 | 58 | 59 | 60 | 64 | 65 |
User-Name
Email
Password
Contact
GenderMALE 27 | FEMALE
HOBBIESART 32 | DANCE 33 | PLAYING 34 | SINGING
COURSES 39 | 46 |
IMAGE
ADDRESS 55 | 56 |
ACTION 61 | 62 | 63 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /Profiles/double_linked_list.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | struct node 4 | { 5 | int data; 6 | node *next,*prev; 7 | }; 8 | 9 | node* create_list(int m) 10 | { 11 | node *head,*p,*q; 12 | cout<<"enter the elements: "; 13 | for(int i=0;i>p->data; 17 | p->next=NULL; 18 | p->prev=NULL; 19 | if (i==0) 20 | { 21 | head=p; 22 | q=p; 23 | } 24 | else 25 | { 26 | q->next=p; 27 | p->prev=q; 28 | q=q->next; 29 | } 30 | } 31 | return head; 32 | } 33 | 34 | void display(node *head) 35 | { 36 | node *p=head; 37 | while(p!=NULL) 38 | { 39 | cout<data<<" "; 40 | p=p->next; 41 | } 42 | cout<next; 54 | while(r!=NULL) 55 | { 56 | if(min->data > r->data) 57 | { 58 | min=r; 59 | } 60 | r=r->next; 61 | } 62 | info = temp->data; 63 | temp->data = min->data; 64 | min->data = info; 65 | temp = temp->next; 66 | } 67 | p=head; 68 | while(p!=NULL && p->data < num) 69 | { 70 | pos++;//5 71 | p=p->next; 72 | } 73 | q=new node; 74 | q->data=num; 75 | p=head; 76 | if(pos==0) 77 | { 78 | q->next=p; 79 | p->prev=q; 80 | head=q; 81 | } 82 | else 83 | { 84 | while(count!=pos) 85 | { 86 | temp=p; 87 | p=p->next; 88 | count++; 89 | } 90 | temp->next = q; 91 | q->prev = temp; 92 | q->next = p; 93 | if(countprev = q; 96 | } 97 | } 98 | return head; 99 | } 100 | 101 | void reverse_list(node *head) 102 | { 103 | node *q,*p=head; 104 | while(p!=NULL) 105 | { 106 | q=p; 107 | p=p->next; 108 | } 109 | while(q!=NULL) 110 | { 111 | cout<data<<" "; 112 | q=q->prev; 113 | } 114 | cout<>num; 123 | head=create_list(num); 124 | cout<<"the entered list is: "; 125 | display(head); 126 | cout<<"enter the no. u want to insert: "; 127 | cin>>x; 128 | head=insertion_sort(head,x,num); 129 | cout<<"the inserted-sorted list is: "; 130 | display(head); 131 | cout<<"the reversed list is: "; 132 | reverse_list(head); 133 | return 0; 134 | } 135 | -------------------------------------------------------------------------------- /Profiles/HeapSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | 8 | public class HeapSort 9 | { 10 | static void Main(string[] args) 11 | { 12 | int[] arr = { 12, 11, 13, 5, 6, 7 }; 13 | int n = arr.Length; 14 | 15 | HeapSort ob = new HeapSort(); 16 | ob.Sort(arr); 17 | 18 | Console.WriteLine("Sorted array is"); 19 | printArray(arr); 20 | } 21 | static void printArray(int[] arr) 22 | { 23 | int n = arr.Length; 24 | for (int i = 0; i < n; ++i) 25 | Console.Write(arr[i] + " "); 26 | Console.ReadKey(); 27 | } 28 | public void Sort(int[] arr) 29 | { 30 | int n = arr.Length; 31 | 32 | // Build heap (rearrange array) 33 | for (int i = n / 2 - 1; i >= 0; i--) 34 | Heapify(arr, n, i); 35 | 36 | // One by one extract an element from heap 37 | for (int i = n - 1; i >= 0; i--) 38 | { 39 | // Move current root to end 40 | int temp = arr[0]; 41 | arr[0] = arr[i]; 42 | arr[i] = temp; 43 | 44 | // call max heapify on the reduced heap 45 | Heapify(arr, i, 0); 46 | } 47 | } 48 | 49 | // To heapify a subtree rooted with node i which is 50 | // an index in arr[]. n is size of heap 51 | void Heapify(int[] arr, int n, int i) 52 | { 53 | int largest = i; // Initialize largest as root 54 | int l = 2 * i + 1; // left = 2*i + 1 55 | int r = 2 * i + 2; // right = 2*i + 2 56 | 57 | // If left child is larger than root 58 | if (l < n && arr[l] > arr[largest]) 59 | largest = l; 60 | 61 | // If right child is larger than largest so far 62 | if (r < n && arr[r] > arr[largest]) 63 | largest = r; 64 | 65 | // If largest is not root 66 | if (largest != i) 67 | { 68 | int swap = arr[i]; 69 | arr[i] = arr[largest]; 70 | arr[largest] = swap; 71 | 72 | // Recursively heapify the affected sub-tree 73 | Heapify(arr, n, largest); 74 | } 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /Profiles/InfixToPostfix.cxx: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | #define max 100 4 | class InfixToPostfix 5 | { 6 | char a[max]; 7 | int top; 8 | public: 9 | InfixToPostfix(){ 10 | top=-1; 11 | } 12 | void push(char element){ 13 | if(top==max){ 14 | cout<<"Stack Overflow"<='a')&&(ch<='z'))||((ch>='A')&&(ch<='Z')); 53 | } 54 | string convert(string s){ 55 | InfixToPostfix st; 56 | int l=s.length(); 57 | string ns=""; 58 | st.push('N'); 59 | for(int i=0;i>exp; 98 | cout<<"Postfix Expression is \t"; 99 | cout< 2 | using namespace std; 3 | 4 | 5 | void DeleteMedian(priority_queue &MaxHeap,priority_queue, greater > &MinHeap) 6 | { 7 | int MaxSize = MaxHeap.size(); 8 | int MinSize = MinHeap.size(); 9 | 10 | if(MaxSize==0) 11 | { 12 | cout<<"No element present to get deleted"; 13 | } 14 | 15 | if((MaxSize+MinSize)%2==0) 16 | { 17 | MaxHeap.pop(); 18 | int i=MinHeap.top(); 19 | MaxHeap.push(i); 20 | MinHeap.pop(); 21 | } 22 | 23 | else 24 | MaxHeap.pop(); 25 | 26 | } 27 | 28 | void AddElement(priority_queue &MaxHeap,priority_queue, greater > &MinHeap,int n) 29 | { 30 | //First check total number of element added till now are even or odd 31 | //Max Heap contains k+1 element if total Elements are Odd else both contain k-k elements 32 | 33 | int MaxSize = MaxHeap.size(); 34 | int MinSize = MinHeap.size(); 35 | 36 | if((MaxSize+MinSize)%2==0) 37 | { //Now Comes two cases either the new element is smaller than present Median or greater; 38 | if(n<=MaxHeap.top()) 39 | MaxHeap.push(n); //Simply push the element in Max MaxHeap 40 | 41 | else 42 | { //First push the element in Heap 43 | MinHeap.push(n); 44 | int i = MinHeap.top(); 45 | MinHeap.pop(); 46 | MaxHeap.push(i); 47 | } 48 | } 49 | 50 | else 51 | { 52 | if(n<=MaxHeap.top()) 53 | { 54 | int i = MaxHeap.top(); 55 | MinHeap.push(i); 56 | MaxHeap.pop(); 57 | MaxHeap.push(n); 58 | } 59 | else 60 | MinHeap.push(n); 61 | } 62 | 63 | } 64 | 65 | 66 | int main() 67 | { int operation,n; 68 | priority_queue MaxHeap; 69 | priority_queue, greater > MinHeap; 70 | cout<>operation; 72 | 73 | MaxHeap.push(10); 74 | MinHeap.push(12); 75 | while(operation) 76 | { if(operation==1 || operation==2) 77 | { 78 | if(operation==1) 79 | { 80 | cout<<"Enter Element you want to add = "; 81 | cin>>n; 82 | AddElement(MaxHeap,MinHeap,n); 83 | } 84 | 85 | if(operation==2) 86 | DeleteMedian(MaxHeap,MinHeap); 87 | if(MaxHeap.size()!=0) 88 | cout<<"Median after operation is="< 2 | #include 3 | 4 | void traverse(); 5 | void insert_end(); 6 | void insert_beg(); 7 | void insert_mid(); 8 | struct node* creatNode(); 9 | 10 | struct node 11 | { 12 | int info; 13 | struct node *link; 14 | }; 15 | struct node *start = NULL; 16 | int count=0; 17 | 18 | struct node* creatNode() 19 | { 20 | struct node *p; 21 | p=malloc(sizeof(struct node)); 22 | 23 | return (p); 24 | } 25 | 26 | int main() 27 | {int input; 28 | 29 | for (;;) { 30 | printf("1. Insert an element at beginning of linked list.\n"); 31 | printf("2. Insert an element at end of linked list.\n"); 32 | printf("3. Traverse linked list.\n"); 33 | printf("4. insert at mid.\n"); 34 | printf("5. Delete element from end.\n"); 35 | printf("6. Exit\n"); 36 | 37 | scanf("%d", &input); 38 | 39 | if (input == 1) 40 | 41 | insert_beg(); 42 | 43 | else if (input == 2) 44 | insert_end(); 45 | 46 | else if (input == 3) 47 | traverse(); 48 | else if (input == 4) 49 | insert_mid(); 50 | /*else if (input == 5) 51 | delete_from_end(); */ 52 | else if (input == 6) 53 | break; 54 | else 55 | printf("Please enter valid input.\n"); 56 | } 57 | 58 | return 0; 59 | 60 | } 61 | 62 | void insert_beg() 63 | { 64 | struct node *temp; 65 | temp = creatNode(); 66 | count++; 67 | printf("enter a number"); 68 | scanf("%d",&temp->info); 69 | temp->link = NULL; 70 | if(start==NULL) 71 | start = temp; 72 | else 73 | { 74 | temp->link=start; 75 | start=temp; 76 | } 77 | 78 | } 79 | void insert_mid() 80 | { int pos; 81 | struct node *temp,*new ,*t; 82 | new = creatNode(); 83 | if(new==NULL) 84 | return; 85 | 86 | printf("Enter position u want to insert a element \n"); 87 | scanf("%d",&pos); 88 | t=start; 89 | temp=start; 90 | for(int i=1;ilink; 92 | temp=temp->link;} 93 | temp=temp->link; 94 | 95 | printf("enter a number"); 96 | scanf("%d",&new->info); 97 | t->link = new; 98 | new->link=temp; 99 | } 100 | void insert_end() // insertion at end 101 | { 102 | struct node *temp, *t; 103 | temp = creatNode(); 104 | count++; 105 | printf("enter a number"); 106 | scanf("%d",&temp->info); 107 | temp->link = NULL; 108 | if(start==NULL) 109 | start = temp; 110 | else 111 | { t=start; 112 | while(t->link!=NULL) 113 | { 114 | t=t->link; 115 | } 116 | 117 | t->link=temp; 118 | } 119 | } 120 | 121 | 122 | void traverse() 123 | { 124 | struct node *temp; 125 | temp=start; 126 | if(temp==NULL) 127 | {printf("Linked list is empty\n"); 128 | return;} 129 | 130 | 131 | printf("There are %d element in linked list\n",count); 132 | 133 | while (temp->link != NULL) 134 | { 135 | printf("%d\n", temp->info); 136 | temp = temp->link; 137 | } 138 | printf("%d\n", temp->info); 139 | } 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at adhikanshmittal@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /Profiles/stack_using_dll.py: -------------------------------------------------------------------------------- 1 | # A complete working Python program to demonstrate all 2 | # stack operations using a doubly linked list 3 | 4 | # Node class 5 | class Node: 6 | 7 | # Function to initialise the node object 8 | def __init__(self, data): 9 | self.data = data # Assign data 10 | self.next = None # Initialize next as null 11 | self.prev = None # Initialize prev as null 12 | 13 | # Stack class contains a Node object 14 | class Stack: 15 | # Function to initialize head 16 | def __init__(self): 17 | self.head = None 18 | 19 | # Function to add an element data in the stack 20 | def push(self, data): 21 | 22 | if self.head is None: 23 | self.head = Node(data) 24 | else: 25 | new_node = Node(data) 26 | self.head.prev = new_node 27 | new_node.next = self.head 28 | new_node.prev = None 29 | self.head = new_node 30 | 31 | 32 | # Function to pop top element and return the element from the stack 33 | def pop(self): 34 | 35 | if self.head is None: 36 | return None 37 | else: 38 | temp = self.head.data 39 | self.head = self.head.next 40 | self.head.prev = None 41 | return temp 42 | 43 | 44 | # Function to return top element in the stack 45 | def top(self): 46 | 47 | return self.head.data 48 | 49 | 50 | # Function to return the size of the stack 51 | def size(self): 52 | 53 | temp = self.head 54 | count = 0 55 | while temp is not None: 56 | count = count + 1 57 | temp = temp.next 58 | return count 59 | 60 | 61 | # Function to check if the stack is empty or not 62 | def isEmpty(self): 63 | 64 | if self.head is None: 65 | return True 66 | else: 67 | return False 68 | 69 | 70 | # Function to print the stack 71 | def printstack(self): 72 | 73 | print("stack elements are:") 74 | temp = self.head 75 | while temp is not None: 76 | print(temp.data, end ="->") 77 | temp = temp.next 78 | 79 | 80 | # Code execution starts here 81 | if __name__=='__main__': 82 | 83 | # Start with the empty stack 84 | stack = Stack() 85 | 86 | # Insert 4 at the beginning. So stack becomes 4->None 87 | print("Stack operations using Doubly LinkedList") 88 | stack.push(4) 89 | 90 | # Insert 5 at the beginning. So stack becomes 4->5->None 91 | stack.push(5) 92 | 93 | # Insert 6 at the beginning. So stack becomes 4->5->6->None 94 | stack.push(6) 95 | 96 | # Insert 7 at the beginning. So stack becomes 4->5->6->7->None 97 | stack.push(7) 98 | 99 | # Print the stack 100 | stack.printstack() 101 | 102 | # Print the top element 103 | print("\nTop element is ", stack.top()) 104 | 105 | # Print the stack size 106 | print("Size of the stack is ", stack.size()) 107 | 108 | # pop the top element 109 | stack.pop() 110 | 111 | # pop the top element 112 | stack.pop() 113 | 114 | # two elements are popped 115 | # Print the stack 116 | stack.printstack() 117 | 118 | # Print True if the stack is empty else False 119 | print("\nstack is empty:", stack.isEmpty()) -------------------------------------------------------------------------------- /Profiles/timsort.py: -------------------------------------------------------------------------------- 1 | # Python3 program to perform TimSort. 2 | RUN = 32 3 | 4 | # This function sorts array from left index to 5 | # to right index which is of size atmost RUN 6 | def insertionSort(arr, left, right): 7 | 8 | for i in range(left + 1, right+1): 9 | 10 | temp = arr[i] 11 | j = i - 1 12 | while arr[j] > temp and j >= left: 13 | 14 | arr[j+1] = arr[j] 15 | j -= 1 16 | 17 | arr[j+1] = temp 18 | 19 | # merge function merges the sorted runs 20 | def merge(arr, l, m, r): 21 | 22 | # original array is broken in two parts 23 | # left and right array 24 | len1, len2 = m - l + 1, r - m 25 | left, right = [], [] 26 | for i in range(0, len1): 27 | left.append(arr[l + i]) 28 | for i in range(0, len2): 29 | right.append(arr[m + 1 + i]) 30 | 31 | i, j, k = 0, 0, l 32 | # after comparing, we merge those two array 33 | # in larger sub array 34 | while i < len1 and j < len2: 35 | 36 | if left[i] <= right[j]: 37 | arr[k] = left[i] 38 | i += 1 39 | 40 | else: 41 | arr[k] = right[j] 42 | j += 1 43 | 44 | k += 1 45 | 46 | # copy remaining elements of left, if any 47 | while i < len1: 48 | 49 | arr[k] = left[i] 50 | k += 1 51 | i += 1 52 | 53 | # copy remaining element of right, if any 54 | while j < len2: 55 | arr[k] = right[j] 56 | k += 1 57 | j += 1 58 | 59 | # iterative Timsort function to sort the 60 | # array[0...n-1] (similar to merge sort) 61 | def timSort(arr, n): 62 | 63 | # Sort individual subarrays of size RUN 64 | for i in range(0, n, RUN): 65 | insertionSort(arr, i, min((i+31), (n-1))) 66 | 67 | # start merging from size RUN (or 32). It will merge 68 | # to form size 64, then 128, 256 and so on .... 69 | size = RUN 70 | while size < n: 71 | 72 | # pick starting point of left sub array. We 73 | # are going to merge arr[left..left+size-1] 74 | # and arr[left+size, left+2*size-1] 75 | # After every merge, we increase left by 2*size 76 | for left in range(0, n, 2*size): 77 | 78 | # find ending point of left sub array 79 | # mid+1 is starting point of right sub array 80 | mid = left + size - 1 81 | right = min((left + 2*size - 1), (n-1)) 82 | 83 | # merge sub array arr[left.....mid] & 84 | # arr[mid+1....right] 85 | merge(arr, left, mid, right) 86 | 87 | size = 2*size 88 | 89 | # utility function to print the Array 90 | def printArray(arr, n): 91 | 92 | for i in range(0, n): 93 | print(arr[i], end = " ") 94 | print() 95 | 96 | 97 | # Driver program to test above function 98 | if __name__ == "__main__": 99 | 100 | arr = [5, 21, 7, 23, 19] 101 | n = len(arr) 102 | print("Given Array is") 103 | printArray(arr, n) 104 | 105 | timSort(arr, n) 106 | 107 | print("After Sorting Array is") 108 | printArray(arr, n) 109 | 110 | 111 | 112 | 113 | #We consider size of run as 32. 114 | #We one by one sort pieces of size equal to run 115 | #After sorting individual pieces, we merge them one by one. We double the size of merged subarrays after every iteration. -------------------------------------------------------------------------------- /Profiles/Doubly_linked_list.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self, data): 3 | self.data = data 4 | self.next = None 5 | self.prev = None 6 | 7 | 8 | class DoublyLinkedList: 9 | def __init__(self): 10 | self.first = None 11 | self.last = None 12 | 13 | def get_node(self, index): 14 | current = self.first 15 | for i in range(index): 16 | if current is None: 17 | return None 18 | current = current.next 19 | return current 20 | 21 | def insert_after(self, ref_node, new_node): 22 | new_node.prev = ref_node 23 | if ref_node.next is None: 24 | self.last = new_node 25 | else: 26 | new_node.next = ref_node.next 27 | new_node.next.prev = new_node 28 | ref_node.next = new_node 29 | 30 | def insert_before(self, ref_node, new_node): 31 | new_node.next = ref_node 32 | if ref_node.prev is None: 33 | self.first = new_node 34 | else: 35 | new_node.prev = ref_node.prev 36 | new_node.prev.next = new_node 37 | ref_node.prev = new_node 38 | 39 | def insert_at_beg(self, new_node): 40 | if self.first is None: 41 | self.first = new_node 42 | self.last = new_node 43 | else: 44 | self.insert_before(self.first, new_node) 45 | 46 | def insert_at_end(self, new_node): 47 | if self.last is None: 48 | self.last = new_node 49 | self.first = new_node 50 | else: 51 | self.insert_after(self.last, new_node) 52 | 53 | def remove(self, node): 54 | if node.prev is None: 55 | self.first = node.next 56 | else: 57 | node.prev.next = node.next 58 | 59 | if node.next is None: 60 | self.last = node.prev 61 | else: 62 | node.next.prev = node.prev 63 | 64 | def display(self): 65 | current = self.first 66 | while current: 67 | print(current.data, end = ' ') 68 | current = current.next 69 | 70 | 71 | a_dllist = DoublyLinkedList() 72 | 73 | print('Menu') 74 | print('insert after ') 75 | print('insert before ') 76 | print('insert at beg') 77 | print('insert at end') 78 | print('remove ') 79 | print('quit') 80 | 81 | while True: 82 | print('The list: ', end = '') 83 | a_dllist.display() 84 | print() 85 | do = input('What would you like to do? ').split() 86 | 87 | operation = do[0].strip().lower() 88 | 89 | if operation == 'insert': 90 | data = int(do[1]) 91 | position = do[3].strip().lower() 92 | new_node = Node(data) 93 | suboperation = do[2].strip().lower() 94 | if suboperation == 'at': 95 | if position == 'beg': 96 | a_dllist.insert_at_beg(new_node) 97 | elif position == 'end': 98 | a_dllist.insert_at_end(new_node) 99 | else: 100 | index = int(position) 101 | ref_node = a_dllist.get_node(index) 102 | if ref_node is None: 103 | print('No such index.') 104 | continue 105 | if suboperation == 'after': 106 | a_dllist.insert_after(ref_node, new_node) 107 | elif suboperation == 'before': 108 | a_dllist.insert_before(ref_node, new_node) 109 | 110 | elif operation == 'remove': 111 | index = int(do[1]) 112 | node = a_dllist.get_node(index) 113 | if node is None: 114 | print('No such index.') 115 | continue 116 | a_dllist.remove(node) 117 | 118 | elif operation == 'quit': 119 | break -------------------------------------------------------------------------------- /Profiles/Doubly_linkedlist.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self, data): 3 | self.data = data 4 | self.next = None 5 | self.prev = None 6 | 7 | 8 | class DoublyLinkedList: 9 | def __init__(self): 10 | self.first = None 11 | self.last = None 12 | 13 | def get_node(self, index): 14 | current = self.first 15 | for i in range(index): 16 | if current is None: 17 | return None 18 | current = current.next 19 | return current 20 | 21 | def insert_after(self, ref_node, new_node): 22 | new_node.prev = ref_node 23 | if ref_node.next is None: 24 | self.last = new_node 25 | else: 26 | new_node.next = ref_node.next 27 | new_node.next.prev = new_node 28 | ref_node.next = new_node 29 | 30 | def insert_before(self, ref_node, new_node): 31 | new_node.next = ref_node 32 | if ref_node.prev is None: 33 | self.first = new_node 34 | else: 35 | new_node.prev = ref_node.prev 36 | new_node.prev.next = new_node 37 | ref_node.prev = new_node 38 | 39 | def insert_at_beg(self, new_node): 40 | if self.first is None: 41 | self.first = new_node 42 | self.last = new_node 43 | else: 44 | self.insert_before(self.first, new_node) 45 | 46 | def insert_at_end(self, new_node): 47 | if self.last is None: 48 | self.last = new_node 49 | self.first = new_node 50 | else: 51 | self.insert_after(self.last, new_node) 52 | 53 | def remove(self, node): 54 | if node.prev is None: 55 | self.first = node.next 56 | else: 57 | node.prev.next = node.next 58 | 59 | if node.next is None: 60 | self.last = node.prev 61 | else: 62 | node.next.prev = node.prev 63 | 64 | def display(self): 65 | current = self.first 66 | while current: 67 | print(current.data, end = ' ') 68 | current = current.next 69 | 70 | 71 | a_dllist = DoublyLinkedList() 72 | 73 | print('Menu') 74 | print('insert after ') 75 | print('insert before ') 76 | print('insert at beg') 77 | print('insert at end') 78 | print('remove ') 79 | print('quit') 80 | 81 | while True: 82 | print('The list: ', end = '') 83 | a_dllist.display() 84 | print() 85 | do = input('What would you like to do? ').split() 86 | 87 | operation = do[0].strip().lower() 88 | 89 | if operation == 'insert': 90 | data = int(do[1]) 91 | position = do[3].strip().lower() 92 | new_node = Node(data) 93 | suboperation = do[2].strip().lower() 94 | if suboperation == 'at': 95 | if position == 'beg': 96 | a_dllist.insert_at_beg(new_node) 97 | elif position == 'end': 98 | a_dllist.insert_at_end(new_node) 99 | else: 100 | index = int(position) 101 | ref_node = a_dllist.get_node(index) 102 | if ref_node is None: 103 | print('No such index.') 104 | continue 105 | if suboperation == 'after': 106 | a_dllist.insert_after(ref_node, new_node) 107 | elif suboperation == 'before': 108 | a_dllist.insert_before(ref_node, new_node) 109 | 110 | elif operation == 'remove': 111 | index = int(do[1]) 112 | node = a_dllist.get_node(index) 113 | if node is None: 114 | print('No such index.') 115 | continue 116 | a_dllist.remove(node) 117 | 118 | elif operation == 'quit': 119 | break 120 | -------------------------------------------------------------------------------- /Profiles/binary_search_tree.py: -------------------------------------------------------------------------------- 1 | class BSTNode: 2 | def __init__(self, key): 3 | self.key = key 4 | self.left = None 5 | self.right = None 6 | self.parent = None 7 | 8 | def insert(self, node): 9 | if self.key > node.key: 10 | if self.left is None: 11 | self.left = node 12 | node.parent = self 13 | else: 14 | self.left.insert(node) 15 | elif self.key < node.key: 16 | if self.right is None: 17 | self.right = node 18 | node.parent = self 19 | else: 20 | self.right.insert(node) 21 | 22 | def inorder(self): 23 | if self.left is not None: 24 | self.left.inorder() 25 | print(self.key, end=' ') 26 | if self.right is not None: 27 | self.right.inorder() 28 | 29 | def replace_node_of_parent(self, new_node): 30 | if self.parent is not None: 31 | if new_node is not None: 32 | new_node.parent = self.parent 33 | if self.parent.left == self: 34 | self.parent.left = new_node 35 | elif self.parent.right == self: 36 | self.parent.right = new_node 37 | else: 38 | self.key = new_node.key 39 | self.left = new_node.left 40 | self.right = new_node.right 41 | if new_node.left is not None: 42 | new_node.left.parent = self 43 | if new_node.right is not None: 44 | new_node.right.parent = self 45 | 46 | def find_min(self): 47 | current = self 48 | while current.left is not None: 49 | current = current.left 50 | return current 51 | 52 | def remove(self): 53 | if (self.left is not None and self.right is not None): 54 | successor = self.right.find_min() 55 | self.key = successor.key 56 | successor.remove() 57 | elif self.left is not None: 58 | self.replace_node_of_parent(self.left) 59 | elif self.right is not None: 60 | self.replace_node_of_parent(self.right) 61 | else: 62 | self.replace_node_of_parent(None) 63 | 64 | def search(self, key): 65 | if self.key > key: 66 | if self.left is not None: 67 | return self.left.search(key) 68 | else: 69 | return None 70 | elif self.key < key: 71 | if self.right is not None: 72 | return self.right.search(key) 73 | else: 74 | return None 75 | return self 76 | 77 | 78 | class BSTree: 79 | def __init__(self): 80 | self.root = None 81 | 82 | def inorder(self): 83 | if self.root is not None: 84 | self.root.inorder() 85 | 86 | def add(self, key): 87 | new_node = BSTNode(key) 88 | if self.root is None: 89 | self.root = new_node 90 | else: 91 | self.root.insert(new_node) 92 | 93 | def remove(self, key): 94 | to_remove = self.search(key) 95 | if (self.root == to_remove 96 | and self.root.left is None and self.root.right is None): 97 | self.root = None 98 | else: 99 | to_remove.remove() 100 | 101 | def search(self, key): 102 | if self.root is not None: 103 | return self.root.search(key) 104 | 105 | 106 | bstree = BSTree() 107 | 108 | print('Menu (this assumes no duplicate keys)') 109 | print('add ') 110 | print('remove ') 111 | print('inorder') 112 | print('quit') 113 | 114 | while True: 115 | do = input('What would you like to do? ').split() 116 | 117 | operation = do[0].strip().lower() 118 | if operation == 'add': 119 | key = int(do[1]) 120 | bstree.add(key) 121 | elif operation == 'remove': 122 | key = int(do[1]) 123 | bstree.remove(key) 124 | elif operation == 'inorder': 125 | print('Inorder traversal: ', end='') 126 | bstree.inorder() 127 | print() 128 | elif operation == 'quit': 129 | break -------------------------------------------------------------------------------- /Profiles/LinkedList.cxx: -------------------------------------------------------------------------------- 1 | /* 2 | * Data Structures 3 | * Made by Gurpreet Singh 4 | */ 5 | 6 | 7 | #include 8 | using namespace std; 9 | 10 | struct Node{ 11 | public: 12 | int data; 13 | Node* next; 14 | }; 15 | 16 | class LinkedList 17 | { 18 | private: 19 | Node *head,*tail; 20 | public: 21 | LinkedList(){ 22 | head=NULL; 23 | tail=NULL; 24 | } 25 | Node *getHead(){ 26 | return head; 27 | } 28 | int getSize(){ 29 | int count=0; 30 | for(Node *n=head;n!=NULL;n=n->next) 31 | count++; 32 | 33 | return count; 34 | } 35 | void display(Node *n){ 36 | cout<<"Linked List :\t"; 37 | while(n!=NULL){ 38 | cout<data<<"\t"; 39 | n=n->next; 40 | } 41 | cout<<"\n"; 42 | } 43 | void addNodeAtEnd(int element){ 44 | Node *temp=new Node; 45 | temp->data=element; 46 | temp->next=NULL; 47 | if(head==NULL){ 48 | head=temp; 49 | tail=temp; 50 | } 51 | else{ 52 | tail->next=temp; 53 | tail=tail->next; 54 | } 55 | } 56 | void addNodeAtFront(int element){ 57 | Node *temp=new Node; 58 | temp->data=element; 59 | if(head==NULL){ 60 | temp->next=NULL; 61 | head=temp; 62 | tail=temp; 63 | } 64 | else{ 65 | temp->next=head; 66 | head=temp; 67 | } 68 | } 69 | void addNodeAtAnyPosition(int element,int position){ 70 | if(position>LinkedList::getSize()||position<=0) 71 | cout<<"Size Not Possible\n"; 72 | else{ 73 | Node *temp=new Node; 74 | temp->data=element; 75 | 76 | Node *n = head; 77 | while (--position>0){ 78 | n=n->next; 79 | } 80 | temp->next=n->next; 81 | n->next=temp; 82 | } 83 | } 84 | void deleteNodeAtHead(){ 85 | if(head->next==NULL){ 86 | cout<<"List cannot be empty. It only contains one element"; 87 | return; 88 | } 89 | Node *n=head; 90 | n=n->next; 91 | delete head; 92 | head=n; 93 | } 94 | void deleteNodeAtTail(){ 95 | if(head->next==NULL){ 96 | cout<<"List cannot be empty. It only contains one element"; 97 | return; 98 | } 99 | Node *n=head; 100 | Node *temp; 101 | while(n->next!=NULL){ 102 | temp=n; 103 | n=n->next; 104 | } 105 | delete n; 106 | temp->next=NULL; 107 | tail=temp; 108 | } 109 | void deleteNodeAtPosition(int position){ 110 | if(head->next==NULL){ 111 | cout<<"List cannot be empty. It only contains one element"; 112 | return; 113 | } 114 | if(position>LinkedList::getSize()||position<0) 115 | cout<<"Size Not Possible\n"; 116 | else{ 117 | Node *n=head; 118 | while(position-1>0){ 119 | n=n->next; 120 | position--; 121 | } 122 | n->next=n->next->next; 123 | delete n; 124 | } 125 | } 126 | void searchAnElement(int element){ 127 | bool tf=false; 128 | for(Node *n=head;n!=NULL;n=n->next){ 129 | if(n->data==element) tf=true; 130 | } 131 | tf==true?cout<<"Element Found\n":cout<<"Element not Found\n"; 132 | } 133 | void reverseDisplay(Node *n){ 134 | if(n==NULL) 135 | return; 136 | else{ 137 | reverseDisplay(n->next); 138 | cout<data<<"\t"; 139 | } 140 | } 141 | }; 142 | int main() 143 | { 144 | cout<<"Enter the number of nodes you want to create\n"; 145 | int size;cin>>size; 146 | 147 | cout<<"Enter the elements of Node\n"; 148 | LinkedList list; 149 | int element;int position; 150 | for(int i=0;i>element; 152 | list.addNodeAtEnd(element); 153 | } 154 | 155 | list.display(list.getHead()); 156 | 157 | cout<<"Enter element to be inserted at front\n"; 158 | cin>>element; 159 | list.addNodeAtFront(element); 160 | list.display(list.getHead()); 161 | 162 | cout<<"Enter element to be inserted at end\n"; 163 | cin>>element; 164 | list.addNodeAtEnd(element); 165 | list.display(list.getHead()); 166 | 167 | cout<<"Enter element and its position\n"; 168 | cin>>element; 169 | cin>>position; 170 | list.addNodeAtAnyPosition(element,position); 171 | list.display(list.getHead()); 172 | 173 | cout<<"Deleting node at head\n"; 174 | list.deleteNodeAtHead(); 175 | list.display(list.getHead() ); 176 | 177 | cout<<"Deleting node at tail\n"; 178 | list.deleteNodeAtTail(); 179 | list.display(list.getHead() ); 180 | 181 | cout<<"Enter the element position to be deleted\n"; 182 | cin>>position; 183 | list.deleteNodeAtPosition(position); 184 | list.display(list.getHead()); 185 | 186 | cout<<"Enter the element to be searched\n"; 187 | cin>>element; 188 | list.searchAnElement(element); 189 | 190 | cout<<"Reverse display of linked list\n"; 191 | list.reverseDisplay(list.getHead()); 192 | 193 | return 0; 194 | } 195 | -------------------------------------------------------------------------------- /Profiles/DoublyLinkedList.java: -------------------------------------------------------------------------------- 1 | /*============================================================================ 2 | 3 | Title: Implement Doubly Linked List operations 4 | 5 | ============================================================================*/ 6 | 7 | #include 8 | #include 9 | using namespace std; 10 | 11 | class node 12 | { 13 | friend class list; 14 | int data; 15 | node *prev; 16 | node *next; 17 | 18 | public: 19 | node(int d) 20 | { 21 | prev=NULL; 22 | data=d; 23 | next=NULL; 24 | } 25 | 26 | }; 27 | 28 | class list 29 | { 30 | node *head; 31 | 32 | public: 33 | list() 34 | { 35 | head=NULL; 36 | } 37 | void createmember() 38 | { 39 | int data; 40 | char choice; 41 | node *temp,*ptr; 42 | 43 | do 44 | { 45 | 46 | cout<<"Enter data: "; 47 | cin>>data; 48 | 49 | temp= new node(data); 50 | 51 | if(head==NULL) 52 | { 53 | head=temp; 54 | } 55 | else 56 | { 57 | ptr=head; 58 | while(ptr->next!=NULL) 59 | { 60 | ptr=ptr->next; 61 | } 62 | temp->prev=ptr; 63 | ptr->next=temp; 64 | } 65 | cout<<"Node is inserted!"<>choice; 68 | }while(choice=='y'||choice=='Y'); 69 | 70 | } 71 | 72 | void display() 73 | { 74 | 75 | node *ptr; 76 | 77 | if(head==NULL) 78 | { 79 | cout<<"List is empty!"<data<<"\t"; 88 | ptr=ptr->next; 89 | } 90 | cout<data > ptr2->data) 106 | { 107 | if(head==NULL) 108 | { 109 | head=ptr1; 110 | ptr=ptr1; 111 | } 112 | else 113 | { 114 | ptr1->prev=ptr; 115 | ptr->next=ptr1; 116 | ptr=ptr->next; 117 | } 118 | ptr1=ptr1->next; 119 | } 120 | else if(ptr1->data < ptr2->data) 121 | { 122 | if(head==NULL) 123 | { 124 | head=ptr2; 125 | ptr=ptr2; 126 | } 127 | else 128 | { 129 | ptr2->prev=ptr; 130 | ptr->next=ptr2; 131 | ptr=ptr->next; 132 | } 133 | ptr2=ptr2->next; 134 | } 135 | 136 | } 137 | if(ptr1!=NULL) 138 | { 139 | ptr1->prev=ptr; 140 | ptr->next=ptr1; 141 | } 142 | if(ptr2!=NULL) 143 | { 144 | ptr2->prev=ptr; 145 | ptr->next=ptr2; 146 | 147 | } 148 | 149 | display(); 150 | 151 | } 152 | 153 | 154 | }; 155 | 156 | int main() { 157 | 158 | list l1,l2,l3; 159 | int ch; 160 | 161 | cout<<"\n...LIST1..."<>ch; 177 | switch(ch) 178 | { 179 | case 1: 180 | cout<<"\n...LIST1..."<