├── .github └── workflows │ └── greetings.yml ├── Alexa Skills ├── Draw Number │ ├── README.md │ ├── interactionModels │ │ └── custom │ │ │ └── en-US.json │ ├── lambda │ │ ├── index.js │ │ ├── local-debugger.js │ │ ├── logic.js │ │ ├── package.json │ │ └── util.js │ └── skill.json ├── Prajjwal │ ├── interactionModels │ │ └── custom │ │ │ └── hi-IN.json │ └── lambda │ │ ├── index.js │ │ ├── package.json │ │ └── util.js └── README.md ├── Algorithms ├── Bellmann_Ford.java ├── BreadthFirstSearch.java ├── Bridge_in_graph.java ├── BubbleSort.java ├── ComputeNumberOfDivisors.java ├── CountConnectedComponents.java ├── Counting_Inversion.java ├── DES.java ├── DepthFirstSearch.java ├── Dijkstra.java ├── Djikstra Algorithm.cpp ├── HeapSort.java ├── InbuiltBinarySearch.java ├── InterpolationSearch.java ├── LIS.java ├── LowerBoundInJava.java ├── MakeChange.java ├── Prajjwal │ └── EvenPicture.c ├── Prefix_Sum.java ├── README.md ├── Search.java ├── ShortestCommonSupersequence.java ├── Sieve_of_Eratosthenes.java ├── Singly_Linked_List.c ├── TernarySearch.java ├── UpperBoundInJava.java ├── dfs.cpp ├── merge_two_sorted_LL.cpp ├── nqueen.c ├── segmentedsieve.java ├── srivatsav │ └── min_cost_path.py ├── ternary_sort.cpp ├── twopointers.java └── visuals.py ├── Bots ├── README.md ├── instagram bot.ipynb └── silence_us │ ├── README.md │ └── main.py ├── Cryptography ├── .DS_Store ├── 1_initial_migration.js ├── 2_deploy_contracts.js ├── ERC721Mintable.sol ├── Encryptor_Mihir.py ├── Migrations.sol ├── Oraclize.sol ├── README.md ├── SolnSquareVerifier.sol ├── TestERC721Mintable.js ├── TestSolnSquareVerifier.js ├── TestSquareVerifier.js ├── main_Mihir.py ├── package-lock.json ├── package.json ├── testConfig.js ├── truffle-config.js └── verifier.sol ├── Game ├── Adventure_game.py ├── Chrome_Dinosaur_Srinija_Dharani │ ├── README.md │ ├── chrome_dino.ipynb │ ├── chrome_dino.mp4 │ ├── jump_dino.png │ └── rest_dino.png ├── Color Game │ ├── colorGame.css │ ├── colorGame.html │ └── colorGame.js ├── Crossword.ipynb ├── Guessing Game │ └── guessing_game.py ├── Maze Game │ └── maze.html ├── Number Predict │ └── numberPredict.py ├── README.md ├── Rock-Paper-Scissors │ └── rock-paper-scissors.py ├── Snake.ipynb ├── SnakeGame │ ├── README.md │ ├── background.jpg │ ├── draw.js │ ├── fruit.js │ ├── index.html │ ├── script.js │ ├── snake.PNG │ ├── snake.gif │ ├── snake.js │ └── styles.css ├── Sudoku │ └── sudokSolver.cpp └── tic-tac-toe game ├── ML_Projects ├── Arpit Somani │ ├── USA_Housing-Linear Regression │ │ └── USA_Housing-Linear Regression.ipynb │ └── view of model.PNG ├── Customer_journey │ ├── Customer_Journey.ipynb │ └── Readme.md ├── Face-Mask-Detection │ ├── README.md │ ├── Screenshot (36).png │ ├── Screenshot (37).png │ ├── final_face_mask.py │ ├── haarcascade_frontalface_default.xml │ ├── haarcascade_mcs_mouth.xml │ └── truth_table.png ├── Image classification │ └── Image_classification.ipynb ├── Naive-Bayes │ ├── README.md │ ├── SPAM CLASSIFICATION.ipynb │ └── dummy ├── README.md ├── RL model │ ├── Taxi_GYM.ipynb │ └── readme.md.txt ├── boston │ ├── boston.ipynb │ └── housing.csv ├── spam-ml │ ├── Readme.md │ ├── spam.csv │ ├── spam.ipynb │ └── spam.pkl └── titanic project │ ├── __pycache__ │ └── visuals.cpython-38.pyc │ ├── titanic machine learning.ipynb │ ├── titanic.ipynb │ ├── train.csv │ └── visuals.py ├── Programs ├── 230B T-Primes.cpp ├── 3D_array_dynamic.cpp ├── 435A Queue on Bus Stop.cpp ├── A_noun.json ├── Aa_noun.json ├── Aback_adverb.json ├── Abandon.json ├── Airfare_noun.json ├── Aisle_noun.json ├── Ait_noun.json ├── Ajar_adverb.json ├── Anagram.java ├── ArrayDeletion.c ├── ArrayTranspose.c ├── BigInteger.java ├── Binary.py ├── BinarySearch.cpp ├── BinaryToDecimal.cpp ├── Boxes Through a Tunnel.c ├── BubbleSort.java ├── C prog_finding quotient and remainder ├── CIRCLE1.C ├── COVID_info.py ├── Calendar.py ├── Circularlinkedlist.c ├── Convertagivenintegertoyearsmonthsanddays.c ├── CountingSort.java ├── Create_A_BinaryTree_From_PreOrder&InOrder.cpp ├── Decimaltobinary.c ├── Decodings.c ├── Determinant.c ├── DiagonalDifference.java ├── Digital_root.cpp ├── Display_int_Bytes.c ├── Divide array.cpp ├── Doreamon.py ├── Double_ended_queue.c ├── Fibonacci.cpp ├── InsertionSort.cpp ├── Jiteah.c ├── Jitesh1.c ├── MergeSort.java ├── Minimumnoofhandshake.c ├── Palindrome.java ├── Palindromic_Pyramid │ ├── Palindromic_Pyramid.py │ └── Readme.md ├── README.md ├── RadixSort.java ├── RecursiveInsertionSort.c ├── Recursive_Selection_Sort.c ├── Resize_image │ ├── Resize_image.py │ └── single.jpeg ├── RotationOfMatrixBy90Degrees.c ├── Saurabh │ └── fibonacci_sum_last_digit.cpp ├── Simple_Corona_Statistics_Shower │ ├── .ipynb_checkpoints │ │ └── Covid19BD-checkpoint.ipynb │ ├── Covid19BD.ipynb │ ├── README.md │ ├── output2.png │ └── output_scrot.png ├── SmallestLargest.java ├── Spiralmatrix.c ├── Static Convertor.cpp ├── Subset.c ├── SumOfPolynomials.c ├── Systematicpair.c ├── Wave_Array.cpp ├── binary_search.c ├── checkPrime.java ├── circularlinkedlist.c ├── guess_number.py ├── heapsort.py ├── img2pdf │ └── img2pdf.py ├── index.py ├── infixtopostfix.c ├── largestsum ├── linear_multiple.c ├── linear_search.c ├── number guessing ├── pointerBasedMatrixAddition.c ├── port scanner.py ├── python_autoclicker.py ├── python_code_to_read_pdf_as_audio.py ├── quickSort_OOP.cpp ├── satyam.c ├── srivatsav │ └── balanced_brackets.py ├── star_pattern.c ├── star_pattern2.c ├── strangequeries.cpp ├── sumOfDigit.java ├── therc01 │ ├── arrays.c │ ├── readme.md │ ├── search.c │ └── stack.c ├── trailingZerotoFact.cpp └── usingHeapLargestKElementInRunningStreamOfNumbers.cpp ├── Projects ├── Analysis on Air Quality of India project.ipynb ├── Facebook API.ipynb ├── File_Organiser │ ├── main.py │ └── organiser.py ├── Icloud.ipynb ├── README.md ├── Shopping-List-WebApp │ ├── app.js │ ├── index.html │ └── style.css ├── Web_Scraping │ ├── Encryptor.py │ ├── emailer.py │ ├── main.py │ └── requirements.txt ├── digital_clock │ ├── README.md │ ├── android │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ │ ├── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── digital_clock │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── res │ │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ └── values │ │ │ │ │ └── styles.xml │ │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ ├── build.gradle │ │ ├── gradle.properties │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ └── gradle-wrapper.properties │ │ └── settings.gradle │ ├── digital.gif │ ├── digital_dark.png │ ├── digital_light.png │ ├── ios │ │ ├── Flutter │ │ │ ├── AppFrameworkInfo.plist │ │ │ ├── Debug.xcconfig │ │ │ └── Release.xcconfig │ │ ├── Runner.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ ├── Runner.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── Runner │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ │ └── LaunchImage.imageset │ │ │ │ ├── Contents.json │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ └── README.md │ │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── Runner-Bridging-Header.h │ ├── lib │ │ ├── digital_clock.dart │ │ └── main.dart │ ├── pubspec.lock │ ├── pubspec.yaml │ └── third_party │ │ ├── LICENSE │ │ └── PressStart2P-Regular.ttf └── titanic_survival_exploration │ ├── README.md │ ├── Titanic_Survival_Exploration.html │ ├── Titanic_Survival_Exploration.ipynb │ ├── titanic_data.csv │ ├── titanic_visualizations.py │ └── titanic_visualizations.pyc └── README.md /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/first-interaction@v1 10 | with: 11 | repo-token: ${{ secrets.GITHUB_TOKEN }} 12 | issue-message: 'Message that will be displayed on users'' first issue' 13 | pr-message: 'Message that will be displayed on users'' first pr' 14 | -------------------------------------------------------------------------------- /Alexa Skills/Draw Number/README.md: -------------------------------------------------------------------------------- 1 | ## Simple Draw Number Alexa's skill: 2 | This skill draws up to 6 numbers within a minimum range of 10 numbers. 3 | A simple skill, good for learning the basics of skill development for Alexa. 4 | 5 | ### Using the skill: 6 | To trigger the skill you must say "Alexa, open Draw Number" and then say "draw a number from 1 to 10" or "draw 5 numbers from 10 to 50". -------------------------------------------------------------------------------- /Alexa Skills/Draw Number/lambda/logic.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | generateRandomNumbers(qty, start, end){ 3 | let numbers = [] 4 | let number 5 | for(var i = 0; i < qty; i++){ 6 | number = parseInt(Math.floor(Math.random() * (end - start + 1))) + parseInt(start) 7 | if(numbers.includes(number)){ 8 | i-- 9 | } else { 10 | numbers.push(number) 11 | } 12 | } 13 | return numbers; 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /Alexa Skills/Draw Number/lambda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-world", 3 | "version": "1.2.0", 4 | "description": "alexa utility for quickly building skills", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Amazon Alexa", 10 | "license": "Apache License", 11 | "dependencies": { 12 | "ask-sdk-core": "^2.7.0", 13 | "ask-sdk-model": "^1.19.0", 14 | "aws-sdk": "^2.326.0" 15 | } 16 | } -------------------------------------------------------------------------------- /Alexa Skills/Draw Number/lambda/util.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | 3 | const s3SigV4Client = new AWS.S3({ 4 | signatureVersion: 'v4', 5 | region: process.env.S3_PERSISTENCE_REGION 6 | }); 7 | 8 | module.exports.getS3PreSignedUrl = function getS3PreSignedUrl(s3ObjectKey) { 9 | 10 | const bucketName = process.env.S3_PERSISTENCE_BUCKET; 11 | const s3PreSignedUrl = s3SigV4Client.getSignedUrl('getObject', { 12 | Bucket: bucketName, 13 | Key: s3ObjectKey, 14 | Expires: 60*1 // the Expires is capped for 1 minute 15 | }); 16 | console.log(`Util.s3PreSignedUrl: ${s3ObjectKey} URL ${s3PreSignedUrl}`); 17 | return s3PreSignedUrl; 18 | 19 | } -------------------------------------------------------------------------------- /Alexa Skills/Draw Number/skill.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest": { 3 | "apis": { 4 | "custom": { 5 | "endpoint": { 6 | "uri": "arn:aws:lambda:us-east-1:088119403762:function:40977ab2-50e0-446a-b005-8b9233ea127e:Release_0" 7 | }, 8 | "interfaces": [], 9 | "regions": { 10 | "NA": { 11 | "endpoint": { 12 | "uri": "arn:aws:lambda:us-east-1:088119403762:function:40977ab2-50e0-446a-b005-8b9233ea127e:Release_0" 13 | } 14 | }, 15 | "EU": { 16 | "endpoint": { 17 | "uri": "arn:aws:lambda:eu-west-1:088119403762:function:40977ab2-50e0-446a-b005-8b9233ea127e:Release_0" 18 | } 19 | }, 20 | "FE": { 21 | "endpoint": { 22 | "uri": "arn:aws:lambda:us-west-2:088119403762:function:40977ab2-50e0-446a-b005-8b9233ea127e:Release_0" 23 | } 24 | } 25 | } 26 | } 27 | }, 28 | "manifestVersion": "1.0", 29 | "publishingInformation": { 30 | "category": "KNOWLEDGE_AND_TRIVIA", 31 | "distributionCountries": [], 32 | "isAvailableWorldwide": true, 33 | "locales": { 34 | "en-US": { 35 | "description": "Sample Full Description", 36 | "examplePhrases": [ 37 | "Alexa open hello world", 38 | "hello", 39 | "help" 40 | ], 41 | "keywords": [], 42 | "name": "Draw Number", 43 | "summary": "Sample Short Description" 44 | } 45 | }, 46 | "testingInstructions": "Sample Testing Instructions." 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Alexa Skills/Prajjwal/interactionModels/custom/hi-IN.json: -------------------------------------------------------------------------------- 1 | { 2 | "interactionModel": { 3 | "languageModel": { 4 | "invocationName": "मंगलयान facts", 5 | "intents": [ 6 | { 7 | "name": "AMAZON.CancelIntent", 8 | "samples": [] 9 | }, 10 | { 11 | "name": "AMAZON.HelpIntent", 12 | "samples": [] 13 | }, 14 | { 15 | "name": "AMAZON.StopIntent", 16 | "samples": [] 17 | }, 18 | { 19 | "name": "AMAZON.NavigateHomeIntent", 20 | "samples": [] 21 | }, 22 | { 23 | "name": "GetNewFactIntent", 24 | "slots": [], 25 | "samples": [ 26 | "मंगलयान facts", 27 | "मुझे एक fact बताओ ", 28 | "मुझे मंगलयान के बारे में एक fact बताओ", 29 | "मुझे मंगलयान के बारे में एक बताओ", 30 | "मंगलयान के बारे में बताओ", 31 | "मंगलयान" 32 | ] 33 | } 34 | ], 35 | "types": [] 36 | } 37 | }, 38 | "version": "2" 39 | } -------------------------------------------------------------------------------- /Alexa Skills/Prajjwal/lambda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-world", 3 | "version": "1.1.0", 4 | "description": "alexa utility for quickly building skills", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Amazon Alexa", 10 | "license": "ISC", 11 | "dependencies": { 12 | "ask-sdk-core": "^2.6.0", 13 | "ask-sdk-model": "^1.18.0", 14 | "aws-sdk": "^2.326.0" 15 | } 16 | } -------------------------------------------------------------------------------- /Alexa Skills/Prajjwal/lambda/util.js: -------------------------------------------------------------------------------- 1 | const AWS = require('aws-sdk'); 2 | 3 | const s3SigV4Client = new AWS.S3({ 4 | signatureVersion: 'v4' 5 | }); 6 | 7 | module.exports.getS3PreSignedUrl = function getS3PreSignedUrl(s3ObjectKey) { 8 | 9 | const bucketName = process.env.S3_PERSISTENCE_BUCKET; 10 | const s3PreSignedUrl = s3SigV4Client.getSignedUrl('getObject', { 11 | Bucket: bucketName, 12 | Key: s3ObjectKey, 13 | Expires: 60*1 // the Expires is capped for 1 minute 14 | }); 15 | console.log(`Util.s3PreSignedUrl: ${s3ObjectKey} URL ${s3PreSignedUrl}`); 16 | return s3PreSignedUrl; 17 | 18 | } -------------------------------------------------------------------------------- /Alexa Skills/README.md: -------------------------------------------------------------------------------- 1 | ### Following are the steps to add your Alexa Skills to this Repository: 2 | - Go to your Alexa Developer Console. 3 | - Select/Open your already created Skill from the list of skills. 4 | - Now go to the Code tab. 5 | - On the top-left corner, click Download Skill. 6 | - Once Downloaded, Extract the contents. 7 | - You will now have a folder within which following files/folders will be there: 8 | - interactionModels 9 | - lambda 10 | - skill.json 11 | - We will come back to this folder in a while. 12 | - Now FORK this Repository. 13 | - Clone the forked repo at your local PC using git clone . 14 | - Browse to the location where repository got cloned at your system. 15 | - Then go inside the Alexa skills folder and Create a New Folder with your name. 16 | - Now inside that folder Copy and Paste the two folder that we downloaded. (Namely interactionModels and lambda). skill.json is NOT to be copied. 17 | - Create an additional file (.txt or .md) to briefly describe the functioning of your skill. 18 | - Add, commit and Push the Changes using the usual Git commands (Not Sure? See Git/GitHub Basics on YouTube). 19 | - Now open the forked repository on GitHub, where you will notice a Pull Request Button. 20 | - Click on it and Make A Pull Request and you are DONE!. 21 | #### Congratulations you added your Alexa Skill!! 22 | -------------------------------------------------------------------------------- /Algorithms/BreadthFirstSearch.java: -------------------------------------------------------------------------------- 1 | import java.util.Iterator; 2 | import java.util.LinkedList; 3 | import java.util.Queue; 4 | 5 | public class BreadthFirstSearch { 6 | public static void main(String args[]) 7 | { 8 | Graph g = new Graph(4); 9 | 10 | g.addEdge(0, 1); 11 | g.addEdge(0, 2); 12 | g.addEdge(1, 2); 13 | g.addEdge(2, 0); 14 | g.addEdge(2, 3); 15 | g.addEdge(3, 3); 16 | 17 | g.BFS(2); 18 | } 19 | } 20 | 21 | 22 | class Graph { 23 | private int numVertices; 24 | private LinkedList adj[]; 25 | private boolean[] visited; 26 | private Queue queue; 27 | 28 | public Graph(int vertices) { 29 | numVertices = vertices; 30 | adj = new LinkedList[vertices]; 31 | visited = new boolean[vertices]; 32 | queue = new LinkedList<>(); 33 | 34 | for (int i = 0; i < vertices; i++) 35 | adj[i] = new LinkedList(); 36 | } 37 | 38 | void addEdge(int src, int dest) { 39 | adj[src].add(dest); 40 | } 41 | 42 | void BFS(int vertex) { 43 | queue.clear(); 44 | queue.add(vertex); 45 | visited[vertex] = true; 46 | while(!queue.isEmpty()) { 47 | vertex = queue.poll(); 48 | System.out.print(vertex + " "); 49 | Iterator ite = adj[vertex].listIterator(); 50 | while (ite.hasNext()) { 51 | int adj = (int) ite.next(); 52 | if (!visited[adj]) { 53 | visited[adj] = true; 54 | queue.add(adj); 55 | } 56 | } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Algorithms/BubbleSort.java: -------------------------------------------------------------------------------- 1 | public class BubbleSortExample { 2 | static void bubbleSort(int[] arr) { 3 | int n = arr.length; 4 | int temp = 0; 5 | for(int i=0; i < n; i++){ 6 | for(int j=1; j < (n-i); j++){ 7 | if(arr[j-1] > arr[j]){ 8 | //swap elements 9 | temp = arr[j-1]; 10 | arr[j-1] = arr[j]; 11 | arr[j] = temp; 12 | } 13 | 14 | } 15 | } 16 | 17 | } 18 | public static void main(String[] args) { 19 | int arr[] ={3,60,35,2,45,320,5}; 20 | 21 | System.out.println("Array Before Bubble Sort"); 22 | for(int i=0; i < arr.length; i++){ 23 | System.out.print(arr[i] + " "); 24 | } 25 | System.out.println(); 26 | 27 | bubbleSort(arr);//sorting array elements using bubble sort 28 | 29 | System.out.println("Array After Bubble Sort"); 30 | for(int i=0; i < arr.length; i++){ 31 | System.out.print(arr[i] + " "); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Algorithms/ComputeNumberOfDivisors.java: -------------------------------------------------------------------------------- 1 | class ComputeNumberOfDivisors { 2 | 3 | // Method to find prime numbers 4 | static void SieveOfEratosthenes(int n, boolean prime[]) { 5 | for (int p = 2; p * p <= n; p++) { 6 | if (prime[p] == true) { 7 | for (int i = p * 2; i <= n; i += p) 8 | prime[i] = false; 9 | } 10 | } 11 | } 12 | 13 | // Method to count divisors 14 | static int countDivisors(int n) { 15 | if (n == 1) { 16 | return 1; 17 | } 18 | boolean prime[] = new boolean[n + 1]; 19 | boolean primeSquare[] = new boolean[(n * n) + 1]; 20 | int a[] = new int[n]; 21 | 22 | prime[1] = false; 23 | for (int i = 2; i <= n; i++) { 24 | prime[i] = true; 25 | } 26 | 27 | SieveOfEratosthenes(n, prime); 28 | int j = 0; 29 | for (int p = 2; p <= n; p++) { 30 | if (prime[p]) { 31 | a[j] = p; 32 | primeSquare[p * p] = true; 33 | j++; 34 | } 35 | } 36 | int ans = 1; 37 | for (int i = 0;; i++) { 38 | if (n < a[i] * a[i] * a[i]) { 39 | break; 40 | } 41 | int cnt = 1; 42 | while (n % a[i] == 0) { 43 | n = n / a[i]; 44 | cnt = cnt + 1; 45 | } 46 | ans = ans * cnt; 47 | } 48 | if (prime[n]) { 49 | ans = ans * 2; 50 | } else if (primeSquare[n]) { 51 | ans = ans * 3; 52 | } else if (n != 1) { 53 | ans = ans * 4; 54 | } 55 | 56 | return ans; 57 | } 58 | 59 | public static void main(String[] args) { 60 | int x = 100; 61 | System.out.println("Total number of divisors of " + x + " are " + countDivisors(x)); 62 | } 63 | } 64 | 65 | // Time Complexity : O( n ^ (1/3) ) -------------------------------------------------------------------------------- /Algorithms/CountConnectedComponents.java: -------------------------------------------------------------------------------- 1 | import java.util.Iterator; 2 | import java.util.LinkedList; 3 | 4 | public class CountConnectedComponents { 5 | public static void main(String args[]) 6 | { 7 | Graph g = new Graph(9); 8 | 9 | // connected 10 | g.addEdge(0, 1); 11 | g.addEdge(0, 2); 12 | g.addEdge(1, 2); 13 | g.addEdge(2, 0); 14 | g.addEdge(2, 3); 15 | g.addEdge(3, 3); 16 | 17 | // 4 is self connected 18 | 19 | // connected 20 | g.addEdge(6, 5); 21 | g.addEdge(7, 5); 22 | g.addEdge(5, 8); 23 | 24 | System.out.println("Number of connected graphs: " + g.count()); 25 | } 26 | } 27 | 28 | 29 | class Graph { 30 | private int numVertices; 31 | private LinkedList adj[]; 32 | private boolean visited[]; 33 | 34 | public Graph(int vertices) { 35 | numVertices = vertices; 36 | adj = new LinkedList[vertices]; 37 | 38 | for (int i = 0; i < vertices; i++) 39 | adj[i] = new LinkedList(); 40 | } 41 | 42 | void addEdge(int src, int dest) { 43 | // change the directed graph to undirected graph 44 | if (src != dest) { 45 | adj[src].add(dest); 46 | adj[dest].add(src); 47 | } 48 | } 49 | 50 | int count() { 51 | int ret = 0; 52 | visited = new boolean[numVertices]; 53 | for (int i = 0; i < numVertices; ++i) { 54 | if(!visited[i]) { 55 | DFS(i); 56 | ++ret; 57 | } 58 | } 59 | return ret; 60 | } 61 | 62 | void DFS(int vertex) { 63 | visited[vertex] = true; 64 | Iterator ite = adj[vertex].listIterator(); 65 | while (ite.hasNext()) { 66 | int adj = (int) ite.next(); 67 | if (!visited[adj]) 68 | DFS(adj); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Algorithms/Counting_Inversion.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class GFG { 4 | 5 | // Function to count the number of inversions 6 | // during the merge process 7 | private static int mergeAndCount(int[] arr, int l, int m, int r) 8 | { 9 | 10 | // Left subarray 11 | int[] left = Arrays.copyOfRange(arr, l, m + 1); 12 | 13 | // Right subarray 14 | int[] right = Arrays.copyOfRange(arr, m + 1, r + 1); 15 | 16 | int i = 0, j = 0, k = l, swaps = 0; 17 | 18 | while (i < left.length && j < right.length) { 19 | if (left[i] <= right[j]) 20 | arr[k++] = left[i++]; 21 | else { 22 | arr[k++] = right[j++]; 23 | swaps += (m + 1) - (l + i); 24 | } 25 | } 26 | 27 | // Fill from the rest of the left subarray 28 | while (i < left.length) 29 | arr[k++] = left[i++]; 30 | 31 | // Fill from the rest of the right subarray 32 | while (j < right.length) 33 | arr[k++] = right[j++]; 34 | 35 | return swaps; 36 | } 37 | 38 | // Merge sort function 39 | private static int mergeSortAndCount(int[] arr, int l, int r) 40 | { 41 | 42 | // Keeps track of the inversion count at a 43 | // particular node of the recursion tree 44 | int count = 0; 45 | 46 | if (l < r) { 47 | int m = (l + r) / 2; 48 | 49 | // Total inversion count = left subarray count 50 | // + right subarray count + merge count 51 | 52 | // Left subarray count 53 | count += mergeSortAndCount(arr, l, m); 54 | 55 | // Right subarray count 56 | count += mergeSortAndCount(arr, m + 1, r); 57 | 58 | // Merge count 59 | count += mergeAndCount(arr, l, m, r); 60 | } 61 | 62 | return count; 63 | } 64 | 65 | // Driver code 66 | public static void main(String[] args) 67 | { 68 | int[] arr = { 1, 20, 6, 4, 5 }; 69 | 70 | System.out.println(mergeSortAndCount(arr, 0, arr.length - 1)); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Algorithms/DepthFirstSearch.java: -------------------------------------------------------------------------------- 1 | package Algorithms; 2 | 3 | import java.util.Iterator; 4 | import java.util.LinkedList; 5 | 6 | public class DepthFirstSearch { 7 | public static void main(String args[]) 8 | { 9 | Graph g = new Graph(4); 10 | 11 | g.addEdge(0, 1); 12 | g.addEdge(0, 2); 13 | g.addEdge(1, 2); 14 | g.addEdge(2, 0); 15 | g.addEdge(2, 3); 16 | g.addEdge(3, 3); 17 | 18 | g.DFS(2); 19 | } 20 | } 21 | 22 | 23 | class Graph { 24 | private int numVertices; 25 | private LinkedList adj[]; 26 | private boolean visited[]; 27 | 28 | public Graph(int vertices) { 29 | numVertices = vertices; 30 | adj = new LinkedList[vertices]; 31 | visited = new boolean[vertices]; 32 | 33 | for (int i = 0; i < vertices; i++) 34 | adj[i] = new LinkedList(); 35 | } 36 | 37 | void addEdge(int src, int dest) { 38 | adj[src].add(dest); 39 | } 40 | 41 | void DFS(int vertex) { 42 | visited[vertex] = true; 43 | System.out.print(vertex + " "); 44 | 45 | Iterator ite = adj[vertex].listIterator(); 46 | while (ite.hasNext()) { 47 | int adj = (int) ite.next(); 48 | if (!visited[adj]) 49 | DFS(adj); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Algorithms/Djikstra Algorithm.cpp: -------------------------------------------------------------------------------- 1 | //The idea is to use dp in previously calculated distance and greedy approach in calculating city nearest ot given city 2 | //The number of not yet finalised vertices changes everytime so we use min heap to extract minimum at each level and update easily 3 | #include 4 | using namespace std; 5 | 6 | vector dijkstra(vector> , int ,int ); 7 | 8 | int printSolution(vector dist, int n) 9 | { 10 | 11 | for (int i = 0; i < n; i++) 12 | printf("%d ", dist[i]); 13 | 14 | } 15 | int main() 16 | { 17 | int t; 18 | int V; 19 | cin>>t; 20 | while(t--){ 21 | cin>>V; 22 | 23 | vector> g(V); 24 | 25 | for(int i = 0;i temp(V); 27 | g[i] = temp; 28 | } 29 | 30 | for(int i=0;i>g[i][j]; 35 | } 36 | } 37 | 38 | int s; 39 | cin>>s; 40 | 41 | vector res = dijkstra(g, s, V); 42 | printSolution (res, V); 43 | cout< &p1,const pair &p2) 57 | { 58 | return p1.first dijkstra(vector> g, int src, int V) 62 | { 63 | vectorans(V); 64 | priority_queue,vector>,greater>>pq; 65 | 66 | //visited array is created to keep a track of the elements already included in MSP 67 | int visited[V+1]={0}; 68 | ans[src]=0; 69 | for(int i=0;ians[ver]+g[ver][x]) 86 | { 87 | ans[x]=ans[ver]+g[ver][x]; 88 | pq.push({ans[x],x}); 89 | } 90 | } 91 | 92 | } 93 | return ans; 94 | // Your code here 95 | } 96 | -------------------------------------------------------------------------------- /Algorithms/HeapSort.java: -------------------------------------------------------------------------------- 1 | // Java program for implementation of Heap Sort 2 | public class HeapSort 3 | { 4 | public void sort(int arr[]) 5 | { 6 | int n = arr.length; 7 | 8 | // Build heap (rearrange array) 9 | for (int i = n / 2 - 1; i >= 0; i--) 10 | heapify(arr, n, i); 11 | 12 | // One by one extract an element from heap 13 | for (int i=n-1; i>=0; i--) 14 | { 15 | // Move current root to end 16 | int temp = arr[0]; 17 | arr[0] = arr[i]; 18 | arr[i] = temp; 19 | 20 | // call max heapify on the reduced heap 21 | heapify(arr, i, 0); 22 | } 23 | } 24 | 25 | // To heapify a subtree rooted with node i which is 26 | // an index in arr[]. n is size of heap 27 | void heapify(int arr[], int n, int i) 28 | { 29 | int largest = i; // Initialize largest as root 30 | int l = 2*i + 1; // left = 2*i + 1 31 | int r = 2*i + 2; // right = 2*i + 2 32 | 33 | // If left child is larger than root 34 | if (l < n && arr[l] > arr[largest]) 35 | largest = l; 36 | 37 | // If right child is larger than largest so far 38 | if (r < n && arr[r] > arr[largest]) 39 | largest = r; 40 | 41 | // If largest is not root 42 | if (largest != i) 43 | { 44 | int swap = arr[i]; 45 | arr[i] = arr[largest]; 46 | arr[largest] = swap; 47 | 48 | // Recursively heapify the affected sub-tree 49 | heapify(arr, n, largest); 50 | } 51 | } 52 | 53 | /* A utility function to print array of size n */ 54 | static void printArray(int arr[]) 55 | { 56 | int n = arr.length; 57 | for (int i=0; i= 0) 17 | System.out.println(key + " found at index = " 18 | + res); 19 | else 20 | System.out.println(key + " Not found"); 21 | 22 | key = 40; 23 | res = Arrays.binarySearch(arr, key); 24 | if (res >= 0) 25 | System.out.println(key + " found at index = " 26 | + res); 27 | else 28 | System.out.println(key + " Not found"); 29 | } 30 | } 31 | 32 | // Collections.binarysearch() : Works for objects Collections like ArrayList and LinkedList. 33 | 34 | // Java program to demonstrate working of Collections. 35 | // binarySearch() 36 | import java.util.List; 37 | import java.util.ArrayList; 38 | import java.util.Collections; 39 | 40 | public class BinarySearch 41 | { 42 | public static void main(String[] args) 43 | { 44 | List al = new ArrayList(); 45 | al.add(1); 46 | al.add(2); 47 | al.add(3); 48 | al.add(10); 49 | al.add(20); 50 | 51 | // 10 is present at index 3. 52 | int key = 10; 53 | int res = Collections.binarySearch(al, key); 54 | if (res >= 0) 55 | System.out.println(key + " found at index = " 56 | + res); 57 | else 58 | System.out.println(key + " Not found"); 59 | 60 | key = 15; 61 | res = Collections.binarySearch(al, key); 62 | if (res >= 0) 63 | System.out.println(key + " found at index = " 64 | + res); 65 | else 66 | System.out.println(key + " Not found"); 67 | } 68 | } 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /Algorithms/InterpolationSearch.java: -------------------------------------------------------------------------------- 1 | class Test 2 | { 3 | // Array of items on which search will 4 | // be conducted. 5 | static int arr[] = new int[]{10, 12, 13, 16, 18, 19, 20, 21, 22, 23, 6 | 24, 33, 35, 42, 47}; 7 | 8 | // If x is present in arr[0..n-1], then returns 9 | // index of it, else returns -1. 10 | static int interpolationSearch(int x) 11 | { 12 | // Find indexes of two corners 13 | int lo = 0, hi = (arr.length - 1); 14 | 15 | // Since array is sorted, an element present 16 | // in array must be in range defined by corner 17 | while (lo <= hi && x >= arr[lo] && x <= arr[hi]) 18 | { 19 | 20 | if (lo == hi) 21 | { 22 | if (arr[lo] == x) return lo; 23 | return -1; 24 | } 25 | 26 | // Probing the position with keeping 27 | // uniform distribution in mind. 28 | 29 | int pos = lo + (((hi-lo) / 30 | (arr[hi]-arr[lo]))*(x - arr[lo])); 31 | 32 | // Condition of target found 33 | if (arr[pos] == x) 34 | return pos; 35 | 36 | // If x is larger, x is in upper part 37 | if (arr[pos] < x) 38 | lo = pos + 1; 39 | 40 | // If x is smaller, x is in the lower part 41 | else 42 | hi = pos - 1; 43 | } 44 | return -1; 45 | } 46 | 47 | // Driver method 48 | public static void main(String[] args) 49 | { 50 | int x = 18; // Element to be searched 51 | int index = interpolationSearch(x); 52 | 53 | // If element was found 54 | if (index != -1) 55 | System.out.println("Element found at index " + index); 56 | else 57 | System.out.println("Element not found."); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Algorithms/LIS.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.List; 3 | 4 | public class LIS { 5 | public static int lowerBound(List a, int low, int high, int element){ 6 | while(low < high){ 7 | int middle = low + (high - low)/2; 8 | if(element > a.get(middle)) 9 | low = middle + 1; 10 | else 11 | high = middle; 12 | } 13 | return low; 14 | } 15 | 16 | public static int upperBound(List a, int low, int high, int element){ 17 | while(low < high){ 18 | int middle = low + (high - low)/2; 19 | if(a.get(middle) > element) 20 | high = middle; 21 | else 22 | low = middle + 1; 23 | } 24 | return low; 25 | } 26 | 27 | public static int longestIncreasingSubsequence(List a){ 28 | //equals included then upperbound 29 | // else lower bound use as required 30 | ArrayList ans = new ArrayList<>(); 31 | for(int i=0;ians.size()){ 34 | ans.add(a.get(i)); 35 | } 36 | else 37 | ans.set(x,a.get(i)); 38 | } 39 | return ans.size(); 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /Algorithms/LowerBoundInJava.java: -------------------------------------------------------------------------------- 1 | public class Just_Smaller_Binary_Search { 2 | 3 | // implementation of lower bound as in C++ in Java 4 | 5 | static int findJustSmaller(int inp[],int low,int high,int x){ 6 | 7 | // iterative binary search used in implementation 8 | 9 | int ans = -1; 10 | 11 | while(low<=high){ 12 | 13 | int mid = (low+high)/2; 14 | 15 | if(inp[mid]>=x){ 16 | 17 | high = mid-1; 18 | 19 | }else{ 20 | 21 | ans = mid; 22 | low = mid+1; 23 | 24 | } 25 | } 26 | 27 | return ans; 28 | 29 | } 30 | 31 | public static void main(String[] args) { 32 | 33 | // array already sorted 34 | 35 | int inp[] = {4,5,5,5,7,8,11,12,15,17}; 36 | 37 | /* index i will contain the index of element in inp 38 | array which is just smaller than 7*/ 39 | 40 | int i = findJustSmaller(inp,0,inp.length-1,7); 41 | 42 | // -1 implies no such element exsists in inp array 43 | 44 | if(i!=-1) 45 | System.out.println(i+" "+inp[i]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Algorithms/Prajjwal/EvenPicture.c: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | using ll = long long; 4 | using ld = long double; 5 | 6 | ll power(ll x, ll y); 7 | #define repp(I, A, B) for(int I = A; I <= B; I++) 8 | #define rep(I, A, B) for(int I = A; I < B; I++) 9 | #define rrep(I, B, A) for(int I = B; I >= A; I--) 10 | #define pb emplace 11 | #define ff first 12 | #define ss second 13 | #define all(v) v.begin(),v.end() 14 | #define rall(v) v.rbegin(),v.rend() 15 | #define LB lower_bound 16 | #define UB upper_bound 17 | #define MP make_pair 18 | #define mem(A, B) memset(A, B, sizeof(A)); 19 | #define mem0(A) memset(A, 0, sizeof(A)); 20 | #define quickio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); 21 | #define debug(this) cerr<<"> "<<#this<<" : "<> A >> B; v[A].pb(B), v[B].pb(A);} 24 | #define in_edges2(M) repp(I, 1, M){ll A, B; cin >> A >> B; v[A].pb(B);} 25 | #define endl "\n" 26 | 27 | const ll MOD = 1000000007; 28 | 29 | int main() //PointBlank's code ¯\_(ツ)_/¯ 30 | { 31 | int n; 32 | cin >> n; 33 | n++; 34 | set > res; 35 | 36 | repp(i, 0, 2*n){ 37 | res.pb(2, i); 38 | if(i % 2 == 0) res.pb(1, i), res.pb(0, i); 39 | else{ 40 | if(((i - 1)/2) % 2 == 0) res.pb(0, i); 41 | } 42 | } 43 | 44 | repp(i, 2, 2*n){ 45 | if(i % 2 == 0) res.pb(3, i), res.pb(4, i); 46 | else{ 47 | if(((i + 1)/2) % 2 == 0) res.pb(4, i); 48 | } 49 | 50 | } 51 | 52 | n--; 53 | if(n & 1){ 54 | res.erase(make_pair(0, 4 + (n-1)*2)); 55 | res.erase(MP(1, 4 + (n-1)*2)); 56 | }else{ 57 | res.erase(MP(3, 4 + (n-1)*2)); 58 | res.erase(MP(4, 4 + (n-1)*2)); 59 | } 60 | cout << res.size() << endl; 61 | for(auto i: res) cout << i.ff << " " << i.ss << endl; 62 | } 63 | 64 | ll power(ll x, ll y) 65 | { 66 | ll res = 1; x %= MOD; 67 | while(y > 0){if(y & 1) res = (res*x) % MOD; y = y>>1, x = (x*x) % MOD;} 68 | return res; 69 | } 70 | -------------------------------------------------------------------------------- /Algorithms/Prefix_Sum.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Prefix_Sum { 4 | public static void main(String[] args) { 5 | 6 | Scanner fs = new Scanner(System.in); 7 | 8 | List list = new ArrayList<>(); 9 | 10 | System.out.println("Enter 5 integer elements separated by spaces to be added in the list"); 11 | 12 | for(int i=0 ; i<5 ; i++){ 13 | int inp = fs.nextInt(); 14 | list.add(inp); 15 | } 16 | 17 | List prefixSumList = new ArrayList<>(); 18 | 19 | for(int i=0 ; i<5 ; i++){ 20 | if(i==0){ 21 | 22 | /* first element of list is first element of prefix sum 23 | list as there is no previous sum before it */ 24 | 25 | prefixSumList.add(list.get(0)); 26 | 27 | }else{ 28 | 29 | /* Variable name used are self explanatory to 30 | the idea of prefix sum array 31 | */ 32 | 33 | int currentValue = list.get(i); 34 | int previousSum = prefixSumList.get(i-1); 35 | 36 | int currentSum = currentValue + previousSum; 37 | 38 | // currentSum is the running sun till index i 39 | 40 | prefixSumList.add(currentSum); 41 | 42 | } 43 | } 44 | 45 | System.out.println("Printing the prefix sum for given input :- "); 46 | 47 | for(int i=0 ; i<5 ; i++){ 48 | System.out.print(prefixSumList.get(i)+" "); 49 | } 50 | 51 | 52 | 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Algorithms/README.md: -------------------------------------------------------------------------------- 1 | ### Following are the steps to add your ALgorithms to this Repository: 2 | - Now FORK this Repository. 3 | - Clone the forked repo at your local PC using git clone . 4 | - Browse to the location where repository got cloned at your system. 5 | - Then go inside the Algorithms folder and Create a New Folder with your name. 6 | - Now inside that folder and paste your Algorithm code here. 7 | - Add, commit and Push the Changes using the usual Git commands (Not Sure? See Git/GitHub Basics on YouTube). 8 | - Now open the forked repository on GitHub, where you will notice a Pull Request Button. 9 | - Click on it and Make A Pull Request and you are DONE!. 10 | #### Congratulations you have added your algorithm code.🥳 11 | 12 | ##
Note:-
13 | 14 | ##### 1. Don't copy the code from anywhere on the net. 15 | ##### 3. Deadline is 31st October. 16 | ##### 4. We will personally check each code and if I find any code not following the rules, then his/her Pull Request will be marked as SPAM and it won't be counted.😥 17 | ## 18 | 19 | -------------------------------------------------------------------------------- /Algorithms/Search.java: -------------------------------------------------------------------------------- 1 | //LINEAR SEARCH 2 | 3 | class LinearSearch { 4 | // This function returns index of element x in arr[] 5 | static int search(int arr[], int n, int x) 6 | { 7 | for (int i = 0; i < n; i++) { 8 | // Return the index of the element if the element 9 | // is found 10 | if (arr[i] == x) 11 | return i; 12 | } 13 | 14 | // return -1 if the element is not found 15 | return -1; 16 | } 17 | 18 | public static void main(String[] args) 19 | { 20 | int[] arr = { 3, 4, 1, 7, 5 }; 21 | int n = arr.length; 22 | 23 | int x = 4; 24 | 25 | int index = search(arr, n, x); 26 | if (index == -1) 27 | System.out.println("Element is not present in the array"); 28 | else 29 | System.out.println("Element found at position " + index); 30 | } 31 | } 32 | 33 | 34 | //BINARY SEARCH 35 | 36 | class BinarySearch { 37 | // Returns index of x if it is present in arr[l.. 38 | // r], else return -1 39 | int binarySearch(int arr[], int l, int r, int x) 40 | { 41 | if (r >= l) { 42 | int mid = l + (r - l) / 2; 43 | 44 | // If the element is present at the 45 | // middle itself 46 | if (arr[mid] == x) 47 | return mid; 48 | 49 | // If element is smaller than mid, then 50 | // it can only be present in left subarray 51 | if (arr[mid] > x) 52 | return binarySearch(arr, l, mid - 1, x); 53 | 54 | // Else the element can only be present 55 | // in right subarray 56 | return binarySearch(arr, mid + 1, r, x); 57 | } 58 | 59 | // We reach here when element is not present 60 | // in array 61 | return -1; 62 | } 63 | 64 | 65 | public static void main(String args[]) 66 | { 67 | BinarySearch ob = new BinarySearch(); 68 | int arr[] = { 2, 3, 4, 10, 40 }; 69 | int n = arr.length; 70 | int x = 10; 71 | int result = ob.binarySearch(arr, 0, n - 1, x); 72 | if (result == -1) 73 | System.out.println("Element not present"); 74 | else 75 | System.out.println("Element found at index " + result); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Algorithms/Sieve_of_Eratosthenes.java: -------------------------------------------------------------------------------- 1 | class SieveOfEratosthenes 2 | { 3 | void sieveOfEratosthenes(int n) 4 | { 5 | // Create a boolean array "prime[0..n]" and initialize 6 | // all entries it as true. A value in prime[i] will 7 | // finally be false if i is Not a prime, else true. 8 | boolean prime[] = new boolean[n+1]; 9 | for(int i=0;i array[mid2]) { 30 | 31 | // The key lies in between mid2 and r 32 | l = mid2 + 1; 33 | } 34 | else { 35 | 36 | // The key lies in between mid1 and mid2 37 | l = mid1 + 1; 38 | r = mid2 - 1; 39 | } 40 | } 41 | 42 | // Key not found 43 | return -1; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Algorithms/UpperBoundInJava.java: -------------------------------------------------------------------------------- 1 | public class Just_Greater_Binary_Search { 2 | 3 | // implementation of upper bound method as in C++ in Java using iterative binary search 4 | 5 | static int findJustGreater(int inp[],int low ,int high,int x){ 6 | 7 | // doesn't handle equals to case , which is more often than not required 8 | 9 | // iterative binary search 10 | 11 | int mid ; 12 | int ans = -1 ; 13 | while(low<=high){ 14 | mid = (low+high)/2 ; 15 | 16 | if(inp[mid]<=x){ 17 | 18 | low = mid+1; 19 | 20 | }else{ 21 | 22 | ans = mid; 23 | high = mid - 1; 24 | 25 | } 26 | 27 | } 28 | 29 | return ans; 30 | 31 | } 32 | 33 | public static void main(String[] args) { 34 | 35 | // already sorted input array 36 | int inp[] = {4,5,5,5,7,8,11,12,15,17}; 37 | 38 | /* i will contain the index ofjust greater element than 39 | 11 in inp array (similar to upper bound in C++) 40 | */ 41 | 42 | int i = findJustGreater(inp,0,inp.length-1,11); 43 | 44 | // -1 implies no element greater than 11 in our inp array 45 | 46 | if(i!=-1) 47 | System.out.println(i+" "+inp[i]); 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Algorithms/dfs.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | /*each first line of input has n node and m edges 6 | corresponding m lines contain node edge relation and llast line contains the head node 7 | */ 8 | // this program prints a single integer denoting the number of nodes that are unreachable from the given head node 9 | 10 | 11 | vector g[100005]; 12 | bool visited[100005]; 13 | 14 | int c=0; 15 | 16 | 17 | void initialize() 18 | { 19 | for(int i = 0; i<100005; i++){ 20 | visited[i] = false; 21 | } 22 | } 23 | 24 | void dfs(int a) 25 | { 26 | visited[a] = true; 27 | c++; 28 | int x = g[a].size(); 29 | for(int i = 0; i < x; i++) 30 | { 31 | int x1 = g[a][i]; 32 | if(visited[x1] == false){ 33 | dfs(x1); 34 | } 35 | } 36 | } 37 | 38 | 39 | 40 | int main() 41 | { 42 | int n, m; 43 | cin>>n>>m; 44 | for(int i = 0; i < m; i++) 45 | { 46 | int a,b; 47 | cin>>a>>b; 48 | g[a].push_back(b); 49 | g[b].push_back(a); 50 | } 51 | int x; 52 | cin>>x; 53 | initialize(); 54 | dfs(x); 55 | 56 | cout< 2 | using namespace std; 3 | 4 | class node 5 | { 6 | public: 7 | int data; 8 | node* next; 9 | 10 | node(int d) 11 | { 12 | data=d; 13 | next=NULL; 14 | 15 | } 16 | }; 17 | void insertionAtTail(node*&head,node*&tail,int data) 18 | { 19 | if(head==NULL) 20 | { 21 | node* n=new node(data); 22 | head=tail=n; 23 | } 24 | else 25 | { 26 | node* n=new node(data); 27 | tail->next=n; 28 | tail=n; 29 | } 30 | } 31 | void addList1(node*&head1,node*&tail1,int n) 32 | { 33 | int data; 34 | while(n--) 35 | { 36 | cin>>data; 37 | insertionAtTail(head1,tail1,data); 38 | } 39 | 40 | } 41 | void addList2(node*&head2,node*&tail2,int m) 42 | { 43 | int data; 44 | while(m--) 45 | { 46 | cin>>data; 47 | insertionAtTail(head2,tail2,data); 48 | } 49 | 50 | } 51 | node* merge(node* head1,node* head2) 52 | { 53 | if(head1==NULL) 54 | { 55 | return head2; 56 | } 57 | else if(head2==NULL) 58 | { 59 | return head1; 60 | } 61 | 62 | node* c; 63 | if(head1->datadata) 64 | { 65 | c=head1; 66 | c->next=merge(head1->next,head2); 67 | } 68 | else 69 | { 70 | 71 | c=head2; 72 | c->next=merge(head1,head2->next); 73 | 74 | } 75 | return c; 76 | 77 | } 78 | void print(node* head) 79 | { 80 | while(head!=NULL) 81 | { 82 | cout<data<<" "; 83 | head=head->next; 84 | } 85 | 86 | } 87 | 88 | 89 | int main() 90 | { 91 | 92 | node* head1=NULL; 93 | node* tail1=NULL; 94 | node* head2=NULL; 95 | node* tail2=NULL; 96 | int t; 97 | cin>>t; 98 | while(t--) 99 | { 100 | int n,m; 101 | cin>>n; 102 | addList1(head1,tail1,n); 103 | cin>>m; 104 | addList2(head2,tail2,m); 105 | 106 | node* head=merge(head1,head2); 107 | print(head); 108 | 109 | } 110 | return 0; 111 | } 112 | -------------------------------------------------------------------------------- /Algorithms/nqueen.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int x[20], c = 0; 4 | 5 | void print(int n, int c) 6 | { 7 | int i, j; 8 | printf("\n\nSolution %d\n", c); 9 | for(i=1; i<=n; i++) 10 | { 11 | for(j=1; j<=n; j++) 12 | { 13 | if(x[i] == j) 14 | printf("\tQ"); 15 | else 16 | printf("\t-"); 17 | } 18 | printf("\n\n"); 19 | } 20 | } 21 | 22 | int place(int k, int i) 23 | //k : Queen no 24 | //i : the proposed column 25 | { 26 | int j; 27 | for(j=1; j<=k-1; j++) 28 | { 29 | if(x[j] == i) 30 | return 0; 31 | else 32 | if(abs(x[j]-i) == abs(j-k)) 33 | return 0; 34 | } 35 | return 1; 36 | } 37 | 38 | void nqueen(int k, int n) 39 | { 40 | int i; 41 | for(i=1; i<=n; i++) 42 | { 43 | if(place(k, i)) 44 | { 45 | x[k] = i; 46 | if(k == n) 47 | { 48 | print(n, ++c); 49 | } 50 | else 51 | nqueen(k+1, n); 52 | } 53 | } 54 | } 55 | 56 | int main() 57 | { 58 | int n; 59 | printf("\nPlease enter the total number of queens\n"); 60 | scanf("%d", &n); 61 | nqueen(1, n); 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /Algorithms/segmentedsieve.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class segmentedsieve { 3 | 4 | static int MAX =10000001; 5 | static ArrayList sieve() 6 | { 7 | boolean isp[]=new boolean[MAX]; 8 | Arrays.fill(isp,true); 9 | ArrayList primes=new ArrayList<>(); 10 | for(int i=2;i*i primes) 30 | { 31 | long prod=1; 32 | long p=1000000007; 33 | 34 | int base=0; 35 | boolean pr[]=new boolean[r-l+1]; 36 | Arrays.fill(pr,true); 37 | int currprime=0; 38 | for(int i=0;primes.get(i)*(long)primes.get(i)<=r;i++) 39 | { 40 | currprime=primes.get(i); 41 | base=(l/currprime)*currprime; 42 | if(base primes; 69 | primes=sieve(); 70 | for(int j=0;j 2 | using namespace std; 3 | int ternarySearch(int l, int r, int key, int ar[]) 4 | 5 | { 6 | while (r >= l) { 7 | 8 | int mid1 = l + (r - l) / 3; 9 | int mid2 = r - (r - l) / 3; 10 | 11 | if (ar[mid1] == key) { 12 | return mid1; 13 | } 14 | if (ar[mid2] == key) { 15 | return mid2; 16 | } 17 | 18 | 19 | if (key < ar[mid1]) { 20 | 21 | // The key lies in between l and mid1 22 | r = mid1 - 1; 23 | } 24 | else if (key > ar[mid2]) { 25 | 26 | // The key lies in between mid2 and r 27 | l = mid2 + 1; 28 | } 29 | else { 30 | 31 | // The key lies in between mid1 and mid2 32 | l = mid1 + 1; 33 | r = mid2 - 1; 34 | } 35 | } 36 | return -1; 37 | } 38 | int main() 39 | { 40 | int len; 41 | cin>>len; 42 | int ar[len]; 43 | for(int i=0;i>ar[i]; 45 | } 46 | int key; 47 | cin>>key; 48 | int l=0; 49 | int r=len-1; 50 | int p=0; 51 | p = ternarySearch(l, r, key, ar); 52 | 53 | cout << "Index of "<. 4 | - Browse to the location where repository got cloned at your system. 5 | - Then go inside the Discord Bots folder and Create a New Folder with your name. 6 | - Now inside that folder and paste your bot code. 7 | - Add, commit and Push the Changes using the usual Git commands (Not Sure? See Git/GitHub Basics on YouTube). 8 | - Now open the forked repository on GitHub, where you will notice a Pull Request Button. 9 | - Click on it and Make A Pull Request and you are DONE!. 10 | #### Congratulations you have added your program.🥳 11 | 12 | ##
Note:-
13 | 14 | ##### 1. Don't copy the code from anywhere on the net. 15 | ##### 2. Codes like 'helloworld', 'sum of 2 nos.', etc won't be accepted.😔 16 | ##### 3. Deadline is 31st October. 17 | ##### 4. We will personally check each code and if I find any code not following the rules, then his/her Pull Request will be marked as SPAM and it won't be counted.😥 18 | ## 19 | -------------------------------------------------------------------------------- /Bots/silence_us/README.md: -------------------------------------------------------------------------------- 1 | ## Example of Discord Bot to mute channel's members for Among Us game: 2 | When in a Voice Channel, a member can tip '!playing' to mute all members in the same Voice Channel. 3 | For unmute, just tip '!meeting'. 4 | 5 | ### Steps to set up the Bot: 6 | - Go to https://discord.com/developers/applications and create a New Application 7 | - On main menu, click Bot and Add Bot 8 | - Copy the token and export as an environment variable called TOKEN 9 | - In OAuth2 scopes check bot and browse to url generated 10 | - Authorize the bot in your Discord's server 11 | - Run the bot with 'python main.py' command 12 | - Give permission to bot to Mute Members -------------------------------------------------------------------------------- /Bots/silence_us/main.py: -------------------------------------------------------------------------------- 1 | import discord 2 | import os 3 | 4 | token = os.getenv("TOKEN") 5 | 6 | class MyClient(discord.Client): 7 | async def on_ready(self): 8 | print('Logged on as', self.user) 9 | 10 | async def on_message(self, message): 11 | # don't respond to ourselves 12 | if message.author == self.user: 13 | return 14 | 15 | if message.content == '!playing': 16 | #Improvement: Verify if the bot has mute permission 17 | if message.author.voice and message.author.voice.channel: 18 | channel = message.author.voice.channel 19 | for member in channel.members: 20 | await member.edit(mute = True) 21 | await message.channel.send('Shhhhhhhhh!') 22 | else: 23 | await message.channel.send("You are not connected to a voice channel") 24 | return 25 | 26 | 27 | if message.content == '!meeting': 28 | if message.author.voice and message.author.voice.channel: 29 | channel = message.author.voice.channel 30 | for member in channel.members: 31 | await member.edit(mute = False) 32 | await message.channel.send('You can speak now!') 33 | else: 34 | await message.channel.send("You are not connected to a voice channel") 35 | return 36 | 37 | client = MyClient() 38 | client.run(token) -------------------------------------------------------------------------------- /Cryptography/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Cryptography/.DS_Store -------------------------------------------------------------------------------- /Cryptography/1_initial_migration.js: -------------------------------------------------------------------------------- 1 | var Migrations = artifacts.require("./Migrations.sol"); 2 | 3 | module.exports = function(deployer) { 4 | deployer.deploy(Migrations); 5 | }; 6 | -------------------------------------------------------------------------------- /Cryptography/2_deploy_contracts.js: -------------------------------------------------------------------------------- 1 | // migrating the appropriate contracts 2 | var ERC721Mintable = artifacts.require("./ERC721Mintable.sol"); 3 | var Verifier = artifacts.require("./Verifier.sol"); 4 | var SolnSquareVerifier = artifacts.require("./SolnSquareVerifier.sol"); 5 | 6 | 7 | module.exports = function (deployer) { 8 | 9 | let sysmbol = 'REM' 10 | let name = 'Real Estate Marketplace' 11 | let baseTokenURI = 'https://s3-us-west-2.amazonaws.com/udacity-blockchain/capstone/' 12 | 13 | deployer.deploy(ERC721Mintable, name, sysmbol, baseTokenURI); 14 | deployer.deploy(Verifier) 15 | .then(() => { 16 | return deployer.deploy(SolnSquareVerifier, Verifier.address, name, sysmbol, baseTokenURI) 17 | }); 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /Cryptography/Encryptor_Mihir.py: -------------------------------------------------------------------------------- 1 | from Crypto.Cipher import AES 2 | from Crypto.Hash import SHA256 3 | 4 | password = input("Enter the Security Key: ") 5 | hash_obj = SHA256.new(password.encode("utf-8")) 6 | hash_key = hash_obj.digest() 7 | #print(hash_key) 8 | 9 | def encrypt(msg): 10 | BLOCK_SIZE = 16 11 | PAD = "{" 12 | padding = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PAD 13 | cipher = AES.new(hash_key,AES.MODE_ECB) 14 | result = cipher.encrypt(padding(msg).encode("utf-8")) 15 | return result 16 | 17 | def decrypt(msg): 18 | PAD = "{" 19 | decipher = AES.new(hash_key,AES.MODE_ECB) 20 | b_decrypted = decipher.decrypt(msg).decode("utf-8") 21 | pad_index = b_decrypted.find(PAD) 22 | result = b_decrypted[:pad_index] 23 | return result 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Cryptography/Migrations.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.4.21 <0.6.0; 2 | 3 | contract Migrations { 4 | address public owner; 5 | uint public last_completed_migration; 6 | 7 | constructor() public { 8 | owner = msg.sender; 9 | } 10 | 11 | modifier restricted() { 12 | if (msg.sender == owner) _; 13 | } 14 | 15 | function setCompleted(uint completed) public restricted { 16 | last_completed_migration = completed; 17 | } 18 | 19 | function upgrade(address new_address) public restricted { 20 | Migrations upgraded = Migrations(new_address); 21 | upgraded.setCompleted(last_completed_migration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Cryptography/TestSolnSquareVerifier.js: -------------------------------------------------------------------------------- 1 | // Test if a new solution can be added for contract - SolnSquareVerifier 2 | // Test if an ERC721 token can be minted for contract - SolnSquareVerifier 3 | 4 | var Test = require('../config/testConfig.js'); 5 | 6 | contract('SolnSquareVerifier', async (accounts) => { 7 | 8 | var config; 9 | var proof; 10 | var input; 11 | 12 | before('setup contract', async () => { 13 | config = await Test.Config(accounts); 14 | proof = config.proof; 15 | input = config.input; 16 | }); 17 | 18 | describe('match erc721 spec', function () { 19 | 20 | it('should mint an ERC721 token ', async function () { 21 | 22 | config.solnSquareVerifier.Transfer() 23 | .on('data', (event) => { 24 | console.log(`\n\n emit Transfer() tokenId : ${event.returnValues.tokenId}`); 25 | }) 26 | .on('error', console.error); 27 | 28 | const tokenId = config.firstTokenId 29 | 30 | let status = await config.solnSquareVerifier.mint( 31 | config.owner, 32 | tokenId, { from: config.owner }); 33 | 34 | }) 35 | 36 | it('should add a new solutions', async function () { 37 | 38 | config.solnSquareVerifier.Transfer() 39 | .on('data', (event) => { 40 | console.log(`\n\n emit Transfer() tokenId : ${event.returnValues.tokenId}`); 41 | }) 42 | .on('error', console.error); 43 | 44 | const tokenId = config.firstTokenId + 1 45 | 46 | let status = await config.solnSquareVerifier.addSolution( 47 | proof.A, 48 | proof.A_p, 49 | proof.B, 50 | proof.B_p, 51 | proof.C, 52 | proof.C_p, 53 | proof.H, 54 | proof.K, 55 | input, 56 | config.owner, 57 | tokenId, { 58 | from: config.owner 59 | }); 60 | 61 | }) 62 | 63 | }); 64 | 65 | }); 66 | -------------------------------------------------------------------------------- /Cryptography/TestSquareVerifier.js: -------------------------------------------------------------------------------- 1 | var Test = require('../config/testConfig.js'); 2 | 3 | contract('Verifier', async (accounts) => { 4 | 5 | var config; 6 | var proof; 7 | var input; 8 | 9 | before('setup contract', async () => { 10 | config = await Test.Config(accounts); 11 | proof = config.proof; 12 | input = config.input; 13 | }); 14 | 15 | describe('verification with correct proof', function () { 16 | 17 | // Test verification with correct proof 18 | it('Verifier.verifyTx(..) returns true with correct proof', async () => { 19 | const result = await config.verifier.verifyTx.call( 20 | proof.A, 21 | proof.A_p, 22 | proof.B, 23 | proof.B_p, 24 | proof.C, 25 | proof.C_p, 26 | proof.H, 27 | proof.K, 28 | input 29 | ) 30 | console.log("The result is :" + result) 31 | assert(result, 'Incorrect Proof results') 32 | }) 33 | }); 34 | 35 | describe('verification with incorrect proof', function () { 36 | 37 | // Test verification with incorrect proof 38 | it('Verifier.verifyTx(..) returns false with incorrect proof', async () => { 39 | // just change A_p with A 40 | const result = await config.verifier.verifyTx.call( 41 | proof.A_p, 42 | proof.A, 43 | proof.B, 44 | proof.B_p, 45 | proof.C, 46 | proof.C_p, 47 | proof.H, 48 | proof.K, 49 | input 50 | ) 51 | console.log("The result is :" + result) 52 | assert(!result, 'Incorrect Proof results') 53 | }) 54 | }); 55 | 56 | }); 57 | -------------------------------------------------------------------------------- /Cryptography/main_Mihir.py: -------------------------------------------------------------------------------- 1 | from Encryptor import encrypt,decrypt 2 | import pickle 3 | 4 | def encrypt_it(): 5 | password_list = [] 6 | running = True 7 | while True: 8 | password_input = input("Password:") 9 | hashed_pass = encrypt(password_input) 10 | if password_input == "Exit": 11 | break 12 | 13 | else: 14 | password_list.append(hashed_pass) 15 | 16 | with open("pass.txt","wb") as file: 17 | pickle.dump(password_list,file) 18 | 19 | def decrypt_it(): 20 | print("\n") 21 | with open("pass.txt","rb") as file: 22 | pass_list = pickle.load(file) 23 | decrypted_password = [] 24 | 25 | for h_password in pass_list: 26 | d_pass = decrypt(h_password) 27 | decrypted_password.append(d_pass) 28 | 29 | print("The passwords are: \n") 30 | 31 | for password in decrypted_password: 32 | print(password) 33 | 34 | decision = input("Do you want to (e)ncrypt or (d)ecrypt ? ") 35 | if decision == "e": 36 | print(" [!] To quit the program just type 'Exit' ") 37 | encrypt_it() 38 | 39 | elif decision == "d": 40 | try: 41 | decrypt_it() 42 | print("[+] Sucessfully decrypted the passwords!") 43 | 44 | except UnicodeDecodeError: 45 | print("\n \n [-] You have Typed wrong security key!") -------------------------------------------------------------------------------- /Cryptography/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "capstone", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "dev": "lite-server", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": sr (https://ipfs.infura.io/ipfs/QmSXiR9Khm3yo1J67nUopvVBxFJ8YGN2fUGZ34Etr3m92x/)", 12 | "license": "MIT", 13 | "devDependencies": { 14 | "lite-server": "2.4.0" 15 | }, 16 | "dependencies": { 17 | "bignumber.js": "8.0.2", 18 | "opensea-js": "latest", 19 | "openzeppelin-solidity": "^2.2.0", 20 | "solc": "^0.5.2", 21 | "solc-js": "^0.5.2", 22 | "truffle-hdwallet-provider": "^1.0.17", 23 | "web3": "^1.0.0-beta.34" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Game/Chrome_Dinosaur_Srinija_Dharani/chrome_dino.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Game/Chrome_Dinosaur_Srinija_Dharani/chrome_dino.mp4 -------------------------------------------------------------------------------- /Game/Chrome_Dinosaur_Srinija_Dharani/jump_dino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Game/Chrome_Dinosaur_Srinija_Dharani/jump_dino.png -------------------------------------------------------------------------------- /Game/Chrome_Dinosaur_Srinija_Dharani/rest_dino.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Game/Chrome_Dinosaur_Srinija_Dharani/rest_dino.png -------------------------------------------------------------------------------- /Game/Color Game/colorGame.css: -------------------------------------------------------------------------------- 1 | body{ 2 | background-color: #232323; 3 | } 4 | 5 | h1{ 6 | color: white; 7 | text-align: center; 8 | } 9 | 10 | .square{ 11 | width: 30%; 12 | padding-bottom: 30%; 13 | background: pink; 14 | float: left; 15 | margin: 1.66%; 16 | } 17 | 18 | #container{ 19 | max-width: 30%; 20 | margin: 0 auto; 21 | } 22 | 23 | .stripe{ 24 | background-color: white; 25 | text-align: center; 26 | color: rgb(69, 14, 190); 27 | height: 29px; 28 | } 29 | button{ 30 | padding-top: 5px; 31 | padding-bottom: 5px; 32 | } 33 | 34 | button{ 35 | color: blue; 36 | background-color: white; 37 | } 38 | 39 | .inverse{ 40 | color: white; 41 | background-color: blue; 42 | } 43 | -------------------------------------------------------------------------------- /Game/Color Game/colorGame.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Color Game 5 | 6 | 7 | 8 | 9 |

THE GREAT

GUESSING GAME

10 |
11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Game/Guessing Game/guessing_game.py: -------------------------------------------------------------------------------- 1 | from random import random 2 | 3 | answer = random() 4 | 5 | 6 | print("Please guess a number between 1 and 10: ") 7 | guess = int(input()) # This makes it where there is a space for the person to write on the next line 8 | 9 | if guess == answer: 10 | print("You got it on your first try!") 11 | else: 12 | if guess < answer: 13 | print("Maybe you should guess higher.") 14 | else: # guess must be greater than answer 15 | print("Why don't you try a lower guess? ") 16 | guess = int(input()) 17 | if guess == answer: 18 | print("Great job! You guessed the right number!") 19 | else: 20 | print("Sorry! You guessed the wrong number again. That's too bad! I loved your guesses.") 21 | -------------------------------------------------------------------------------- /Game/Number Predict/numberPredict.py: -------------------------------------------------------------------------------- 1 | 2 | import random 3 | r = random.randint(1,20) 4 | 5 | while(True): 6 | inp = int(input()) 7 | if(inpr): 10 | print("oops,try a smaller number") 11 | else: 12 | print("congrats you choosed write number") 13 | break; 14 | -------------------------------------------------------------------------------- /Game/README.md: -------------------------------------------------------------------------------- 1 | #### Add your any game in this folder in any language. 2 | - Fork the repo 3 | - Clone it to your local machine by: 4 | > git clone url 5 | - Add a folder of your name. 6 | - Add your game inside the folder. 7 | - Create a pull request. 8 | -------------------------------------------------------------------------------- /Game/Rock-Paper-Scissors/rock-paper-scissors.py: -------------------------------------------------------------------------------- 1 | from random import randint 2 | 3 | #create a list of play options 4 | t = ["Rock", "Paper", "Scissors"] 5 | 6 | #assign a random play to the computer 7 | computer = t[randint(0,2)] 8 | 9 | #set player to False 10 | player = False 11 | 12 | while player == False: 13 | #set player to True 14 | player = input("Rock, Paper, Scissors?") 15 | if player == computer: 16 | print("Tie!") 17 | elif player == "Rock": 18 | if computer == "Paper": 19 | print("You lose!", computer, "covers", player) 20 | else: 21 | print("You win!", player, "smashes", computer) 22 | elif player == "Paper": 23 | if computer == "Scissors": 24 | print("You lose!", computer, "cut", player) 25 | else: 26 | print("You win!", player, "covers", computer) 27 | elif player == "Scissors": 28 | if computer == "Rock": 29 | print("You lose...", computer, "smashes", player) 30 | else: 31 | print("You win!", player, "cut", computer) 32 | else: 33 | print("That's not a valid play. Check your spelling!") 34 | #player was set to True, but we want it to be False so the loop continues 35 | player = False 36 | computer = t[randint(0,2)] 37 | -------------------------------------------------------------------------------- /Game/SnakeGame/README.md: -------------------------------------------------------------------------------- 1 | # SnakeGame 2 | 3 | ![snake game](snake.gif) 4 | 5 | 6 | ## Objective 7 | Your goal is simple, you have to achieve the maximum length for your snake.
8 | You lose if your snake collides with itself or with the walls of the arena. 9 | 10 | 11 | ## Mechanics 12 | As you start to play, the snake is of a small size. But, witch each pellet it eats, its size increases in length. 13 | 14 | 15 | 16 | ## Controls 17 | This game uses the arrow keys on the keyboard to control the Snake. 18 | 19 | 20 | 21 | ## Screenshot 22 | ![Screenshot](snake.PNG) 23 | 24 | Happy gaming! :) 25 | 26 | -------------------------------------------------------------------------------- /Game/SnakeGame/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Game/SnakeGame/background.jpg -------------------------------------------------------------------------------- /Game/SnakeGame/draw.js: -------------------------------------------------------------------------------- 1 | const canvas = document.querySelector(".canvas"); 2 | const ctx = canvas.getContext("2d"); 3 | const scale = 10; 4 | const rows = canvas.height / scale; 5 | const columns = canvas.width / scale; 6 | var snake; 7 | var start = 0; 8 | 9 | (function setup() { 10 | snake = new Snake(); 11 | fruit = new Fruit(); 12 | fruit.pickLocation(); 13 | 14 | window.setInterval(() => { 15 | if (start) { 16 | ctx.clearRect(0, 0, canvas.width, canvas.height); 17 | fruit.draw(); 18 | snake.update(); 19 | snake.draw(); 20 | 21 | if (snake.eat(fruit)) { 22 | fruit.pickLocation(); 23 | } 24 | 25 | snake.checkCollision(); 26 | document.querySelector(".current-score-value").innerText = snake.total; 27 | } else { 28 | document.querySelector(".current-score-value").innerText = "Press anything to start"; 29 | } 30 | }, 50); 31 | })(); 32 | 33 | window.addEventListener("keydown", (evt) => { 34 | start = 1; 35 | const direction = evt.key.replace("Arrow", ""); 36 | snake.changeDirection(direction); 37 | }); 38 | -------------------------------------------------------------------------------- /Game/SnakeGame/fruit.js: -------------------------------------------------------------------------------- 1 | function Fruit() { 2 | this.x; 3 | this.y; 4 | 5 | this.pickLocation = function () { 6 | this.x = (Math.floor(Math.random() * columns - 1) + 1) * scale; 7 | this.y = (Math.floor(Math.random() * rows - 1) + 1) * scale; 8 | }; 9 | 10 | this.draw = function () { 11 | ctx.fillStyle = "#4cafab"; 12 | ctx.fillRect(this.x, this.y, scale, scale); 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /Game/SnakeGame/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Snake ^_^ 5 | 6 | 7 | 8 |
9 |
10 |
11 | SCORE 12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 21 |
22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Game/SnakeGame/script.js: -------------------------------------------------------------------------------- 1 | // TODO: MAKE A HIGHSCORE 2 | (function () { 3 | if (localStorage.getItem("highscore") != null) { 4 | document.querySelector(".high-score-value").innerHTML = localStorage.getItem("highscore"); 5 | } 6 | else { 7 | localStorage.setItem("highscore", 0); 8 | document.querySelector(".high-score-value").innerHTML = localStorage.getItem("highscore"); 9 | } 10 | })(); 11 | -------------------------------------------------------------------------------- /Game/SnakeGame/snake.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Game/SnakeGame/snake.PNG -------------------------------------------------------------------------------- /Game/SnakeGame/snake.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Game/SnakeGame/snake.gif -------------------------------------------------------------------------------- /Game/SnakeGame/snake.js: -------------------------------------------------------------------------------- 1 | function Snake() { 2 | this.x = 0; 3 | this.y = 0; 4 | this.xSpeed = scale * 1; 5 | this.ySpeed = 0; 6 | this.total = 0; 7 | this.tail = []; 8 | 9 | this.draw = function () { 10 | ctx.fillStyle = "#FFFFFF"; 11 | for (let i = 0; i < this.tail.length; i++) { 12 | ctx.fillRect(this.tail[i].x, this.tail[i].y, scale, scale); 13 | } 14 | 15 | ctx.fillRect(this.x, this.y, scale, scale); 16 | }; 17 | 18 | this.update = function () { 19 | for (let i = 0; i < this.tail.length - 1; i++) { 20 | this.tail[i] = this.tail[i + 1]; 21 | } 22 | 23 | this.tail[this.total - 1] = { x: this.x, y: this.y }; 24 | 25 | this.x += this.xSpeed; 26 | this.y += this.ySpeed; 27 | 28 | if (this.x > canvas.width) { 29 | this.x = 0; 30 | } 31 | 32 | if (this.y > canvas.height) { 33 | this.y = 0; 34 | } 35 | 36 | if (this.x < 0) { 37 | this.x = canvas.width; 38 | } 39 | 40 | if (this.y < 0) { 41 | this.y = canvas.height; 42 | } 43 | }; 44 | 45 | this.changeDirection = function (direction) { 46 | switch (direction) { 47 | case "Up": 48 | this.xSpeed = 0; 49 | this.ySpeed = -scale * 1; 50 | break; 51 | case "Down": 52 | this.xSpeed = 0; 53 | this.ySpeed = scale * 1; 54 | break; 55 | case "Left": 56 | this.xSpeed = -scale * 1; 57 | this.ySpeed = 0; 58 | break; 59 | case "Right": 60 | this.xSpeed = scale * 1; 61 | this.ySpeed = 0; 62 | break; 63 | } 64 | }; 65 | 66 | this.eat = function (fruit) { 67 | if (this.x === fruit.x && this.y === fruit.y) { 68 | this.total++; 69 | /* 70 | * Check if current score is higher than current highscore 71 | * If so, set the highscore to the new value and update the UI 72 | */ 73 | if (this.total > localStorage.getItem("highscore")) { 74 | localStorage.setItem("highscore", this.total); 75 | document.querySelector(".high-score-value").innerHTML = localStorage.getItem("highscore"); 76 | } 77 | return true; 78 | } 79 | 80 | return false; 81 | }; 82 | 83 | this.checkCollision = function () { 84 | for (var i = 0; i < this.tail.length; i++) { 85 | if (this.x === this.tail[i].x && this.y === this.tail[i].y) { 86 | this.total = 0; 87 | this.tail = []; 88 | } 89 | } 90 | }; 91 | } 92 | -------------------------------------------------------------------------------- /Game/SnakeGame/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | =============== 3 | Fonts 4 | =============== 5 | */ 6 | @import url("https://fonts.googleapis.com/css?family=Open+Sans|Roboto:400,700&display=swap"); 7 | 8 | /* 9 | =============== 10 | Global Styles 11 | =============== 12 | */ 13 | 14 | *, 15 | ::after, 16 | ::before { 17 | margin: 0; 18 | padding: 0; 19 | box-sizing: border-box; 20 | font-size: 14px; 21 | } 22 | 23 | /* 24 | =============== 25 | Container 26 | =============== 27 | */ 28 | 29 | body { 30 | background: url(background.jpg) no-repeat center center fixed; 31 | font-family: "Open Sans", sans-serif; 32 | letter-spacing: 0.1rem; 33 | } 34 | 35 | .container { 36 | display: flex; 37 | min-height: 100vh; 38 | } 39 | 40 | .canvas-container { 41 | flex-basis: 70%; 42 | display: flex; 43 | justify-content: center; 44 | align-items: center; 45 | } 46 | 47 | /* 48 | =============== 49 | Inside container 50 | =============== 51 | */ 52 | 53 | .canvas { 54 | background-color: #3e3e3e; 55 | } 56 | hr { 57 | border: none; 58 | min-height: 5px; 59 | background: #0e0e0e; 60 | margin: 1rem 0; 61 | } 62 | 63 | .score-container { 64 | flex-basis: 30%; 65 | display: block; 66 | background: #404d07; 67 | padding: 15px; 68 | color: white; 69 | } 70 | 71 | .score-text { 72 | font-size: 2rem; 73 | font-weight: bold; 74 | text-align: center; 75 | } 76 | 77 | .current-score-value { 78 | 79 | } 80 | 81 | .high-score-value::before { 82 | content: "Highest Score : " 83 | } 84 | 85 | 86 | /* Development purpose */ 87 | * { 88 | /* border: 1px solid red; */ 89 | } 90 | -------------------------------------------------------------------------------- /Game/Sudoku/sudokSolver.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | bool isSafeToPut(int mat[][9],int i,int j,int n,int number) 5 | { 6 | for(int k=0;kThere are two steps to implement a Facial Mask Detector: 4 |
    5 |
  1. Identifying the mouth and the entire face
  2. 6 |
  3. Identifying whether the person in front of the camera is wearing a mask or not
  4. 7 |
8 | 9 |

Identifying the face and mouth:

10 |
    11 |
  1. HAAR Cascade object --> CascadeClassifier()
  2. 12 |
  3. Camera input
  4. 13 |
  5. Gray scale conversion of the image
  6. 14 |
  7. detectMultiScale()
  8. 15 |
16 | 17 |

Identifying whether the person is wearing a mask or not

18 |
    19 |
  1. Gray image face box
  2. 20 |
  3. Black & white image face box
  4. 21 |
  5. Gray image mouth rectangle
  6. 22 |
23 | 24 | 25 | 26 |

Final Output

27 |

Without Mask:

28 | 29 |

With Mask:

30 | 31 | 32 | 33 |

End.

34 | -------------------------------------------------------------------------------- /ML_Projects/Face-Mask-Detection/Screenshot (36).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/ML_Projects/Face-Mask-Detection/Screenshot (36).png -------------------------------------------------------------------------------- /ML_Projects/Face-Mask-Detection/Screenshot (37).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/ML_Projects/Face-Mask-Detection/Screenshot (37).png -------------------------------------------------------------------------------- /ML_Projects/Face-Mask-Detection/final_face_mask.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | import random 4 | 5 | face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') 6 | eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') 7 | mouth_cascade = cv2.CascadeClassifier('haarcascade_mcs_mouth.xml') 8 | upper_body = cv2.CascadeClassifier('haarcascade_upperbody.xml') 9 | 10 | 11 | bw_threshold = 80 12 | 13 | 14 | font = cv2.FONT_HERSHEY_COMPLEX 15 | org = (30, 30) 16 | wore_mask_font_color = (0, 255, 0) 17 | not_wore_mask_font_color = (0, 0, 255) 18 | thickness = 2 19 | font_scale = 1 20 | wore_mask = "Mask: 100.0% Good Job!" 21 | not_wore_mask = "Mask: 0.0% Please wear mask!" 22 | 23 | cap = cv2.VideoCapture(0) 24 | 25 | while True: 26 | ret, img = cap.read() 27 | img = cv2.flip(img,1) 28 | 29 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 30 | (thresh, black_and_white) = cv2.threshold(gray, bw_threshold, 255, cv2.THRESH_BINARY) 31 | faces = face_cascade.detectMultiScale(gray, 1.1, 4) 32 | faces_bw = face_cascade.detectMultiScale(black_and_white, 1.1, 4) 33 | 34 | if(len(faces) == 0 and len(faces_bw) == 0): 35 | cv2.putText(img, "No face found...", org, font, font_scale, wore_mask_font_color, thickness, cv2.LINE_AA) 36 | elif(len(faces) == 0 and len(faces_bw) == 1): 37 | 38 | cv2.putText(img, wore_mask, org, font, font_scale, wore_mask_font_color, thickness, cv2.LINE_AA) 39 | else: 40 | 41 | for (x, y, w, h) in faces: 42 | cv2.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 3) 43 | roi_gray = gray[y:y + h, x:x + w] 44 | roi_color = img[y:y + h, x:x + w] 45 | 46 | 47 | mouth_rects = mouth_cascade.detectMultiScale(gray, 1.5, 5) 48 | 49 | #if face is detected, but mouth is not, then the person is wearing mask. 50 | if(len(mouth_rects) == 0): 51 | cv2.putText(img, wore_mask, org, font, font_scale, wore_mask_font_color, thickness, cv2.LINE_AA) 52 | else: 53 | for (mx, my, mw, mh) in mouth_rects: 54 | 55 | if(y < my < y + h): 56 | 57 | cv2.putText(img, not_wore_mask, org, font, font_scale, not_wore_mask_font_color, thickness, cv2.LINE_AA) 58 | break 59 | 60 | cv2.imshow('Mask Detection', img) 61 | if cv2.waitKey(1) & 0xFF==ord("q"): 62 | break 63 | 64 | cap.release() 65 | cv2.destroyAllWindows() 66 | -------------------------------------------------------------------------------- /ML_Projects/Face-Mask-Detection/truth_table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/ML_Projects/Face-Mask-Detection/truth_table.png -------------------------------------------------------------------------------- /ML_Projects/Naive-Bayes/README.md: -------------------------------------------------------------------------------- 1 | # SPAM 2 | CLASSIFICATION USING NAIVE BAYES 3 | https://www.kaggle.com/uciml/sms-spam-collection-dataset 4 | -------------------------------------------------------------------------------- /ML_Projects/Naive-Bayes/dummy: -------------------------------------------------------------------------------- 1 | dd 2 | -------------------------------------------------------------------------------- /ML_Projects/README.md: -------------------------------------------------------------------------------- 1 | #### Add your Machine Learning project in this folder. 2 | - Fork the repo 3 | - Clone it to your local machine by: 4 | > git clone url 5 | - Add a folder of your name. 6 | - Add your project inside the folder. 7 | - Create a pull request. 8 | -------------------------------------------------------------------------------- /ML_Projects/RL model/readme.md.txt: -------------------------------------------------------------------------------- 1 | #### RL model of Taxi enviornment using GYM. 2 | -------------------------------------------------------------------------------- /ML_Projects/spam-ml/Readme.md: -------------------------------------------------------------------------------- 1 | # spam - ml 2 | ## -By: K umesh chandra 3 | This is the code for building a machine learing model to predict a message to be spam or not. 4 | -------------------------------------------------------------------------------- /ML_Projects/spam-ml/spam.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/ML_Projects/spam-ml/spam.csv -------------------------------------------------------------------------------- /ML_Projects/spam-ml/spam.pkl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/ML_Projects/spam-ml/spam.pkl -------------------------------------------------------------------------------- /ML_Projects/titanic project/__pycache__/visuals.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/ML_Projects/titanic project/__pycache__/visuals.cpython-38.pyc -------------------------------------------------------------------------------- /Programs/230B T-Primes.cpp: -------------------------------------------------------------------------------- 1 | //Author Tejas K Mukherjee 2 | #include 3 | using namespace std; 4 | #define ll long long 5 | #define FOR(a,b) for(int i=a;i>n; 33 | while(n--) 34 | { 35 | ll tprime; 36 | cin>>tprime; 37 | if (!perfSquare(tprime)) 38 | cout<<"NO"<<'\n'; 39 | else 40 | { 41 | if (isPrime(sqrt(tprime))) 42 | cout<<"YES"<<'\n'; 43 | else 44 | cout<<"NO"<<'\n'; 45 | } 46 | } 47 | return 0; 48 | } -------------------------------------------------------------------------------- /Programs/3D_array_dynamic.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int *p,x=1,y=2,z=3; 7 | p=new int(x*y*z); 8 | p[1] [1] [2]]=0; 9 | p[2]=5; 10 | cout< 3 | using namespace std; 4 | #define ll long long 5 | #define FOR(a,b) for(int i=a;i>n>>m; 11 | int a[n]; 12 | FOR(0,n) 13 | { 14 | cin>>a[i]; 15 | } 16 | int s = 0; 17 | int bus =1; 18 | FOR(0,n) 19 | { 20 | s+=a[i]; 21 | if (s>m) 22 | { 23 | bus++; 24 | s=0; 25 | i--; 26 | } 27 | } 28 | cout< 2 | 3 | int main() 4 | { 5 | int array[100], position, c, n; 6 | 7 | printf("Enter number of elements in array\n"); 8 | scanf("%d", &n); 9 | 10 | printf("Enter %d elements\n", n); 11 | 12 | for (c = 0; c < n; c++) 13 | scanf("%d", &array[c]); 14 | 15 | printf("Enter the location where you wish to delete element\n"); 16 | scanf("%d", &position); 17 | 18 | if (position >= n+1) 19 | printf("Deletion not possible.\n"); 20 | else 21 | { 22 | for (c = position - 1; c < n - 1; c++) 23 | array[c] = array[c+1]; 24 | 25 | printf("Resultant array:\n"); 26 | 27 | for (c = 0; c < n - 1; c++) 28 | printf("%d\n", array[c]); 29 | } 30 | 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /Programs/ArrayTranspose.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int a[10][10], transpose[10][10], r, c, i, j; 6 | printf("Enter rows and columns of matrix: "); 7 | scanf("%d %d", &r, &c); 8 | 9 | // Storing elements of the matrix 10 | printf("\nEnter elements of matrix:\n"); 11 | for(i=0; i0) 18 | { 19 | Integer n=sc.nextInt(); 20 | BigInteger b =BigInteger.valueOf(1); 21 | for(Integer i=1;i<=n;i++) 22 | b=b.multiply(BigInteger.valueOf(i)); 23 | System.out.println(b); 24 | } 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Programs/Binary.py: -------------------------------------------------------------------------------- 1 | 2 | def convertToBinary(n): 3 | 4 | if n > 1: 5 | 6 | convertToBinary(n//2) 7 | 8 | print(n % 2,end = '') 9 | 10 | # decimal number 11 | 12 | dec = 34 13 | 14 | convertToBinary(dec) 15 | 16 | print() 17 | -------------------------------------------------------------------------------- /Programs/BinarySearch.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void main() 4 | { 5 | clrscr(); 6 | int n,i,arr[50],search,first,last,middle; 7 | cout<<"Enter total number of elements:"; 8 | cin>>n; 9 | cout<<"Enter "<>arr[i]; 13 | } 14 | cout<<"Enter a number to find:"; 15 | cin>>search; 16 | first=0; 17 | last=n-1; 18 | middle=(first+last)/2; 19 | while(first<=last) 20 | { 21 | if(arr[middle]last) 37 | { 38 | cout<<"Not found!!"< // C++ program to convert binary to decimal 2 | using namespace std; 3 | 4 | int binaryToDecimal(int n) // Function to convert binary to decimal 5 | { 6 | int num = n; 7 | int dec_value = 0; 8 | 9 | // Initializing base value to 1, i.e 2^0 10 | int base = 1; 11 | 12 | int temp = num; 13 | while (temp) { 14 | int last_digit = temp % 10; 15 | temp = temp / 10; 16 | 17 | dec_value += last_digit * base; 18 | 19 | base = base * 2; 20 | } 21 | 22 | return dec_value; 23 | } 24 | int main() // Driver program to test above function 25 | { 26 | int num ; 27 | cin >> num; 28 | 29 | cout << binaryToDecimal(num) << endl; 30 | } 31 | -------------------------------------------------------------------------------- /Programs/Boxes Through a Tunnel.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define MAX_HEIGHT 41 4 | 5 | struct box 6 | { 7 | /** 8 | * Define three fields of type int: length, width and height 9 | */ 10 | int length,width,height; 11 | }boxes[100]; 12 | 13 | typedef struct box box; 14 | 15 | int get_volume(box b) { 16 | /** 17 | * Return the volume of the box 18 | */ 19 | int volume=b.height*b.length*b.width; 20 | return volume; 21 | } 22 | 23 | int is_lower_than_max_height(box b) { 24 | /** 25 | * Return 1 if the box's height is lower than MAX_HEIGHT and 0 otherwise 26 | */ 27 | if(b.height<41){return 1;} 28 | else return 0; 29 | } 30 | 31 | int main() 32 | { 33 | int n; 34 | scanf("%d", &n); 35 | box *boxes = malloc(n * sizeof(box)); 36 | for (int i = 0; i < n; i++) { 37 | scanf("%d%d%d", &boxes[i].length, &boxes[i].width, &boxes[i].height); 38 | } 39 | for (int i = 0; i < n; i++) { 40 | if (is_lower_than_max_height(boxes[i])) { 41 | printf("%d\n", get_volume(boxes[i])); 42 | } 43 | } 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /Programs/BubbleSort.java: -------------------------------------------------------------------------------- 1 | public class BubbleSortExample { 2 | static void bubbleSort(int[] arr) { 3 | int n = arr.length; 4 | int temp = 0; 5 | for(int i=0; i < n; i++){ 6 | for(int j=1; j < (n-i); j++){ 7 | if(arr[j-1] > arr[j]){ 8 | //swap elements 9 | temp = arr[j-1]; 10 | arr[j-1] = arr[j]; 11 | arr[j] = temp; 12 | } 13 | 14 | } 15 | } 16 | 17 | } 18 | public static void main(String[] args) { 19 | int arr[] ={3,60,35,2,45,320,5}; 20 | 21 | System.out.println("Array Before Bubble Sort"); 22 | for(int i=0; i < arr.length; i++){ 23 | System.out.print(arr[i] + " "); 24 | } 25 | System.out.println(); 26 | 27 | bubbleSort(arr);//sorting array elements using bubble sort 28 | 29 | System.out.println("Array After Bubble Sort"); 30 | for(int i=0; i < arr.length; i++){ 31 | System.out.print(arr[i] + " "); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Programs/C prog_finding quotient and remainder: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | int dividend, divisor, quotient, remainder; 4 | printf("Enter dividend: "); 5 | scanf("%d", ÷nd); 6 | printf("Enter divisor: "); 7 | scanf("%d", &divisor); 8 | 9 | // Computes quotient 10 | quotient = dividend / divisor; 11 | 12 | // Computes remainder 13 | remainder = dividend % divisor; 14 | 15 | printf("Quotient = %d\n", quotient); 16 | printf("Remainder = %d", remainder); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /Programs/CIRCLE1.C: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void drawcircle(int x0, int y0, int radius) 5 | { 6 | int x = radius; 7 | int y = 0; 8 | int err = 0; 9 | 10 | while (x >= y) 11 | { 12 | putpixel(x0 + x, y0 + y, 7); 13 | putpixel(x0 + y, y0 + x, 7); 14 | putpixel(x0 - y, y0 + x, 7); 15 | putpixel(x0 - x, y0 + y, 7); 16 | putpixel(x0 - x, y0 - y, 7); 17 | putpixel(x0 - y, y0 - x, 7); 18 | putpixel(x0 + y, y0 - x, 7); 19 | putpixel(x0 + x, y0 - y, 7); 20 | 21 | if (err <= 0) 22 | { 23 | y += 1; 24 | err += 2*y + 1; 25 | } 26 | 27 | if (err > 0) 28 | { 29 | x -= 1; 30 | err -= 2*x + 1; 31 | } 32 | } 33 | getch(); 34 | } 35 | 36 | int main() 37 | { 38 | int gdriver=DETECT, gmode, error, x, y, r; 39 | initgraph(&gdriver, &gmode, "c:\\turboc3\\bgi"); 40 | 41 | printf("Enter radius of circle: "); 42 | scanf("%d", &r); 43 | 44 | printf("Enter co-ordinates of center(x and y): "); 45 | scanf("%d%d", &x, &y); 46 | drawcircle(x, y, r); 47 | 48 | return 0; 49 | 50 | } -------------------------------------------------------------------------------- /Programs/COVID_info.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from bs4 import BeautifulSoup 3 | from plyer import notification 4 | import time 5 | 6 | 7 | def notifyMe(title, message): 8 | notification.notify( 9 | title = title, 10 | message = message, 11 | timeout = 5 12 | ) 13 | 14 | 15 | result = requests.get('https://www.worldometers.info/coronavirus/').text 16 | soup = BeautifulSoup(result, 'html.parser') 17 | soup.encode('utf-8') 18 | cases = soup.find("div", {"class":"maincounter-number"}).get_text().strip() 19 | 20 | 21 | while True: 22 | print(cases) 23 | time.sleep(10) 24 | #notifyMe('Total number', cases) 25 | -------------------------------------------------------------------------------- /Programs/Calendar.py: -------------------------------------------------------------------------------- 1 | import calendar 2 | 3 | yy = 2014 # year 4 | 5 | mm = 11 # month 6 | 7 | # To take month and year input from the user 8 | 9 | # yy = int(input("Enter year: ")) 10 | 11 | # mm = int(input("Enter month: ")) 12 | 13 | # display the calendar 14 | 15 | print(calendar.month(yy, mm)) 16 | -------------------------------------------------------------------------------- /Programs/Circularlinkedlist.c: -------------------------------------------------------------------------------- 1 | Live Demo 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | struct node { 8 | int data; 9 | int key; 10 | 11 | struct node *next; 12 | }; 13 | 14 | struct node *head = NULL; 15 | struct node *current = NULL; 16 | 17 | bool isEmpty() { 18 | return head == NULL; 19 | } 20 | 21 | int length() { 22 | int length = 0; 23 | 24 | //if list is empty 25 | if(head == NULL) { 26 | return 0; 27 | } 28 | 29 | current = head->next; 30 | 31 | while(current != head) { 32 | length++; 33 | current = current->next; 34 | } 35 | 36 | return length; 37 | } 38 | 39 | //insert link at the first location 40 | void insertFirst(int key, int data) { 41 | 42 | //create a link 43 | struct node *link = (struct node*) malloc(sizeof(struct node)); 44 | link->key = key; 45 | link->data = data; 46 | 47 | if (isEmpty()) { 48 | head = link; 49 | head->next = head; 50 | } else { 51 | //point it to old first node 52 | link->next = head; 53 | 54 | //point first to new first node 55 | head = link; 56 | } 57 | } 58 | 59 | //delete first item 60 | struct node * deleteFirst() { 61 | 62 | //save reference to first link 63 | struct node *tempLink = head; 64 | 65 | if(head->next == head) { 66 | head = NULL; 67 | return tempLink; 68 | } 69 | 70 | //mark next to first link as first 71 | head = head->next; 72 | 73 | //return the deleted link 74 | return tempLink; 75 | } 76 | 77 | //display the list 78 | void printList() { 79 | 80 | struct node *ptr = head; 81 | printf("\n[ "); 82 | 83 | //start from the beginning 84 | if(head != NULL) { 85 | 86 | while(ptr->next != ptr) { 87 | printf("(%d,%d) ",ptr->key,ptr->data); 88 | ptr = ptr->next; 89 | } 90 | } 91 | 92 | printf(" ]"); 93 | } 94 | 95 | void main() { 96 | insertFirst(1,10); 97 | insertFirst(2,20); 98 | insertFirst(3,30); 99 | insertFirst(4,1); 100 | insertFirst(5,40); 101 | insertFirst(6,56); 102 | 103 | printf("Original List: "); 104 | 105 | //print list 106 | printList(); 107 | 108 | while(!isEmpty()) { 109 | struct node *temp = deleteFirst(); 110 | printf("\nDeleted value:"); 111 | printf("(%d,%d) ",temp->key,temp->data); 112 | } 113 | 114 | printf("\nList after deleting all items: "); 115 | printList(); 116 | } 117 | -------------------------------------------------------------------------------- /Programs/Convertagivenintegertoyearsmonthsanddays.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() { 3 | int ndays, y, m, d; 4 | 5 | printf("Input no. of days: "); 6 | 7 | scanf("%d", &ndays); 8 | 9 | y = (int) ndays/365; 10 | 11 | ndays = ndays-(365*y); 12 | 13 | m = (int)ndays/30; 14 | 15 | d = (int)ndays-(m*30); 16 | 17 | printf(" %d Year(s) \n %d Month(s) \n %d Day(s)", y, m, d); 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /Programs/CountingSort.java: -------------------------------------------------------------------------------- 1 | class CountingSort { 2 | void sort(char arr[]) 3 | { 4 | int n = arr.length; 5 | 6 | // The output character array that will have sorted arr 7 | char output[] = new char[n]; 8 | 9 | // Create a count array to store count of inidividul 10 | // characters and initialize count array as 0 11 | int count[] = new int[256]; 12 | for (int i = 0; i < 256; ++i) 13 | count[i] = 0; 14 | 15 | // store count of each character 16 | for (int i = 0; i < n; ++i) 17 | ++count[arr[i]]; 18 | 19 | // Change count[i] so that count[i] now contains actual 20 | // position of this character in output array 21 | for (int i = 1; i <= 255; ++i) 22 | count[i] += count[i - 1]; 23 | 24 | // Build the output character array 25 | // To make it stable we are operating in reverse order. 26 | for (int i = n - 1; i >= 0; i--) { 27 | output[count[arr[i]] - 1] = arr[i]; 28 | --count[arr[i]]; 29 | } 30 | 31 | // Copy the output array to arr, so that arr now 32 | // contains sorted characters 33 | for (int i = 0; i < n; ++i) 34 | arr[i] = output[i]; 35 | } 36 | 37 | // Driver method 38 | public static void main(String args[]) 39 | { 40 | CountingSort ob = new CountingSort(); 41 | char arr[] = { 'g', 'e', 'e', 'k', 's', 'f', 'o', 42 | 'r', 'g', 'e', 'e', 'k', 's' }; 43 | 44 | ob.sort(arr); 45 | 46 | System.out.print("Sorted character array is "); 47 | for (int i = 0; i < arr.length; ++i) 48 | System.out.print(arr[i]); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Programs/Create_A_BinaryTree_From_PreOrder&InOrder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | class node{ 5 | public: 6 | int data; 7 | node* left; 8 | node* right; 9 | 10 | node(int d) 11 | { 12 | data=d; 13 | left=right=NULL; 14 | } 15 | }; 16 | 17 | node* createTreeFromTrav(int in[],int pre[],int s,int e) 18 | { 19 | static int i=0; 20 | //base case 21 | if(s>e) 22 | { 23 | return NULL; 24 | } 25 | 26 | node* root=new node(pre[i]); 27 | int index=-1; 28 | for(int j=s;s<=e;j++) 29 | { 30 | if(in[j]==pre[i]) 31 | { 32 | index=j; 33 | break; 34 | } 35 | } 36 | 37 | i++; 38 | root->left=createTreeFromTrav(in,pre,s,index-1); 39 | root->right=createTreeFromTrav(in,pre,index+1,e); 40 | 41 | return root; 42 | 43 | 44 | } 45 | void preorder(node* root) 46 | { 47 | if(root==NULL) 48 | { 49 | return; 50 | } 51 | cout<data<<" "; 52 | preorder(root->left); 53 | preorder(root->right); 54 | } 55 | int main(){ 56 | int in[] = {3,2,8,4,1,6,7,5}; 57 | int pre[] = {1,2,3,4,8,5,6,7}; 58 | int n = sizeof(in)/sizeof(int); 59 | 60 | node*root = createTreeFromTrav(in,pre,0,n-1); 61 | 62 | preorder(root); 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /Programs/Decimaltobinary.c: -------------------------------------------------------------------------------- 1 | #include 2 | long int decimal_to_binary(int n) 3 | { 4 | long int binary = 0; 5 | int remainder, i, flag = 1; 6 | for(i = 1; n != 0; i = i * 10) 7 | { 8 | remainder = n % 2; 9 | n /= 2; 10 | binary += remainder * i; 11 | } 12 | return binary; 13 | } 14 | int main() 15 | { 16 | int n; 17 | printf("Enter a decimal number: "); 18 | scanf("%d", &n); 19 | printf("Equivalent binary number: %d\n", decimal_to_binary(n)); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Programs/Decodings.c: -------------------------------------------------------------------------------- 1 | /* C program find the possible number of decodings of a given digit sequence */ 2 | 3 | #include 4 | 5 | #include 6 | 7 | int count_decoding_digits(char *digits, int n) 8 | 9 | { 10 | 11 | int count[n+1]; // An array to store results of subproblems 12 | 13 | count[0] = 1; 14 | 15 | count[1] = 1; 16 | 17 | for (int i = 2; i <= n; i++) 18 | 19 | { 20 | 21 | count[i] = 0; 22 | 23 | // If the last digit != 0, then last digit must add to the number of words 24 | 25 | if (digits[i-1] > ‘0’) 26 | 27 | count[i] = count[i-1]; 28 | 29 | // If second last digit is smaller than 2 and last digit is smaller than 7, then last two digits form a valid character 30 | 31 | if (digits[i-2] == ‘1’ || (digits[i-2] == ‘2’ && digits[i-1] < ‘7’) ) 32 | 33 | count[i] += count[i-2]; 34 | 35 | } 36 | 37 | return count[n]; 38 | 39 | } 40 | 41 | int main() 42 | 43 | { 44 | 45 | char digits[15]; 46 | 47 | printf(“nEnter the digit sequence : “); 48 | 49 | gets(digits); 50 | 51 | int n = strlen(digits); 52 | 53 | printf(“nPossible count of decoding of the sequence : %dn”, count_decoding_digits(digits, n)); 54 | 55 | return 0; 56 | 57 | } 58 | -------------------------------------------------------------------------------- /Programs/Determinant.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main(){ 3 | 4 | int a[3][3], i, j; 5 | long determinant; 6 | printf("Enter the 9 elements of matrix: "); 7 | 8 | for(i = 0 ;i < 3;i++) 9 | 10 | for(j = 0;j < 3;j++) 11 | 12 | scanf("%d", &a[i][j]); 13 | 14 | 15 | 16 | printf("\nThe matrix is\n"); 17 | 18 | for(i = 0;i < 3; i++){ 19 | 20 | printf("\n"); 21 | 22 | for(j = 0;j < 3; j++) 23 | 24 | printf("%d\t", a[i][j]); 25 | 26 | } 27 | determinant = a[0][0] * ((a[1][1]*a[2][2]) - (a[2][1]*a[1][2])) -a[0][1] * (a[1][0] 28 | 29 | * a[2][2] - a[2][0] * a[1][2]) + a[0][2] * (a[1][0] * a[2][1] - a[2][0] * a[1][1]); 30 | printf("\nDeterminant of 3X3 matrix: %ld", determinant); 31 | return 0; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Programs/DiagonalDifference.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class DiagonalDifference 3 | { 4 | public static void main(String args[]) 5 | {int sum1=0,sum2=0; 6 | Scanner sc=new Scanner(System.in); 7 | System.out.println("Enter order of matrix"); 8 | int n=sc.nextInt(); 9 | System.out.println("Enter elements of matrix"); 10 | int a[][]=new int[n][n]; 11 | for(int i=0;i 4 | #include 5 | #include 6 | #include 7 | using namespace std; 8 | 9 | 10 | int addDigits(int num) { 11 | // digital root concept 12 | if (num == 0) 13 | return 0; 14 | 15 | if (num % 9 == 0) 16 | return 9; 17 | return num % 9; 18 | } 19 | int main() { 20 | int a = 27518; 21 | cout << addDigits(a); 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /Programs/Display_int_Bytes.c: -------------------------------------------------------------------------------- 1 | * C Program to display the each byte of an integer. 2 | Example: int a=258; then the each byte are 0,0,1,2. 3 | int a=523; then the each byte are 0,0,2,11. 4 | */ 5 | 6 | //A integer is stored as binary in C.It takes 4 bytes of memory is required (32/64-bit architecture) to store an integer. 7 | //4 bytes = 32 bits are allocated memory. 8 | 9 | // This program is a simple way to understand how values are stored in Memory in C. 10 | 11 | #include 12 | #include 13 | 14 | int main() { 15 | int num; 16 | int i = 0, k = 0, a[4][8]; 17 | //Intialize the array to zero 18 | for (int byte = 0; byte < 4; byte++) { 19 | for (int bit = 0; bit < 8; bit++) { 20 | a[byte][bit] = 0; 21 | } 22 | } 23 | int rem = 0; 24 | scanf("%d", &num); 25 | while (num != 0) { 26 | rem = num % 2; 27 | if (i < 8) { 28 | a[k][8 - i - 1] = rem; 29 | i++; 30 | } 31 | else { 32 | i = 0; 33 | k++; 34 | a[k][8 - i - 1] = rem; 35 | i++; 36 | } 37 | num = num / 2; 38 | } 39 | int bit, byte; 40 | for (byte = 0; byte < 4; byte++) { 41 | printf("Byte %d : \t", byte + 1); 42 | for (bit = 0; bit < 8; bit++) { 43 | printf("%d", a[byte][bit] ); 44 | } 45 | printf("\n"); 46 | } 47 | int res[4]; 48 | for (byte = 0; byte < 4; byte++) { 49 | int dec = 0, i = 0, rem; 50 | int bit = 7; 51 | while (bit >= 0) { 52 | dec += a[byte][bit] * pow(2, i); 53 | ++i; 54 | bit--; 55 | } 56 | //Array which will store each byte. 57 | res[byte] = dec; 58 | 59 | } 60 | 61 | printf("%d,%d,%d,%d\n", res[3], res[2], res[1], res[0] ); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /Programs/Divide array.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | vector partitionArray(vector arr,int x){ 4 | int i=0,j=arr.size()-1,temp; 5 | while(i<=j){ 6 | while(arr[i]<=x) 7 | i++; 8 | while(arr[j]>x) 9 | j--; 10 | if(ix||arr[j]<=x)){ 11 | temp=arr[i]; 12 | arr[i]=arr[j]; 13 | arr[j]=temp; 14 | i++; 15 | j--; 16 | } 17 | } 18 | return arr; 19 | } 20 | int main() { 21 | int n,k,i=0;//n=number of elements,k=partition number 22 | cin>>n>>k; 23 | vector arr(n); 24 | for(i=0;i>arr[i]; 26 | arr=partitionArray(arr,k); 27 | for(i=0;i 2 | #include 3 | #define MAX 10 4 | typedef struct { 5 | int data[MAX]; 6 | int front; 7 | int rear; 8 | } dequeue; 9 | 10 | int insert(dequeue *q, int key, int end) { 11 | if (q->rear == MAX - 1) { 12 | printf("dequeue Full\n"); 13 | return 1; 14 | } 15 | if (q->rear == -1) { 16 | q->front = q->rear = 0; 17 | q->data[q->rear] = key; 18 | } 19 | else if (end == 0) { 20 | q->front = (q->front + MAX - 1) % MAX; 21 | q->data[q->front] = key; 22 | } 23 | else { 24 | q->rear = (q->rear + 1) % MAX; 25 | q->data[q->rear] = key; 26 | } 27 | return 0; 28 | } 29 | 30 | 31 | int delet(dequeue *q, int *m, int end) { 32 | if (q->front == -1) { 33 | printf("dequeue empty\n"); 34 | return 1; 35 | } 36 | if (q->front == q->rear) { 37 | *m = q->data[q->front]; 38 | q->front = q->rear = -1; 39 | } 40 | else if (end == 0) { 41 | *m = q->data[q->front]; 42 | q->front = (q->front + 1) % MAX; 43 | } 44 | else { 45 | *m = q->data[q->rear]; 46 | q->rear = (q->rear + MAX - 1) % MAX; 47 | } 48 | return 0; 49 | } 50 | 51 | void display(dequeue q) { 52 | for (int i = 0; i <= q.rear; i++) { 53 | printf("%d ", q.data[i]); 54 | } 55 | printf("\n"); 56 | } 57 | 58 | int main() { 59 | 60 | freopen("in.txt", "r", stdin); 61 | freopen("out.txt", "w", stdout); 62 | 63 | dequeue q1; 64 | q1.rear = q1.front = -1; 65 | 66 | insert(&q1, 15, 1); 67 | insert(&q1, 12, 0); 68 | insert(&q1, 1, 1); 69 | display(q1); 70 | 71 | int m; 72 | delet(&q1, &m, 0); 73 | printf("\n %d\n ", m); 74 | display(q1); 75 | 76 | return 0 ; 77 | } 78 | -------------------------------------------------------------------------------- /Programs/Fibonacci.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | void fibonacci(int n) 4 | { 5 | int a=0,b=1; 6 | cout<<0<<" "<<1<<" "; 7 | for( int i=0;i>y; 20 | fibonacci(y); 21 | cout< 2 | using namespace std; 3 | 4 | void insertionSort(int arr[], int n) 5 | { 6 | int i, key, j; 7 | for (i = 1; i < n; i++) 8 | { 9 | key = arr[i]; 10 | j = i - 1; 11 | 12 | while (j >= 0 && arr[j] > key) 13 | { 14 | arr[j + 1] = arr[j]; 15 | j = j - 1; 16 | } 17 | arr[j + 1] = key; 18 | } 19 | } 20 | 21 | void printArray(int arr[], int n) 22 | { 23 | int i; 24 | for (i = 0; i < n; i++) 25 | cout << arr[i] << " "; 26 | cout << endl; 27 | } 28 | 29 | int main() 30 | { 31 | int n; 32 | cin>>n; 33 | int arr[n]; 34 | 35 | for(int i=0;i>arr[i]; 37 | 38 | insertionSort(arr, n); 39 | 40 | for (int i = 0; i < n; i++) 41 | cout << arr[i] << " "; 42 | 43 | cout << endl; 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /Programs/Jiteah.c: -------------------------------------------------------------------------------- 1 | #include > 2 | int largest_among_three(int a, int b, int c) 3 | { 4 | if(a > b && a > c) 5 | return a; 6 | else if(b > a && b > c) 7 | return b; 8 | else 9 | return c; 10 | } 11 | int main() 12 | { 13 | int a,b,c; 14 | printf(“nEnter three numbers : “); 15 | scanf(“%d %d %d”,&a,&b,&c); 16 | int max = largest_among_three(a,b,c); 17 | printf(“nThe largest among the three numbers is %d ” , max); 18 | printf(“n”); 19 | return 0; 20 | -------------------------------------------------------------------------------- /Programs/Jitesh1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | int array[100], search, c, n; 5 | 6 | printf("Enter number of elements in array\n"); 7 | scanf("%d", &n); 8 | 9 | printf("Enter %d integer(s)\n", n); 10 | 11 | for (c = 0; c < n; c++) 12 | scanf("%d", &array[c]); 13 | 14 | printf("Enter a number to search\n"); 15 | scanf("%d", &search); 16 | 17 | for (c = 0; c < n; c++) 18 | { 19 | if (array[c] == search) /* If required element is found */ 20 | { 21 | printf("%d is present at location %d.\n", search, c+1); 22 | break; 23 | } 24 | } 25 | if (c == n) 26 | printf("%d isn't present in the array.\n", search); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Programs/Minimumnoofhandshake.c: -------------------------------------------------------------------------------- 1 | #include 2 | int main() 3 | { 4 | //fill the code 5 | int num; 6 | scanf(“%d”,&num); 7 | int total = num * (num-1) / 2; // Combination nC2 8 | printf(“%d”,total); 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /Programs/Palindrome.java: -------------------------------------------------------------------------------- 1 | package whileLoop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Palindrome { 6 | 7 | public static void main(String[] args) { 8 | Scanner sc = new Scanner(System.in); 9 | System.out.println("Enter the number: "); 10 | int n = sc.nextInt(); 11 | int temp = n; 12 | int reversedNumber = 0; 13 | 14 | while(temp != 0) { 15 | int remainder = temp % 10; 16 | reversedNumber = reversedNumber * 10 + remainder; 17 | temp = temp / 10; 18 | } 19 | 20 | if(n == reversedNumber) { 21 | System.out.println("the number is palindrome"); 22 | }else { 23 | System.out.println("the number is not palindrome"); 24 | } 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /Programs/Palindromic_Pyramid/Palindromic_Pyramid.py: -------------------------------------------------------------------------------- 1 | # Python program for Palindrome pyramid pattern printing using numbers 2 | n = int(input("Enter the number of rows : ")) 3 | for i in range(1,n+1, +1): 4 | for j in range(1,i+1 ,+1): 5 | print(j , end=" "); 6 | for h in range((i-1),0,-1): 7 | print(h, end = " ") 8 | print(end = "\n") 9 | 10 | """Ouput: 11 | Enter the number of rows : 8 12 | 1 13 | 1 2 1 14 | 1 2 3 2 1 15 | 1 2 3 4 3 2 1 16 | 1 2 3 4 5 4 3 2 1 17 | 1 2 3 4 5 6 5 4 3 2 1 18 | 1 2 3 4 5 6 7 6 5 4 3 2 1 19 | 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1 20 | """ 21 | -------------------------------------------------------------------------------- /Programs/Palindromic_Pyramid/Readme.md: -------------------------------------------------------------------------------- 1 |

Palindromic Pyramid

2 | 3 | ## Problem Statement 4 | The palindromic number are the number whose reverse is equal to the original number. Given number of rows print a valid palindromic pyramid. 5 | 6 | ### Sample Input 7 | Enter the number of rows : 8 8 | 9 | ### Sample Output 10 | 1
11 | 1 2 1
12 | 1 2 3 2 1
13 | 1 2 3 4 3 2 1
14 | 1 2 3 4 5 4 3 2 1
15 | 1 2 3 4 5 6 5 4 3 2 1
16 | 1 2 3 4 5 6 7 6 5 4 3 2 1
17 | 1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
18 | 19 | ### Sample Input 20 | Enter the number of rows : 4 21 | 22 | ### Sample Output 23 | 1
24 | 1 2 1
25 | 1 2 3 2 1
26 | 1 2 3 4 3 2 1
27 | 28 | 29 | ## *Author Name* 30 | [Harshal S Zodape](https://github.com/Harshalszz) -------------------------------------------------------------------------------- /Programs/README.md: -------------------------------------------------------------------------------- 1 | ### Following are the steps to add your Programs to this Repository: 2 | - Now FORK this Repository. 3 | - Clone the forked repo at your local PC using git clone . 4 | - Browse to the location where repository got cloned at your system. 5 | - Then go inside the Programs folder and Create a New Folder with your name. 6 | - Now inside that folder and paste your program code. 7 | - Add, commit and Push the Changes using the usual Git commands (Not Sure? See Git/GitHub Basics on YouTube). 8 | - Now open the forked repository on GitHub, where you will notice a Pull Request Button. 9 | - Click on it and Make A Pull Request and you are DONE!. 10 | #### Congratulations you have added your program.🥳 11 | 12 | ##
Note:-
13 | 14 | ##### 1. Don't copy the code from anywhere on the net. 15 | ##### 2. Codes like 'helloworld', 'sum of 2 nos.', etc won't be accepted.😔 16 | ##### 3. Deadline is 31st October. 17 | ##### 4. We will personally check each code and if I find any code not following the rules, then his/her Pull Request will be marked as SPAM and it won't be counted.😥 18 | ## 19 | -------------------------------------------------------------------------------- /Programs/RadixSort.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.util.*; 3 | 4 | class Radix { 5 | 6 | // A utility function to get maximum value in arr[] 7 | static int getMax(int arr[], int n) 8 | { 9 | int mx = arr[0]; 10 | for (int i = 1; i < n; i++) 11 | if (arr[i] > mx) 12 | mx = arr[i]; 13 | return mx; 14 | } 15 | 16 | // A function to do counting sort of arr[] according to 17 | // the digit represented by exp. 18 | static void countSort(int arr[], int n, int exp) 19 | { 20 | int output[] = new int[n]; // output array 21 | int i; 22 | int count[] = new int[10]; 23 | Arrays.fill(count, 0); 24 | 25 | // Store count of occurrences in count[] 26 | for (i = 0; i < n; i++) 27 | count[(arr[i] / exp) % 10]++; 28 | 29 | // Change count[i] so that count[i] now contains 30 | // actual position of this digit in output[] 31 | for (i = 1; i < 10; i++) 32 | count[i] += count[i - 1]; 33 | 34 | // Build the output array 35 | for (i = n - 1; i >= 0; i--) { 36 | output[count[(arr[i] / exp) % 10] - 1] = arr[i]; 37 | count[(arr[i] / exp) % 10]--; 38 | } 39 | 40 | // Copy the output array to arr[], so that arr[] now 41 | // contains sorted numbers according to curent digit 42 | for (i = 0; i < n; i++) 43 | arr[i] = output[i]; 44 | } 45 | 46 | // The main function to that sorts arr[] of size n using 47 | // Radix Sort 48 | static void radixsort(int arr[], int n) 49 | { 50 | // Find the maximum number to know number of digits 51 | int m = getMax(arr, n); 52 | 53 | // Do counting sort for every digit. Note that 54 | // instead of passing digit number, exp is passed. 55 | // exp is 10^i where i is current digit number 56 | for (int exp = 1; m / exp > 0; exp *= 10) 57 | countSort(arr, n, exp); 58 | } 59 | 60 | // A utility function to print an array 61 | static void print(int arr[], int n) 62 | { 63 | for (int i = 0; i < n; i++) 64 | System.out.print(arr[i] + " "); 65 | } 66 | 67 | /*Driver Code*/ 68 | public static void main(String[] args) 69 | { 70 | int arr[] = { 170, 45, 75, 90, 802, 24, 2, 66 }; 71 | int n = arr.length; 72 | 73 | // Function Call 74 | radixsort(arr, n); 75 | print(arr, n); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Programs/RecursiveInsertionSort.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void insertionSort(int arr[], int i, int n) 4 | { 5 | int value=arr[i]; 6 | int j=i; 7 | while (j>0 && arr[j-1]>value) 8 | { 9 | arr[j]=arr[j-1]; 10 | j--; 11 | } 12 | arr[j]=value; 13 | if (i+1<=n) 14 | insertionSort(arr, i+1, n); 15 | } 16 | 17 | int main() 18 | { 19 | int i,num; 20 | printf("------------------------------------------\n"); 21 | printf("Recursive implementation of Insertion Sort\n"); 22 | printf("------------------------------------------\n"); 23 | printf("Enter number of elements: "); 24 | scanf("%d",&num); 25 | int arr[num]; 26 | printf("Enter numbers: \n"); 27 | for(i=0;i 2 | 3 | void selectionSort(int arr[], int i, int j, int num, int flag) 4 | { 5 | if(iarr[j]) 12 | { 13 | //swap without third variable 14 | arr[i]=arr[i]+arr[j]; 15 | arr[j]=arr[i]-arr[j]; 16 | arr[i]=arr[i]-arr[j]; 17 | } 18 | selectionSort(arr, i, j+1, num, 0); 19 | } 20 | selectionSort(arr, i+1, 0, num, 1); 21 | } 22 | } 23 | 24 | int main() 25 | { 26 | int i,j,num,pos,temp; 27 | printf("------------------------------------------\n"); 28 | printf("Recursive implementation of Selection Sort\n"); 29 | printf("------------------------------------------\n"); 30 | printf("Enter number of elements: "); 31 | scanf("%d",&num); 32 | int arr[num]; 33 | printf("Enter numbers: \n"); 34 | for(i=0;i 2 | 3 | int main() 4 | { 5 | int n; 6 | scanf("%d",&n); 7 | int mat[n][n],i,j; 8 | for(i=0;i=0;i--) 18 | { 19 | printf("%d ",mat[i][j]); 20 | } 21 | printf("\n"); 22 | } 23 | 24 | 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /Programs/Saurabh/fibonacci_sum_last_digit.cpp: -------------------------------------------------------------------------------- 1 | //Program to find last digit of sum of fibonacci series 2 | #include 3 | #define ll long long 4 | using namespace std; 5 | 6 | int fibonacci_sum_fast(ll n){ 7 | n=n%60; 8 | vector f(n+1); 9 | f[0]=0; 10 | f[1]=1; 11 | int sum=0; 12 | for (ll i = 1; i <=n; i++) 13 | { 14 | if(i==1)sum+=f[i]; 15 | else{ 16 | f[i]=(f[i-1]+f[i-2])%10; 17 | sum=(sum+f[i])%10; 18 | } 19 | } 20 | return sum; 21 | 22 | } 23 | 24 | int main() { 25 | long long n = 0; 26 | std::cin >> n; 27 | std::cout << fibonacci_sum_fast(n); 28 | } 29 | -------------------------------------------------------------------------------- /Programs/Simple_Corona_Statistics_Shower /README.md: -------------------------------------------------------------------------------- 1 | This project will show 2 | 3 | - How many people currently count positive for Corona virus of a country 4 | - Total ammount of peoples those are positive for Corona virus of a country 5 | - How many people get cured 6 | - How many people died 7 | 8 | It shows these data for Bangladesh also. 9 | 10 | Here I have collect data from a api `https://lab.isaaclin.cn/nCoV/api/` 11 | Thanks [Isaac Lin](https://github.com/BlankerL) for the api to get updated dataset. 12 | -------------------------------------------------------------------------------- /Programs/Simple_Corona_Statistics_Shower /output2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Programs/Simple_Corona_Statistics_Shower /output2.png -------------------------------------------------------------------------------- /Programs/Simple_Corona_Statistics_Shower /output_scrot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Programs/Simple_Corona_Statistics_Shower /output_scrot.png -------------------------------------------------------------------------------- /Programs/SmallestLargest.java: -------------------------------------------------------------------------------- 1 | package array; 2 | 3 | import java.util.Scanner; 4 | 5 | public class SmallestLargest { 6 | 7 | public static void main(String[] args) { 8 | Scanner in = new Scanner(System.in); 9 | int count, max, min, i; 10 | int[] inputArray = new int[500]; 11 | 12 | System.out.print("Enter the number of elements : "); 13 | count = in.nextInt(); 14 | System.out.println("Enter " + count + " elements"); 15 | 16 | for(i = 0; i < count; i++) { 17 | inputArray[i] = in.nextInt(); 18 | 19 | } 20 | 21 | max = min = inputArray[0]; 22 | 23 | for(i = 1; i < count; i++) { 24 | if(inputArray[i] > max) { 25 | max = inputArray[i]; 26 | }else if (inputArray[i] < min) { 27 | min = inputArray[i]; 28 | } 29 | System.out.println("Largest number: " + max); 30 | System.out.println("Smallest number: " + min); 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Programs/Spiralmatrix.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int main() 4 | { 5 | int n,m; 6 | printf(“\nInput the number of rows : “); 7 | scanf(“%d”,&m); 8 | printf(“\nInput the number of columns : “); 9 | scanf(“%d”,&n); 10 | int arr[m][n]; 11 | int i,j; 12 | printf(“\nInput the matrix \n”); 13 | for(i = 0; i < m; i++) 14 | { 15 | for(j = 0; j < n; j++) 16 | { 17 | scanf(“%d”,&arr[i][j]); 18 | } 19 | } 20 | printf(“\nThe Matrix is \n”); 21 | for(i = 0; i < m; i++) 22 | { 23 | for(j = 0; j < n; j++) 24 | { 25 | printf(“%d “,arr[i][j]); 26 | } 27 | printf(“\n”); 28 | } 29 | printf(“\nSpiral Matrix : “); 30 | int k = 0, l = 0; 31 | while(k < m && l < n) 32 | { 33 | for(i = l; i < n; i++) 34 | { 35 | printf(“%d “,arr[k][i]); 36 | } 37 | k++; 38 | for(i = k; i < m; i++) 39 | { 40 | printf(“%d “,arr[i][n-1]); 41 | } 42 | n–; 43 | if(k < m) 44 | { 45 | for(i = n – 1; i >= 0; –i) 46 | { 47 | printf(“%d “,arr[m-1][i]); 48 | } 49 | m–; 50 | } 51 | if(l < n) 52 | { 53 | for(i = m – 1; i >= k; i–) 54 | { 55 | printf(“%d “,arr[i][l]); 56 | } 57 | l++; 58 | } 59 | } 60 | return 0; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Programs/Subset.c: -------------------------------------------------------------------------------- 1 | // C program to check if an array is a subset of another array 2 | 3 | #include 4 | 5 | bool isSubset(int arr1[], int arr2[], 6 | int m, int n) 7 | { 8 | int i = 0; 9 | int j = 0; 10 | for (i = 0; i < n; i++) 11 | { 12 | for (j = 0; j < m; j++) 13 | { 14 | if(arr2[i] == arr1[j]) 15 | break; 16 | } 17 | 18 | if (j == m) 19 | return 0; 20 | } 21 | 22 | return 1; 23 | } 24 | 25 | int main() 26 | { 27 | int m,n; 28 | printf(“\nEnter the size of array 1 : “); 29 | scanf(“%d”, &m); 30 | printf(“\nEnter the size of array 2 : “); 31 | scanf(“%d”, &n); 32 | int arr1[m],arr2[n]; 33 | int i; 34 | printf(“\nEnter the array 1 elements : “); 35 | for(i=0;i 4 | 5 | void symmetric_array_pair(int arr1[], int arr2[], int m, int n) 6 | { 7 | int i,j; 8 | for(i=0;i= a2 <= a3 >= a4 <= a5..... 2 | Eg- 3 | input- 1 2 3 4 4 | output- 2 1 4 3 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | using namespace std; 11 | 12 | int main(){ 13 | vector A = { 1,2,3,4 }; 14 | sort(A.begin(),A.end()); //in built sort function 15 | for(int i=0;i 2 | int main() 3 | { 4 | int array[100], search, c, n; 5 | 6 | printf("Enter number of elements in array\n"); 7 | scanf("%d", &n); 8 | 9 | printf("Enter %d integer(s)\n", n); 10 | 11 | for (c = 0; c < n; c++) 12 | scanf("%d", &array[c]); 13 | 14 | printf("Enter a number to search\n"); 15 | scanf("%d", &search); 16 | 17 | for (c = 0; c < n; c++) 18 | { 19 | if (array[c] == search) /* If required element is found */ 20 | { 21 | printf("%d is present at location %d.\n", search, c+1); 22 | break; 23 | } 24 | } 25 | if (c == n) 26 | printf("%d isn't present in the array.\n", search); 27 | 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Programs/checkPrime.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class CheckPrime{ 3 | public static void main(String[] args) { 4 | 5 | Scanner sc = new Scanner(System.in); 6 | 7 | System.out.println("enter a number"); 8 | int n = sc.nextInt(); 9 | 10 | boolean isprime = true; 11 | for(int i=2; i*i<=n;i++){ 12 | if(n%i==0){ 13 | isprime = false; 14 | break; 15 | } 16 | } 17 | if(n<2){ 18 | isprime = false; 19 | } 20 | if(isprime==false){ 21 | System.out.print(n+" is not a Prime Number"); 22 | }else{ 23 | System.out.print(n+" is a Prime Number"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Programs/circularlinkedlist.c: -------------------------------------------------------------------------------- 1 | Live Demo 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | struct node { 8 | int data; 9 | int key; 10 | 11 | struct node *next; 12 | }; 13 | 14 | struct node *head = NULL; 15 | struct node *current = NULL; 16 | 17 | bool isEmpty() { 18 | return head == NULL; 19 | } 20 | 21 | int length() { 22 | int length = 0; 23 | 24 | //if list is empty 25 | if(head == NULL) { 26 | return 0; 27 | } 28 | 29 | current = head->next; 30 | 31 | while(current != head) { 32 | length++; 33 | current = current->next; 34 | } 35 | 36 | return length; 37 | } 38 | 39 | //insert link at the first location 40 | void insertFirst(int key, int data) { 41 | 42 | //create a link 43 | struct node *link = (struct node*) malloc(sizeof(struct node)); 44 | link->key = key; 45 | link->data = data; 46 | 47 | if (isEmpty()) { 48 | head = link; 49 | head->next = head; 50 | } else { 51 | //point it to old first node 52 | link->next = head; 53 | 54 | //point first to new first node 55 | head = link; 56 | } 57 | } 58 | 59 | //delete first item 60 | struct node * deleteFirst() { 61 | 62 | //save reference to first link 63 | struct node *tempLink = head; 64 | 65 | if(head->next == head) { 66 | head = NULL; 67 | return tempLink; 68 | } 69 | 70 | //mark next to first link as first 71 | head = head->next; 72 | 73 | //return the deleted link 74 | return tempLink; 75 | } 76 | 77 | //display the list 78 | void printList() { 79 | 80 | struct node *ptr = head; 81 | printf("\n[ "); 82 | 83 | //start from the beginning 84 | if(head != NULL) { 85 | 86 | while(ptr->next != ptr) { 87 | printf("(%d,%d) ",ptr->key,ptr->data); 88 | ptr = ptr->next; 89 | } 90 | } 91 | 92 | printf(" ]"); 93 | } 94 | 95 | void main() { 96 | insertFirst(1,10); 97 | insertFirst(2,20); 98 | insertFirst(3,30); 99 | insertFirst(4,1); 100 | insertFirst(5,40); 101 | insertFirst(6,56); 102 | 103 | printf("Original List: "); 104 | 105 | //print list 106 | printList(); 107 | 108 | while(!isEmpty()) { 109 | struct node *temp = deleteFirst(); 110 | printf("\nDeleted value:"); 111 | printf("(%d,%d) ",temp->key,temp->data); 112 | } 113 | 114 | printf("\nList after deleting all items: "); 115 | printList(); 116 | } 117 | -------------------------------------------------------------------------------- /Programs/guess_number.py: -------------------------------------------------------------------------------- 1 | """ 2 | A small game using python. 3 | In this game, user input a number and then computer generate a random number. 4 | If numbers are equal then you win else loss. 5 | """ 6 | import random 7 | import sys 8 | 9 | 10 | class GuessNumber: 11 | """GuessNumber""" 12 | 13 | """Method to allow user to exit game""" 14 | @staticmethod 15 | def exit_game(): 16 | sys.exit() 17 | 18 | def user_input(self): 19 | """Method to take input from user.""" 20 | self.num = input("Guess a number: ") 21 | if self.num == int: 22 | return self.num 23 | else: 24 | if self.num == str: 25 | return self.num 26 | 27 | def computer_output(self): 28 | """Method to generate random number and checks for the equality.""" 29 | self.random_number = random.randint(1, 100) 30 | if self.num == self.random_number: 31 | print("Hurray! You won and number is {}".format(self.num)) 32 | elif self.num == "exit" or "e": 33 | guess.exit_game() 34 | else: 35 | print("Please try again") 36 | 37 | 38 | # Driver code 39 | # while True: 40 | if __name__ == "__main__": 41 | guess = GuessNumber() 42 | guess.user_input() 43 | guess.computer_output() 44 | guess.exit_game() 45 | 46 | -------------------------------------------------------------------------------- /Programs/heapsort.py: -------------------------------------------------------------------------------- 1 | # Python program for implementation of heap Sort 2 | 3 | # To heapify subtree rooted at index i. 4 | # n is size of heap 5 | def heapify(arr, n, i): 6 | largest = i # Initialize largest as root 7 | l = 2 * i + 1 # left = 2*i + 1 8 | r = 2 * i + 2 # right = 2*i + 2 9 | 10 | # See if left child of root exists and is 11 | # greater than root 12 | if l < n and arr[i] < arr[l]: 13 | largest = l 14 | 15 | # See if right child of root exists and is 16 | # greater than root 17 | if r < n and arr[largest] < arr[r]: 18 | largest = r 19 | 20 | # Change root, if needed 21 | if largest != i: 22 | arr[i],arr[largest] = arr[largest],arr[i] # swap 23 | 24 | # Heapify the root. 25 | heapify(arr, n, largest) 26 | 27 | # The main function to sort an array of given size 28 | def heapSort(arr): 29 | n = len(arr) 30 | 31 | # Build a maxheap. 32 | for i in range(n//2 - 1, -1, -1): 33 | heapify(arr, n, i) 34 | 35 | # One by one extract elements 36 | for i in range(n-1, 0, -1): 37 | arr[i], arr[0] = arr[0], arr[i] # swap 38 | heapify(arr, i, 0) 39 | 40 | # Driver code to test above 41 | arr = [ 12, 11, 13, 5, 6, 7] 42 | heapSort(arr) 43 | n = len(arr) 44 | print ("Sorted array is") 45 | for i in range(n): 46 | print ("%d" %arr[i]), 47 | -------------------------------------------------------------------------------- /Programs/img2pdf/img2pdf.py: -------------------------------------------------------------------------------- 1 | from fpdf import FPDF 2 | from PIL import Image 3 | import glob 4 | import os 5 | 6 | image_extensions = ("*.png", "*.jpg") 7 | images = [] 8 | 9 | pdf = FPDF() 10 | 11 | w, h = 0, 0 12 | 13 | for extension in image_extensions: 14 | images.extend(glob.glob(extension)) 15 | 16 | for i in range(0, len(images)): 17 | print(images[i]) 18 | 19 | for i in range(0, len(images)): 20 | cover = Image.open(images[i]) 21 | w, h = cover.size 22 | 23 | for image in images: 24 | pdf.add_page() 25 | 26 | pdf.image(image, 0, 0, 210, 297) 27 | 28 | print("\nFound " + str(len(images)) + 29 | " image files. Converting to PDF....\n") 30 | pdf.output("Output.pdf", "F") 31 | print("Done!") 32 | -------------------------------------------------------------------------------- /Programs/index.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def test(): 4 | os.chdir("D:/Users/Files") 5 | files = os.listdir(".") 6 | for x in files: 7 | with open(x, "r") as inputFile: 8 | content = inputFile.read() 9 | with open(x, "wb") as outputFile: 10 | outputFile.write(content.upper()) 11 | -------------------------------------------------------------------------------- /Programs/largestsum: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | 5 | int maxSubArraySum(int a[], int size) 6 | { 7 | int max_so_far = INT_MIN, max_ending_here = 0; 8 | 9 | for (int i = 0; i < size; i++) 10 | { 11 | max_ending_here = max_ending_here + a[i]; 12 | if (max_so_far < max_ending_here) 13 | max_so_far = max_ending_here; 14 | 15 | if (max_ending_here < 0) 16 | max_ending_here = 0; 17 | } 18 | return max_so_far; 19 | } 20 | 21 | /Driver program to test maxSubArraySum/ 22 | int main() 23 | { 24 | int a[] = {-2, -3, 4, -1, -2, 1, 5, -3}; 25 | int n = sizeof(a)/sizeof(a[0]); 26 | int max_sum = maxSubArraySum(a, n); 27 | cout << "Maximum contiguous sum is " << max_sum; 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /Programs/linear_multiple.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | int array[100], search, c, n, count = 0; 6 | 7 | printf("Enter number of elements in array\n"); 8 | scanf("%d", &n); 9 | 10 | printf("Enter %d numbers\n", n); 11 | 12 | for (c = 0; c < n; c++) 13 | scanf("%d", &array[c]); 14 | 15 | printf("Enter a number to search\n"); 16 | scanf("%d", &search); 17 | 18 | for (c = 0; c < n; c++) { 19 | if (array[c] == search) { 20 | printf("%d is present at location %d.\n", search, c+1); 21 | count++; 22 | } 23 | } 24 | if (count == 0) 25 | printf("%d isn't present in the array.\n", search); 26 | else 27 | printf("%d is present %d times in the array.\n", search, count); 28 | 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /Programs/linear_search.c: -------------------------------------------------------------------------------- 1 | long linear_search(long *p, long n, 2 | long find) { 3 | long c; 4 | 5 | for (c = 0; c < n; c++) { 6 | if (*(p+c) == find) 7 | return c; 8 | } 9 | 10 | return -1; 11 | } 12 | -------------------------------------------------------------------------------- /Programs/number guessing: -------------------------------------------------------------------------------- 1 | import random 2 | attempts_list = [] 3 | def show_score(): 4 | if len(attempts_list) <= 0: 5 | print("There is currently no high score, it's yours for the taking!") 6 | else: 7 | print("The current high score is {} attempts".format(min(attempts_list))) 8 | def start_game(): 9 | random_number = int(random.randint(1, 10)) 10 | print("Hello traveler! Welcome to the game of guesses!") 11 | player_name = input("What is your name? ") 12 | wanna_play = input("Hi, {}, would you like to play the guessing game? (Enter Yes/No) ".format(player_name)) 13 | attempts = 0 14 | show_score() 15 | while wanna_play.lower() == "yes": 16 | try: 17 | guess = input("Pick a number between 1 and 10 ") 18 | if int(guess) < 1 or int(guess) > 10: 19 | raise ValueError("Please guess a number within the given range") 20 | if int(guess) == random_number: 21 | print("Nice! You got it!") 22 | attempts += 1 23 | attempts_list.append(attempts) 24 | print("It took you {} attempts".format(attempts)) 25 | play_again = input("Would you like to play again? (Enter Yes/No) ") 26 | attempts = 0 27 | show_score() 28 | random_number = int(random.randint(1, 10)) 29 | if play_again.lower() == "no": 30 | print("That's cool, have a good one!") 31 | break 32 | elif int(guess) > random_number: 33 | print("It's lower") 34 | attempts += 1 35 | elif int(guess) < random_number: 36 | print("It's higher") 37 | attempts += 1 38 | except ValueError as err: 39 | print("Oh no!, that is not a valid value. Try again...") 40 | print("({})".format(err)) 41 | else: 42 | print("That's cool, have a good one!") 43 | if __name__ == '__main__': 44 | start_game() 45 | -------------------------------------------------------------------------------- /Programs/pointerBasedMatrixAddition.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | 6 | int m,n; 7 | scanf("%d%d",&m,&n); 8 | int *ptr1=(int*)malloc((m*n)*sizeof(int)); 9 | int *ptr2=(int*)malloc((m*n)*sizeof(int)); 10 | for(int i=0;i 2 | using namespace std; 3 | 4 | 5 | template // Template applied. 6 | class quickSort { 7 | private: // Variables initialised. 8 | dt arr[10000]; 9 | int size = 0; 10 | int mid; 11 | 12 | public: 13 | void exchange(int m, int n) { // Function to exchange values. 14 | dt temp = arr[m]; 15 | arr[m] = arr[n]; 16 | arr[n] = temp; 17 | } 18 | 19 | void sort() { // Function to initialise quick-sort. 20 | quick_sort(0,size-1); 21 | } 22 | 23 | void fillArray(int i, dt value) { // Function to get array from input. 24 | arr[i] = value; 25 | size++; 26 | } 27 | 28 | int partition(int l, int h) { // Function for getting partition index. 29 | dt pivot = arr[l]; 30 | int i=l, j=l+1; 31 | while(j<=h) { 32 | if(arr[j]<=pivot) { 33 | exchange(i+1, j); 34 | i=i+1; 35 | } 36 | j=j+1; 37 | } 38 | exchange(l,i); 39 | return i; 40 | } 41 | 42 | void quick_sort(int l, int h) { // Function to apply quick-sort algorithm. 43 | if(h<=l) 44 | return; 45 | mid = partition(l,h); 46 | quick_sort(l, mid-1); 47 | quick_sort(mid+1, h); 48 | } 49 | 50 | void dispArray() { // Function to display array. 51 | for(int i=0 ; i obj; 59 | int n; 60 | double temp; 61 | cin >> n; 62 | for(int i=0 ; i> temp; 64 | obj.fillArray(i, temp); 65 | } 66 | obj.sort(); 67 | obj.dispArray(); 68 | return 0; 69 | } 70 | -------------------------------------------------------------------------------- /Programs/satyam.c: -------------------------------------------------------------------------------- 1 | #include > 2 | int largest_among_three(int a, int b, int c) 3 | { 4 | if(a > b && a > c) 5 | return a; 6 | else if(b > a && b > c) 7 | return b; 8 | else 9 | return c; 10 | } 11 | int main() 12 | { 13 | int a,b,c; 14 | printf(“nEnter three numbers : “); 15 | scanf(“%d %d %d”,&a,&b,&c); 16 | int max = largest_among_three(a,b,c); 17 | printf(“nThe largest among the three numbers is %d ” , max); 18 | printf(“n”); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /Programs/srivatsav/balanced_brackets.py: -------------------------------------------------------------------------------- 1 | # Program to find whether given input string has balanced brackets or not 2 | def isBalanced(s): 3 | a=[] 4 | for i in range(len(s)): 5 | if s[i]=='{' or s[i]=='[' or s[i]=='(': 6 | a.append(s[i]) 7 | if s[i]=='}': 8 | if len(a)==0: 9 | return "NO" 10 | else: 11 | if a[-1]=='{': 12 | a.pop() 13 | else: 14 | break 15 | if s[i]==']': 16 | if len(a)==0: 17 | return "NO" 18 | else: 19 | if a[-1]=='[': 20 | a.pop() 21 | else: 22 | break 23 | if s[i]==')': 24 | if len(a)==0: 25 | return "NO" 26 | else: 27 | if a[-1]=='(': 28 | a.pop() 29 | else: 30 | break 31 | if len(a)==0: 32 | return "YES" 33 | else: 34 | return "NO" 35 | 36 | inp = input('Enter your query string: ') 37 | #sample input: {)[](}]}]}))}(())( 38 | 39 | print(isBalanced(inp)) 40 | -------------------------------------------------------------------------------- /Programs/star_pattern.c: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int star(int n) 5 | { 6 | if(n==0) 7 | return 0; 8 | printf("*"); 9 | n--; 10 | star(n); 11 | } 12 | 13 | int main() 14 | { 15 | int n,i; 16 | cout<<" ENter and number for patern : "; 17 | cin>>n; 18 | for(i=1;i<=n;i++) 19 | { 20 | star(i); 21 | cout<<"\n"; 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /Programs/star_pattern2.c: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int main() 5 | { 6 | int i,n; 7 | cout<<"Enter the number for pattern:"; 8 | cin>>n; 9 | for(i=1;i<0;i++) 10 | { 11 | cout<<"*"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Programs/strangequeries.cpp: -------------------------------------------------------------------------------- 1 | def solve (arr, L2, R1, R2, L1): 2 | # Write your code here 3 | ans = [] 4 | eq =[] 5 | match = [] 6 | # print(arr) 7 | n = len(R2) 8 | # print(n) 9 | # print(L2) 10 | for i in range(len(arr)): 11 | for j in range(i,len(arr)): 12 | if(arr[i]==arr[j]): 13 | match.append([i+1,j+1]) 14 | if(i!=j): 15 | match.append([j+1,i+1]) 16 | 17 | 18 | # print(match) 19 | for m in range(n): 20 | # print("m = ",m) 21 | l1 = L1[m] 22 | l2 = L2[m] 23 | r1 = R1[m] 24 | r2 = R2[m] 25 | # if(m==n-1): 26 | # print("l1 = ",l1," l2 = ",l2," r1 = ",r1," r2 = ",r2) 27 | count=0 28 | for g in range(len(match)): 29 | ii = match[g][0] 30 | jj = match[g][1] 31 | if(ii>=l1 and ii<=r1 and jj>=l2 and jj<=r2): 32 | count+=1 33 | # print("l1 = ",l1," l2 = ",l2," r1 = ",r1," r2 = ",r2) 34 | # for i in range(l1-1,r1): 35 | # for j in range(l2-1,r2): 36 | # # print("i = ",i," j = ",j) 37 | # if(arr[i]==arr[j]): 38 | # count+=1 39 | ans.append(count) 40 | # ans.append(0) 41 | # print("Ans is",ans) 42 | return ans 43 | 44 | N = int(input()) 45 | arr = list(map(int, input().split())) 46 | Q = int(input()) 47 | L1 = [] 48 | R1 = [] 49 | L2 = [] 50 | R2 = [] 51 | for i in range(Q): 52 | l1,r1,l2,r2 = map(int, input().split()) 53 | L1.append(l1) 54 | L2.append(l2) 55 | R1.append(r1) 56 | R2.append(r2) 57 | 58 | out_ = solve(arr, L2, R1, R2, L1) 59 | print ('\n'.join(map(str, out_))) 60 | -------------------------------------------------------------------------------- /Programs/sumOfDigit.java: -------------------------------------------------------------------------------- 1 | package whileLoop; 2 | 3 | import java.util.Scanner; 4 | 5 | public class sumOfDigit { 6 | 7 | public static void main(String[] args) { 8 | Scanner sc = new Scanner(System.in); 9 | long n = sc.nextInt(); 10 | long temp = n; 11 | long sum = 0; 12 | while(temp > 0) { 13 | 14 | long ld = temp % 10; 15 | temp /= 10; 16 | sum += ld; 17 | } 18 | System.out.println(sum); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /Programs/therc01/readme.md: -------------------------------------------------------------------------------- 1 | My codes for **Hacktober fest 2020** 2 | -------------------------------------------------------------------------------- /Programs/therc01/search.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | struct node_type 5 | { 6 | int info; 7 | struct node_type *next; 8 | }; 9 | 10 | typedef struct node_type node; 11 | void search(node *start) 12 | { 13 | node *ptr, *loc; 14 | ptr=start; 15 | int item; 16 | printf("Enter value to search"); 17 | scanf("%d",&item); 18 | while(ptr!=NULL) 19 | { 20 | if (ptr ->info == item) 21 | loc=ptr; 22 | else 23 | ptr = ptr ->next; 24 | } 25 | if (loc == NULL) 26 | printf("Unsuccessful Search"); 27 | else 28 | printf("Successful"); 29 | printf("Value is %d",ptr->info); 30 | } 31 | node *create(node *start) 32 | { 33 | node *temp; 34 | int item; 35 | puts("Enter the Value:"); 36 | scanf("%d",&item); 37 | while(item!=-999) 38 | { 39 | temp=(node*)malloc(sizeof(node)); 40 | temp ->info=item; 41 | temp ->next=start; 42 | start=temp; 43 | puts("Enter the Value:"); 44 | scanf("%d",&item); 45 | } 46 | return(start); 47 | } 48 | 49 | void display(node *start) 50 | { 51 | node *ptr; 52 | ptr=start; 53 | while(ptr!=NULL) 54 | { 55 | printf("%d ", ptr ->info); 56 | ptr = ptr ->next; 57 | } printf("\n"); 58 | } 59 | node * start = NULL; 60 | void main(){ 61 | create(start); 62 | display(start); 63 | search(start); 64 | } -------------------------------------------------------------------------------- /Programs/therc01/stack.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | struct stack 5 | { 6 | int info; 7 | struct stack *next; 8 | }; 9 | typedef struct stack stack; 10 | stack *top = NULL; 11 | int count = 0; 12 | int push(){ 13 | stack *temp; 14 | temp = (stack*)malloc(sizeof(stack)); 15 | printf("Enter the value"); 16 | scanf("%d",&temp->info); 17 | temp->next = top; 18 | top = temp; 19 | count++; 20 | return(top); 21 | }; 22 | int pop(stack * top){ 23 | stack *ptr; 24 | ptr = top; 25 | int item; 26 | if(top == NULL){ 27 | printf("Empty stack"); 28 | } 29 | else 30 | { 31 | while(top!= NULL){ 32 | top = top->next; 33 | } 34 | item = top->info; 35 | count--; 36 | printf("Item poped %d\n",item); 37 | } 38 | return(top); 39 | }; 40 | void display(stack*top){ 41 | stack *ptr; 42 | ptr = top; 43 | int lop; 44 | if(count == 0){ 45 | printf("Empty stack"); 46 | } 47 | else{ 48 | lop = count; 49 | printf("Stack is:"); 50 | while(lop != 0){ 51 | 52 | printf("\n Number is %d",ptr->info); 53 | ptr = ptr->next; 54 | lop--; 55 | } 56 | } 57 | 58 | }; 59 | void main(){ 60 | int a = 0; 61 | while(a != 4){ 62 | printf("\n1: Push operation"); 63 | printf("\n2: POP operation"); 64 | printf("\n3: Dislay stack"); 65 | printf("\n4: Exit"); 66 | printf("\nEnter the choice"); 67 | scanf("%d",&a); 68 | 69 | 70 | switch (a) 71 | { 72 | case 1: 73 | push(top); 74 | display(top); 75 | break; 76 | case 2: 77 | pop(top); 78 | //display(top); 79 | break; 80 | case 3: 81 | display(top); 82 | break; 83 | default: 84 | break; 85 | } 86 | } 87 | } -------------------------------------------------------------------------------- /Programs/trailingZerotoFact.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | using namespace std; 3 | 4 | int trailingzero(int n) 5 | { 6 | int count = 0; 7 | 8 | for(int i = 5;n / i >= 1;i *= 5) 9 | { 10 | count += n / i; 11 | } 12 | return count; 13 | } 14 | 15 | int main() 16 | { 17 | int n; 18 | cin >> n; 19 | cout << trailingzero(n); 20 | return 0; 21 | } 22 | -------------------------------------------------------------------------------- /Programs/usingHeapLargestKElementInRunningStreamOfNumbers.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | //#include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | void query_print(priority_queue,greater> pq) 10 | { 11 | while(!pq.empty()) 12 | { 13 | cout<,greater> pq; 23 | 24 | int k=3; 25 | int cs=0; 26 | 27 | while(scanf("%d",&no)!=EOF) 28 | { 29 | if(no==-1) 30 | { 31 | query_print(pq); 32 | } 33 | else if(cspq.top()) 41 | { 42 | pq.pop(); 43 | pq.push(no); 44 | } 45 | } 46 | } 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /Projects/Facebook API.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# Facebook Graph API " 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 9, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "import requests\n", 17 | "import os\n", 18 | "#link for api\n", 19 | "url = 'https://graph.facebook.com/{}/picture?type=large'\n", 20 | "#place holder for random url" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 11, 26 | "metadata": {}, 27 | "outputs": [], 28 | "source": [ 29 | "if not \"fb\" in os.listdir():\n", 30 | " os.mkdir(\"fb\")\n", 31 | "for i in range(4,21):\n", 32 | " res = requests.get(url.format(i))\n", 33 | " with open(\"fb/{}_img.jpg\".format(i),\"wb\") as file:\n", 34 | " file.write(res.content)\n", 35 | "#cannot make file hence we will use os module" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": null, 41 | "metadata": {}, 42 | "outputs": [], 43 | "source": [] 44 | } 45 | ], 46 | "metadata": { 47 | "kernelspec": { 48 | "display_name": "Python 3", 49 | "language": "python", 50 | "name": "python3" 51 | }, 52 | "language_info": { 53 | "codemirror_mode": { 54 | "name": "ipython", 55 | "version": 3 56 | }, 57 | "file_extension": ".py", 58 | "mimetype": "text/x-python", 59 | "name": "python", 60 | "nbconvert_exporter": "python", 61 | "pygments_lexer": "ipython3", 62 | "version": "3.7.1" 63 | } 64 | }, 65 | "nbformat": 4, 66 | "nbformat_minor": 2 67 | } 68 | -------------------------------------------------------------------------------- /Projects/File_Organiser/organiser.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | 4 | class Setup: 5 | def __init__(self,absolute_path): 6 | self.path = absolute_path 7 | 8 | def list_files(self): 9 | files_list = [] 10 | for file_name in os.listdir(self.path): 11 | result = os.path.isfile(file_name) 12 | if not result: 13 | files_list.append(file_name) 14 | 15 | with open("info.json","w+") as file: 16 | json.dump(files_list,file) 17 | file.close() 18 | 19 | def group(self): 20 | 21 | with open("info.json","r") as file: 22 | details = json.load(file) 23 | #print(details) 24 | 25 | os.remove("info.json") 26 | 27 | doc = [".docx",".pdf",".pptx",".xlsx"] 28 | executables = [".exe",".bat",".ova"] 29 | pics = [".jpg",".jpeg",".png"] 30 | vids = [".mp3",".mp4",".avi"] 31 | 32 | doc_files = [] 33 | exe_files = [] 34 | pic_files = [] 35 | vid_files = [] 36 | 37 | for file_name in details: 38 | for extension in doc: 39 | #print(extension) 40 | if file_name.endswith(extension): 41 | #print(file_name) 42 | doc_files.append(file_name) 43 | break 44 | 45 | 46 | for extension in executables: 47 | if file_name.endswith(extension): 48 | exe_files.append(file_name) 49 | break 50 | 51 | 52 | for extension in pics: 53 | if file_name.endswith(extension): 54 | pic_files.append(file_name) 55 | break 56 | 57 | 58 | for extension in vids: 59 | if file_name.endswith(extension): 60 | vid_files.append(file_name) 61 | break 62 | 63 | return pic_files,vid_files,exe_files,doc_files 64 | -------------------------------------------------------------------------------- /Projects/README.md: -------------------------------------------------------------------------------- 1 | #### Have some amazing projects? Add here 2 | You can add your amazing projects of any tech stack in this folder. 3 | - Fork the repo 4 | - Clone it to your local machine by: 5 | > git clone url 6 | - Add a folder of your name. 7 | - Add your project inside the folder. 8 | - Create a pull request. 9 | -------------------------------------------------------------------------------- /Projects/Shopping-List-WebApp/app.js: -------------------------------------------------------------------------------- 1 | // functions : 2 | 3 | function add_item(e){ 4 | var user=document.getElementById('input').value; 5 | var list=document.getElementById('original'); 6 | var update=document.getElementById('product'); 7 | var error_msg=document.getElementById('error'); 8 | var start_msg=document.getElementById('noinput'); 9 | if(user !="" ){ 10 | start_msg.style.setProperty('display','none'); 11 | error_msg.style.setProperty('display','none'); 12 | 13 | update.innerHTML=user; 14 | var clone=list.cloneNode(true); 15 | clone.classList.add('list1'); 16 | clone.style.setProperty('display', 'flex'); 17 | list.after(clone); 18 | arrayl.push(clone); 19 | } 20 | 21 | else{ 22 | error_msg.style.setProperty('display','inline') 23 | } 24 | } 25 | 26 | function remove_element(e){ 27 | if(e.target.classList.contains('delb')){ 28 | var start_msg=document.getElementById('noinput2'); 29 | start_msg.style.setProperty('display','none'); 30 | var cart=document.getElementById('list2'); 31 | arrayr.push(e.target.parentElement) 32 | cart.appendChild(e.target.parentElement); 33 | arrayl.pop(); 34 | if(arrayl.length==0){ 35 | var msg=document.getElementById('noinput'); 36 | msg.style.setProperty('display','block'); 37 | } 38 | } 39 | } 40 | 41 | function remove_e(e){ 42 | if(e.target.classList.contains('delb')){ 43 | e.target.parentElement.remove(); 44 | arrayr.pop(); 45 | if(arrayr.length==0){ 46 | var msg=document.getElementById('noinput2'); 47 | msg.style.setProperty('display','block'); 48 | } 49 | } 50 | } 51 | 52 | 53 | 54 | // Selectors : 55 | var button=document.getElementById('btn'); 56 | 57 | // Main : 58 | arrayl=[]; 59 | arrayr=[]; 60 | button.addEventListener("click",add_item); 61 | 62 | var items=document.getElementById('l'); 63 | var cart_items=document.getElementById('r'); 64 | items.addEventListener('click',remove_element); 65 | cart_items.addEventListener('click',remove_e); 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /Projects/Shopping-List-WebApp/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 |
11 |

My Shopping List

12 |
13 |
14 |
15 |

Add Items

16 | 17 | 18 | Enter a Valid List Item 19 |
20 |
21 |
22 |

Your List

23 |
24 | Item 1 25 | 26 |
27 |
28 | Your List seems Empty ! 29 |
30 |
31 |
32 |

Your Cart

33 |
34 |
35 | Your cart seems Empty ! 36 |
37 |
38 |
39 |
40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /Projects/Web_Scraping/Encryptor.py: -------------------------------------------------------------------------------- 1 | from Crypto.Cipher import AES 2 | from Crypto.Hash import SHA256 3 | import os 4 | 5 | 6 | password = input("Enter the Security Key: ") 7 | os.system('cls') 8 | hash_obj = SHA256.new(password.encode("utf-8")) 9 | hash_key = hash_obj.digest() 10 | #print(hash_key) 11 | 12 | def encrypt(msg): 13 | BLOCK_SIZE = 16 14 | PAD = "{" 15 | padding = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PAD 16 | cipher = AES.new(hash_key,AES.MODE_ECB) 17 | result = cipher.encrypt(padding(msg).encode("utf-8")) 18 | return result 19 | 20 | def decrypt(msg): 21 | PAD = "{" 22 | decipher = AES.new(hash_key,AES.MODE_ECB) 23 | b_decrypted = decipher.decrypt(msg).decode("utf-8") 24 | pad_index = b_decrypted.find(PAD) 25 | result = b_decrypted[:pad_index] 26 | return result 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Projects/Web_Scraping/emailer.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pickle 3 | from Encryptor import decrypt , encrypt 4 | import smtplib 5 | from email.mime.text import MIMEText 6 | from email.mime.multipart import MIMEMultipart 7 | import os 8 | 9 | if os.path.isfile("creds.pickle"): 10 | with open("creds.pickle","rb") as file: 11 | creds = pickle.load(file) 12 | username = creds[0] 13 | password = creds[1] 14 | password = decrypt(password) 15 | username = str(username) 16 | 17 | else: 18 | username = input("Email Id : ") 19 | password = input("Password : ") 20 | os.system('cls') 21 | #sys.system('clear') 22 | with open("creds.pickle","wb") as fileobj: 23 | password_hash = encrypt(password) 24 | username_hash = encrypt(username) 25 | credentials = [username_hash,password_hash] 26 | pickle.dump(credentials,fileobj) 27 | 28 | def send_email(content): 29 | global username 30 | global password 31 | msg = MIMEMultipart() 32 | msg['From'] = username 33 | msg['To'] = username 34 | msg['Subject'] = "Intimation On the Amazon product!" 35 | msg.attach(MIMEText(content,'plain')) 36 | text = msg.as_string() 37 | server = smtplib.SMTP("smtp.gmail.com",587) 38 | server.starttls() 39 | server.ehlo() 40 | server.login(username,password) 41 | server.ehlo() 42 | server.sendmail(username,username,text) 43 | server.quit() 44 | 45 | -------------------------------------------------------------------------------- /Projects/Web_Scraping/main.py: -------------------------------------------------------------------------------- 1 | from bs4 import BeautifulSoup 2 | import requests 3 | import emailer 4 | import time 5 | import sys 6 | 7 | def get_price(URL): 8 | headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"} 9 | page = requests.get(URL,headers=headers) 10 | print(page.content) 11 | soup = BeautifulSoup(page.content,'html.parser') 12 | price = soup.find(id="priceblock_ourprice").get_text() 13 | currency = price[0] 14 | return currency 15 | 16 | def Amazon_Scraper(URL): 17 | filtered_price = "" 18 | digits = ["1","2","3","4","5","6","7","8","9","0","."] 19 | headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"} 20 | 21 | page = requests.get(URL,headers=headers) 22 | soup = BeautifulSoup(page.content,'html.parser') 23 | 24 | title = soup.find(id="productTitle").get_text().strip() 25 | price = soup.find(id="priceblock_ourprice").get_text() 26 | currency = price[0] 27 | l_price = [] 28 | i=0 29 | while i 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "com.example.digital_clock" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'androidx.test:runner:1.1.1' 66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 67 | } 68 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 19 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/kotlin/com/example/digital_clock/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.digital_clock 2 | 3 | import android.os.Bundle 4 | import io.flutter.app.FlutterActivity 5 | import io.flutter.plugins.GeneratedPluginRegistrant 6 | 7 | class MainActivity: FlutterActivity() { 8 | override fun onCreate(savedInstanceState: Bundle?) { 9 | super.onCreate(savedInstanceState) 10 | GeneratedPluginRegistrant.registerWith(this) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.5.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.enableR8=true 3 | android.useAndroidX=true 4 | android.enableJetifier=true 5 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip 7 | -------------------------------------------------------------------------------- /Projects/digital_clock/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /Projects/digital_clock/digital.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/digital.gif -------------------------------------------------------------------------------- /Projects/digital_clock/digital_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/digital_dark.png -------------------------------------------------------------------------------- /Projects/digital_clock/digital_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/digital_light.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | digital_clock 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Projects/digital_clock/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /Projects/digital_clock/lib/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | import 'dart:io'; 6 | 7 | import 'package:flutter_clock_helper/customizer.dart'; 8 | import 'package:flutter_clock_helper/model.dart'; 9 | import 'package:flutter/foundation.dart'; 10 | import 'package:flutter/material.dart'; 11 | 12 | import 'digital_clock.dart'; 13 | 14 | void main() { 15 | // A temporary measure until Platform supports web and TargetPlatform supports 16 | // macOS. 17 | if (!kIsWeb && Platform.isMacOS) { 18 | // TODO(gspencergoog): Update this when TargetPlatform includes macOS. 19 | // https://github.com/flutter/flutter/issues/31366 20 | // See https://github.com/flutter/flutter/wiki/Desktop-shells#target-platform-override. 21 | debugDefaultTargetPlatformOverride = TargetPlatform.fuchsia; 22 | } 23 | 24 | // This creates a clock that enables you to customize it. 25 | // 26 | // The [ClockCustomizer] takes in a [ClockBuilder] that consists of: 27 | // - A clock widget (in this case, [DigitalClock]) 28 | // - A model (provided to you by [ClockModel]) 29 | // For more information, see the flutter_clock_helper package. 30 | // 31 | // Your job is to edit [DigitalClock], or replace it with your 32 | // own clock widget. (Look in digital_clock.dart for more details!) 33 | runApp(ClockCustomizer((ClockModel model) => DigitalClock(model))); 34 | } 35 | -------------------------------------------------------------------------------- /Projects/digital_clock/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: digital_clock 2 | description: Digital clock. 3 | version: 1.0.0+1 4 | 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | flutter_clock_helper: 12 | path: ../flutter_clock_helper 13 | cupertino_icons: ^0.1.2 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | 19 | flutter: 20 | uses-material-design: true 21 | fonts: 22 | - family: PressStart2P 23 | fonts: 24 | - asset: third_party/PressStart2P-Regular.ttf 25 | -------------------------------------------------------------------------------- /Projects/digital_clock/third_party/PressStart2P-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/digital_clock/third_party/PressStart2P-Regular.ttf -------------------------------------------------------------------------------- /Projects/titanic_survival_exploration/README.md: -------------------------------------------------------------------------------- 1 | # Project 0: Introduction and Fundamentals 2 | ## Titanic Survival Exploration 3 | 4 | ### Install 5 | 6 | This project requires **Python 2.7** and the following Python libraries installed: 7 | 8 | - [NumPy](http://www.numpy.org/) 9 | - [Pandas](http://pandas.pydata.org) 10 | - [matplotlib](http://matplotlib.org/) 11 | - [scikit-learn](http://scikit-learn.org/stable/) 12 | 13 | You will also need to have software installed to run and execute an [iPython Notebook](http://ipython.org/notebook.html) 14 | 15 | Udacity recommends our students install [Anaconda](https://www.continuum.io/downloads), a pre-packaged Python distribution that contains all of the necessary libraries and software for this project. 16 | 17 | ### Code 18 | 19 | Template code is provided in the notebook `titanic_survival_exploration.ipynb` notebook file. Additional supporting code can be found in `titanic_visualizations.py`. While some code has already been implemented to get you started, you will need to implement additional functionality when requested to successfully complete the project. 20 | 21 | ### Run 22 | 23 | In a terminal or command window, navigate to the top-level project directory `titanic_survival_exploration/` (that contains this README) and run **one** of the following commands: 24 | 25 | ```bash 26 | jupyter notebook titanic_survival_exploration.ipynb 27 | ``` 28 | or 29 | ```bash 30 | ipython notebook titanic_survival_exploration.ipynb 31 | ``` 32 | 33 | This will open the iPython Notebook software and project file in your web browser. 34 | 35 | ## Data 36 | 37 | The dataset used in this project is included as `titanic_data.csv`. This dataset is provided by Udacity and contains the following attributes: 38 | 39 | - `survival` : Survival (0 = No; 1 = Yes) 40 | - `pclass` : Passenger Class (1 = 1st; 2 = 2nd; 3 = 3rd) 41 | - `name` : Name 42 | - `sex` : Sex 43 | - `age` : Age 44 | - `sibsp` : Number of Siblings/Spouses Aboard 45 | - `parch` : Number of Parents/Children Aboard 46 | - `ticket` : Ticket Number 47 | - `fare` : Passenger Fare 48 | - `cabin` : Cabin 49 | - `embarked` : Port of Embarkation (C = Cherbourg; Q = Queenstown; S = Southampton) 50 | -------------------------------------------------------------------------------- /Projects/titanic_survival_exploration/titanic_visualizations.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StudentCode-in/Hacktoberfest2020/eac995570bace1c42ac324414101af53ef124bc1/Projects/titanic_survival_exploration/titanic_visualizations.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hacktoberfest-2020 2 | GitHub issues 3 | ![Greetings](https://github.com/StudentCode-in/Hacktoberfest2020/workflows/Greetings/badge.svg) 4 | ### What's Hacktoberfest? 5 |

Hacktoberfest is the easiest way to get into open source! Hacktoberfest is a month long festival of open source code presented by Digital Ocean, Intel and DEV this year in 2020.If you’ve never contributed to open source before, this is the perfect time to get started 6 | 7 | https://hacktoberfest.digitalocean.com/

8 | 9 | ----- 10 | #### Why Contribute to hacktoberfest 2020 🙌 11 | 12 | - Chance to contribute to awesome open source projects. 13 | - Polish you GitHub Skills. 14 | - Free swags and T-Shirts from Digital Ocean 15 | - Chance to get a tree planted and make Earth greener 16 | 17 | ----- 18 | ### Let's Begin :- 19 | 20 | * Create a github account if you not have one. 21 | * Login using github @ [Hacktoberfest](https://hacktoberfest.digitalocean.com/) 22 | * Create four valid pull requests (PRs) between 1st - 31st October 23 | 24 | ----- 25 | ## Branch Policy 26 | 27 | - develop: If you are making a contribution make sure to send your Pull Request to this branch. All developments goes in this branch. 28 | - main: After significant features/bug-fixes are accumulated in development branch we will merge it with the main branch. 29 | 30 | ----- 31 | ### How to Contribute to this repository 32 | 33 | * Fork the repository (Top right corner of this repo) 34 | * Clone the forked repository to your local machine. 35 | ```markdown 36 | git clone 37 | ``` 38 | * Browse to the location where repository got cloned at your system. 39 | * Make changes in the repository. 40 | * Push the changes. 41 | * Make a pull request. 42 | 43 | ----- 44 | ## Contributor's 45 | 46 | 47 | 48 | 49 | 50 | Made with [contributors-img](https://contributors-img.web.app). 51 | 52 | #### You have successfully submitted your first PR, Repeat the steps for submitting 3 more!! 53 | > **Note:** "Please Don't make any changes to README.MD 54 | 55 | 56 | 57 | --------------------------------------------------------------------------------