├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── sem-1-2 ├── .gitkeep ├── 18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY │ ├── Program-01 │ │ ├── README.md │ │ └── program-01.c │ ├── Program-02 │ │ ├── README.md │ │ └── program-02.c │ ├── Program-03 │ │ ├── README.md │ │ └── program-03.c │ ├── Program-04 │ │ ├── README.md │ │ └── program-04.c │ ├── Program-05 │ │ ├── README.md │ │ └── program-05.c │ ├── Program-06 │ │ ├── README.md │ │ └── program-06.c │ ├── Program-07 │ │ ├── README.md │ │ └── program-07.c │ ├── Program-08 │ │ ├── README.md │ │ └── program-08.c │ ├── Program-09 │ │ ├── README.md │ │ └── program09.c │ ├── Program-10 │ │ ├── README.md │ │ └── program10.c │ ├── Program-11 │ │ ├── README.md │ │ └── program11.c │ ├── Program-12 │ │ ├── README.md │ │ └── program12.c │ ├── Program-13 │ │ ├── README.md │ │ └── program13.c │ ├── Program-14 │ │ ├── README.md │ │ └── program14.c │ └── README.md └── readme.md ├── sem-3 ├── .DS_Store ├── computer_science │ ├── DS_LAB │ │ ├── 01-Operations on Array │ │ │ ├── 01-Operations on Array.c │ │ │ └── readme.md │ │ ├── 02-String match and replace │ │ │ ├── 02-String match and replace.c │ │ │ └── readme.md │ │ ├── 03-Operations on STACK │ │ │ ├── 03-Operations on STACK.c │ │ │ └── readme.md │ │ ├── 04-Infix to Postfix Expression │ │ │ ├── 04-Infix to Postfix Expression.c │ │ │ └── readme.md │ │ ├── 05a-Evaluate a Postfix Expression │ │ │ ├── 05a-Evaluate a Postfix Expression.c │ │ │ └── readme.md │ │ ├── 05b-Tower of Hanoi │ │ │ ├── 05b-Tower of Hanoi.c │ │ │ └── readme.md │ │ ├── 06-Circular Queue │ │ │ ├── 06-Circular Queue.c │ │ │ └── readme.md │ │ ├── 07-Singally Linked List │ │ │ ├── 07-Singally Linked List.c │ │ │ └── readme.md │ │ ├── 08-Doubally Linked List │ │ │ ├── 08-Doubally Linked List.c │ │ │ └── readme.md │ │ ├── 09-Circular Singally Linked List │ │ │ ├── 09-Circular Singally Linked List.c │ │ │ └── readme.md │ │ ├── 10- Binary search tree │ │ │ ├── 10- Binary search tree.c │ │ │ └── readme.md │ │ ├── 11-BSF and DSF │ │ │ ├── 11-BSF and DSF.c │ │ │ └── readme.md │ │ ├── 12-Hash Table │ │ │ ├── 12-HashTable.c │ │ │ └── readme.md │ │ └── readme.md │ └── DS_LabManual.pdf ├── electronics_and_communication │ └── .gitkeep ├── information_science │ ├── .gitkeep │ ├── ADE_LAB │ │ ├── 01-Half Adder │ │ │ ├── 01-Half Adder.HDL │ │ │ └── half adder big.PNG │ │ ├── 02-Half Subtractor │ │ │ ├── 02-Half Substractor.HDL │ │ │ └── half subtractor.PNG │ │ ├── 03-Full Subtractor │ │ │ ├── 03-Full Subtractor.HDL │ │ │ └── full subtractor.PNG │ │ ├── 04-Full Adder │ │ │ ├── 04-Full adder.HDL │ │ │ └── full adder.PNG │ │ ├── 05-Jk Flip flop │ │ │ ├── 05-JK Flip flop.HDL │ │ │ └── jk output.png │ │ ├── 06-Multiplexer │ │ │ ├── 06-8:1 Multiplexer.HDL │ │ │ └── mux.png │ │ ├── 07-Op-amp │ │ │ ├── 1.jpeg │ │ │ ├── 2.jpeg │ │ │ └── 3.jpeg │ │ ├── 08-Multi Vibrator │ │ │ ├── 1.jpeg │ │ │ └── 2.jpeg │ │ └── 09-Window Comparator │ │ │ ├── 1.jpeg │ │ │ └── 2.jpeg │ ├── DS_LAB │ │ ├── 01-Operations on Array │ │ │ ├── 01-Operations on Array.c │ │ │ └── readme.md │ │ ├── 02-String match and replace │ │ │ ├── 02-String match and replace.c │ │ │ └── readme.md │ │ ├── 03-Operations on STACK │ │ │ ├── 03-Operations on STACK.c │ │ │ └── readme.md │ │ ├── 04-Infix to Postfix Expression │ │ │ ├── 04-Infix to Postfix Expression.c │ │ │ └── readme.md │ │ ├── 05a-Evaluate a Postfix Expression │ │ │ ├── 05a-Evaluate a Postfix Expression.c │ │ │ └── readme.md │ │ ├── 05b-Tower of Hanoi │ │ │ ├── 05b-Tower of Hanoi.c │ │ │ └── readme.md │ │ ├── 06-Circular Queue │ │ │ ├── 06-Circular Queue.c │ │ │ └── readme.md │ │ ├── 07-Singally Linked List │ │ │ ├── 07-Singally Linked List.c │ │ │ └── readme.md │ │ ├── 08-Doubally Linked List │ │ │ ├── 08-Doubally Linked List.c │ │ │ └── readme.md │ │ ├── 09-Circular Singally Linked List │ │ │ ├── 09-Circular Singally Linked List.c │ │ │ └── readme.md │ │ ├── 10- Binary search tree │ │ │ ├── 10- Binary search tree.c │ │ │ └── readme.md │ │ ├── 11-BSF and DSF │ │ │ ├── 11-BSF and DSF.c │ │ │ └── readme.md │ │ ├── 12-Hash Table │ │ │ ├── 12-HashTable.c │ │ │ └── readme.md │ │ └── readme.md │ └── DS_LabManual.pdf └── readme.md ├── sem-4 ├── .DS_Store ├── computer_science │ ├── .gitkeep │ ├── ADA │ │ ├── P01a.java │ │ ├── P01b.java │ │ ├── P02a.java │ │ ├── P02b.java │ │ ├── P03a.java │ │ ├── P03b.java │ │ ├── P04.java │ │ ├── P05.java │ │ ├── P06a.java │ │ ├── P06b.java │ │ ├── P07.java │ │ ├── P08.java │ │ ├── P09.java │ │ ├── P10a.java │ │ ├── P10b.java │ │ ├── P11.java │ │ └── P12.java │ └── MP Lab │ │ ├── 01-BubbleSort.asm │ │ ├── 02-BinarySearch.asm │ │ ├── 03-Palindrome.asm │ │ ├── 04-nCr.asm │ │ ├── 05-Date.asm │ │ ├── 06A-ARM-Transfer.asm │ │ ├── 06B-ARM-Additon.asm │ │ ├── 06C-ARM-AND.asm │ │ ├── 06d-ARM-OnesCompliment.asm │ │ ├── 07-KEIL.c │ │ ├── 08A-BCD-Updown.asm │ │ ├── 08B-MutiplyARM.asm │ │ ├── 09-FIRE&HELP.asm │ │ ├── 10-StepperMotor.asm │ │ ├── 11a-FullSinWave.asm │ │ ├── 11b-HalfSinWave.asm │ │ ├── 12-LCD.c │ │ ├── 13-ARM-StepperMotor.c │ │ └── mp lab sem4.pdf ├── electronics_and_communication │ └── .gitkeep ├── information_science │ ├── .gitkeep │ ├── ADA │ │ ├── P01a.java │ │ ├── P01b.java │ │ ├── P02a.java │ │ ├── P02b.java │ │ ├── P03a.java │ │ ├── P03b.java │ │ ├── P04.java │ │ ├── P05.java │ │ ├── P06a.java │ │ ├── P06b.java │ │ ├── P07.java │ │ ├── P08.java │ │ ├── P09.java │ │ ├── P10a.java │ │ ├── P10b.java │ │ ├── P11.java │ │ ├── P12.java │ │ └── README.md │ └── MP Lab │ │ ├── 01-BubbleSort.asm │ │ ├── 02-BinarySearch.asm │ │ ├── 03-Palindrome.asm │ │ ├── 04-nCr.asm │ │ ├── 05-Date.asm │ │ ├── 06A-ARM-Transfer.asm │ │ ├── 06B-ARM-Additon.asm │ │ ├── 06C-ARM-AND.asm │ │ ├── 06d-ARM-OnesCompliment.asm │ │ ├── 07-KEIL.c │ │ ├── 08A-BCD-Updown.asm │ │ ├── 08B-MutiplyARM.asm │ │ ├── 09-FIRE&HELP.asm │ │ ├── 10-StepperMotor.asm │ │ ├── 11a-FullSinWave.asm │ │ ├── 11b-HalfSinWave.asm │ │ ├── 12-LCD.c │ │ ├── 13-ARM-StepperMotor.c │ │ ├── README.md │ │ └── mp lab sem4.pdf └── readme.md ├── sem-5 ├── .DS_Store ├── computer_science │ ├── .DS_Store │ ├── .gitkeep │ └── CN_Lab │ │ ├── .vscode │ │ └── launch.json │ │ ├── BellmanFord.class │ │ ├── BellmanFord.java │ │ ├── CRC.class │ │ ├── CRC.java │ │ ├── LeakyBucket.class │ │ ├── LeakyBucket.java │ │ ├── RSA.class │ │ ├── RSA.java │ │ ├── TCPClient.class │ │ ├── TCPClient.java │ │ ├── TCPServer.class │ │ ├── TCPServer.java │ │ ├── UDPClient.class │ │ ├── UDPClient.java │ │ ├── UDPServer.class │ │ ├── UDPServer.java │ │ └── abc.txt ├── electronics_and_communication │ └── .gitkeep ├── information_science │ ├── .gitkeep │ └── cn_lab │ │ ├── CN LAB MANUAL.pdf │ │ ├── program_10 │ │ ├── program_10.java │ │ └── readme.md │ │ ├── program_11 │ │ ├── program_11.java │ │ └── readme.md │ │ ├── program_12 │ │ ├── program_12.java │ │ └── readme.md │ │ ├── program_7 │ │ ├── program_7.java │ │ └── readme.md │ │ ├── program_8 │ │ ├── program_8.java │ │ └── readme.md │ │ └── program_9 │ │ ├── program_9_client.java │ │ ├── program_9_server.java │ │ └── readme.md └── readme.md ├── sem-6 ├── .DS_Store ├── computer_science │ └── .gitkeep ├── electronics_and_communication │ └── .gitkeep ├── information_science │ ├── .gitkeep │ └── FS-Lab │ │ ├── 1.cpp │ │ ├── 1a.cpp │ │ ├── 2.cpp │ │ ├── 3.cpp │ │ ├── 4.cpp │ │ ├── 5.cpp │ │ ├── 6.cpp │ │ ├── 7.cpp │ │ ├── 8.cpp │ │ └── reverse.h └── readme.md ├── sem-7 ├── .DS_Store ├── computer_science │ ├── .gitkeep │ ├── 15CSL76_MACHINE_LEARNING_LABORATORY │ │ ├── 01. Find-S Algorithm.ipynb │ │ ├── 01. Find-S Algorithm.py │ │ ├── 02. Candidate Elimination.ipynb │ │ ├── 02. Candidate Elimination.py │ │ ├── 04. Back-propagation Algorithm.ipynb │ │ ├── 04. Back-propagation Algorithm.py │ │ ├── 06. Naive Bayes Classifier (Doc Classification).ipynb │ │ ├── 06. Naive Bayes Classifier (Doc Classification).py │ │ ├── 08. EM & K-MEANS ALGORITHM.ipynb │ │ ├── 08. EM & K-MEANS ALGORITHM.py │ │ ├── 09. k-NEAREST NEIGHBOUR ALGORITHM.ipynb │ │ ├── 09. k-NEAREST NEIGHBOUR ALGORITHM.py │ │ ├── README.md │ │ ├── datasets │ │ │ ├── PlayTennis.csv │ │ │ ├── enjoysport.csv │ │ │ ├── pima-indians.csv │ │ │ └── text_doc.csv │ │ └── requirements.txt │ └── 15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT │ │ ├── README.md │ │ ├── program-01 │ │ └── index.html │ │ ├── program-02 │ │ └── index.html │ │ ├── program-03 │ │ └── index.html │ │ ├── program-04 │ │ └── index.html │ │ ├── program-05 │ │ ├── index.xml │ │ └── style.css │ │ ├── program-06 │ │ ├── count.txt │ │ └── index.php │ │ ├── program-07 │ │ └── index.php │ │ ├── program-08_a │ │ ├── index.html │ │ └── index.php │ │ ├── program-08_b │ │ └── index.php │ │ ├── program-08_c │ │ └── index.php │ │ ├── program-08_d │ │ └── index.php │ │ └── program-09 │ │ ├── index.php │ │ └── match.py ├── electronics_and_communication │ └── .gitkeep └── information_science │ ├── .gitkeep │ ├── 15CSL76_MACHINE_LEARNING_LABORATORY │ ├── .ipynb_checkpoints │ │ ├── 01. FIND S-checkpoint.ipynb │ │ ├── 02. CANDIDATE ELIMINATION-checkpoint.ipynb │ │ ├── 03. DECISION TREE-checkpoint.ipynb │ │ ├── 04. ANN WITH BACKPROPOGATION-checkpoint.ipynb │ │ ├── 05. NAIVE BAYES CLASSIFIER-checkpoint.ipynb │ │ ├── 06. NAIVE BAYES USING API-checkpoint.ipynb │ │ ├── 07. BAYESIAN NETWORKS-checkpoint.ipynb │ │ ├── 09. k-NEAREST NEIGHBOUR ALGORITHM (USING API)-checkpoint.ipynb │ │ └── WORKING OF DECISION TREE-checkpoint.ipynb │ ├── Datasets │ │ ├── EnjoySport.csv │ │ ├── PlayTennis.csv │ │ ├── document.csv │ │ └── finance.csv │ ├── a-neural-network.ipynb │ ├── ao-star.ipynb │ ├── astar.ipynb │ ├── candidate-elemination.ipynb │ ├── decision-tree.ipynb │ ├── kmeans.ipynb │ ├── knearest-neighbor.ipynb │ ├── locallyweighted.ipynb │ ├── naive-bayes-classifier-from-scratch.ipynb │ └── play_tennis.csv │ └── 15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT │ ├── program-01 │ └── index.html │ ├── program-02 │ └── index.html │ └── program-03 │ └── index.html └── sem-8 ├── .DS_Store ├── computer_science └── .gitkeep ├── electronics_and_communication └── .gitkeep ├── information_science └── .gitkeep └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | .vscode 3 | **/.DS_STORE 4 | a.out 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VTU Lab Material 2 | [![SOSC](https://is.gd/visit_sosc_badge)](https://sosc.org.in) ![Probot](https://img.shields.io/badge/Managed%20by-Probot-blue.svg?style=for-the-badge) 3 | #### Collection of VTU laboratory easy solutions and related educational material maintained **by the students, for the students, to the students**. 💪🏻 4 | 5 | ## Motivation 6 | Ever had trouble getting the right VTU lab material to study from? Well, look no further! here's a collection of all resources required, gathered and verified with by the respective laboratory incharge, by the students over at [Sahyadri Open Source Community](https://sosc.org.in) 7 | 8 | ## Getting started 9 | The folder structure is arranged according to `semester/branch/subject_code+subject_name/file_name` 10 | ```sh 11 | . 12 | ├── sem-7 13 | │   ├── computer_science 14 | │   │   ├── 15CSL76_MACHINE_LEARNING_LABORATORY 15 | │   │   │   ├── 01. Find-S Algorithm.ipynb 16 | │   │   │   ├── 01. Find-S Algorithm.py 17 | . . . . 18 | . . . . 19 | ``` 20 | If the Lab experiments contain more than one file, create a separate sub directory for each experiment. eg `/semester/branch/subject_code_subject_name/experiment_no_experiment_name/filename` 21 | ```sh 22 | . 23 | ├── sem-7 24 | │   ├── computer_science 25 | │   │   ├── 15CSL77_WEB_PROGRAMMING_LABORATORY 26 | │   │   │   ├── 01 Calculator 27 | │   │   │ | ├── index.html 28 | │   │   │ | ├── style.css 29 | . . . . . 30 | . . . . . 31 | ``` 32 | 33 | ## Contributing 34 | Please read [CONTRIBUTING.md](https://github.com/so-sc/VTU-Lab-Material/blob/master/CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests. 35 | 36 | ## License 37 | This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](https://github.com/so-sc/VTU-Lab-Material/blob/master/LICENSE) file for more details. 38 | -------------------------------------------------------------------------------- /sem-1-2/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-1-2/.gitkeep -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-01/README.md: -------------------------------------------------------------------------------- 1 | # Program 01 2 | 3 | Develop a program to solve simple computational problems using arithmetic expressions and use of each operator leading to simulation of a Commercial calculator.(No built-in math function) 4 | 5 | ## Output 6 | 7 | ```shell 8 | $ gedit program-01.c 9 | $ gcc program-01.c 10 | 11 | ./a.out 12 | 13 | Menu: 14 | + Addition 15 | - Subtraction 16 | * Multiplication 17 | / Division 18 | % Remainder 19 | Enter the symbol for operation: * 20 | Enter the numbers: 14 8 21 | Product = 112.000000 22 | 23 | ./a.out 24 | 25 | Menu: 26 | + Addition 27 | - Subtraction 28 | * Multiplication 29 | / Division 30 | % Remainder 31 | Enter the symbol for operation: % 32 | Enter the numbers: 14 13 33 | Remainder = 1 34 | 35 | ``` 36 | 37 | # Flowchart 38 | ![Untitled Diagram](https://user-images.githubusercontent.com/42874695/61176066-23950b00-a5d8-11e9-9f87-525c0979b749.png) 39 | 40 | ## Screenshot 41 | ![calculator](https://user-images.githubusercontent.com/44167922/50517635-37af6a00-0ad7-11e9-945b-a7d074fef98d.png) 42 | 43 | ## Concept used: 44 | 45 | - Switching cases 46 | - Break statements 47 | 48 | ## Links for reference: 49 | 50 | Understand switching in c at [newBoston](https://www.youtube.com/watch?v=qZRP5hKGHrs&list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq&index=31 "Link to YouTube video") 51 | 52 | 53 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-01/program-01.c: -------------------------------------------------------------------------------- 1 | /*To implement a calculator using switch*/ 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | char ch; 8 | float a, b; 9 | int x, y; 10 | 11 | printf("\nMenu:\n"); 12 | printf("+ Addition\n- Subtraction\n* Multiplication\n/ Division\n% Remainder\n"); 13 | printf("Enter the symbol for operation: "); 14 | scanf("%c", &ch); 15 | printf("Enter the numbers: "); 16 | scanf("%f%f", &a, &b); 17 | 18 | // Test for each case +, -, *, /, % 19 | switch(ch) 20 | { 21 | case '+': printf("Sum = %f\n", a+b); break; 22 | case '-': printf("Difference = %f\n", a-b); break; 23 | case '*': printf("Product = %f\n", a*b); break; 24 | case '/': 25 | // Test condition cannot divide by zero 26 | if(b!=0) 27 | { 28 | printf("Quotient = %f\n", a/b); break; 29 | } 30 | else 31 | { 32 | printf("Cannot divide by zero!!\n"); 33 | } 34 | case '%': x=a; y=b; // Assigning a, b to integers because remainders exist only in integer values. 35 | if(b!=0) 36 | { 37 | printf("Remainder = %d\n", x%y); break; 38 | } 39 | else 40 | { 41 | printf("Cannot divide by zero!!\n"); 42 | } 43 | default: printf("Invalid operator!!\n"); 44 | } 45 | return 0; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-02/README.md: -------------------------------------------------------------------------------- 1 | # Program 2 2 | Develop a program to compute the roots of a quadratic equation by accepting the coefficients. Print appropriate messages. 3 | 4 | ## Output 5 | ```shell 6 | $ gedit program-02.c 7 | $ gcc program-02.c -lm 8 | 9 | $ ./a.out 10 | Enter the coefficients of x: 1 2 3 11 | The roots are imaginary: 12 | Root 1: -1.000000 + i(1.414214) Root 2: -1.000000 - i(1.414214) 13 | 14 | $ ./a.out 15 | Enter the coefficients of x: 2 6 -3 16 | Roots are real and distinct: 17 | Root 1: 1.745967 Root 2: -13.745967 18 | 19 | ``` 20 | ## Flowchart 21 | ![f2](https://user-images.githubusercontent.com/42874695/61185868-b9ce3d00-a67b-11e9-855e-b5bc06f4dac5.png) 22 | 23 | ## Screenshot 24 | 25 | ![image](https://user-images.githubusercontent.com/44167922/50535745-2ae05400-0b73-11e9-9a3a-eadf2a5877a3.png) 26 | 27 | ## Concept used: 28 | 29 | - if-else conditions 30 | 31 | ## Link for reference: 32 | 33 | Understand if-else in c at [newBoston](https://www.youtube.com/watch?v=qZRP5hKGHrs&list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq&index=31 "Link to YouTube video") 34 | 35 | 36 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-02/program-02.c: -------------------------------------------------------------------------------- 1 | /*To compute roots of quadratic equation*/ 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | int main() 8 | { 9 | float a, b, c, d, r1, r2, r, i; 10 | 11 | printf("Enter the coefficients of x: "); 12 | scanf("%f%f%f", &a, &b, &c); 13 | 14 | // if a = 0 and b = 0 it is not possible to find roots. 15 | if(a==0 && b==0) 16 | { 17 | printf("Roots cannot be determined!\n"); 18 | exit(0); 19 | } 20 | 21 | if(a==0) 22 | { 23 | r1 = -c/b; 24 | printf("Linear Equation:\n"); 25 | printf("Root is: %f", r1); 26 | } 27 | 28 | d = b*b - 4*a*c; 29 | 30 | if(d == 0) 31 | { 32 | r1 = -b/2*a; 33 | r2 = r1; 34 | printf("The roots are real and equal:\nRoot 1: %f\tRoot 2: %f\n", r1, r2); 35 | } 36 | 37 | else if(d>0) 38 | { 39 | r1 = (-b + sqrt(d))/2*a; 40 | r2 = (-b - sqrt(d))/2*a; 41 | printf("Roots are real and distinct:\n"); 42 | printf("Root 1: %f\tRoot 2: %f\n", r1, r2); 43 | } 44 | 45 | else 46 | { 47 | r = -b/2*a; 48 | i = sqrt(fabs(d))/2*a; 49 | printf("The roots are imaginary:\n"); 50 | 51 | //Manipulate output syntax to display imaginary parts 52 | printf("Root 1: %f + i(%f)\t", r, i); 53 | printf("Root 2: %f - i(%f)\t\n", r, i); 54 | } 55 | 56 | return 0; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-03/README.md: -------------------------------------------------------------------------------- 1 | # Program 03 2 | Develop a program to find the reverse of a positive integer and check for palindrome or not. Display appropriate messages. 3 | 4 | ## Output 5 | ```shell 6 | $ gedit program-03.c 7 | $ gcc program-03.c 8 | 9 | $ ./a.out 10 | 11 | Enter a number: 12345 12 | The reversed number is: 54321 13 | It is not a palindrome 14 | 15 | $ ./a.out 16 | 17 | Enter a number: 1001 18 | The reversed number is: 1001 19 | Is a palindrome 20 | 21 | ``` 22 | ## Flowchart 23 | ![Screenshot from 2019-07-14 21-45-25](https://user-images.githubusercontent.com/42874695/61186249-c1441500-a680-11e9-89fd-97ba35e8ddff.png) 24 | 25 | ## Screenshots 26 | 27 | ![palindrome](https://user-images.githubusercontent.com/44167922/50380752-6cff2680-0697-11e9-98de-b3f53af96f38.png) 28 | 29 | ## Concept used: 30 | 31 | - while loops 32 | - if conditions 33 | 34 | ## Links for reference: 35 | 36 | Understand while-loops in c at [newBoston](https://www.youtube.com/watch?v=7pAXm7WEA2I&list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq&index=25"Link to YouTube video") 37 | 38 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-03/program-03.c: -------------------------------------------------------------------------------- 1 | #include 2 | void main() 3 | { 4 | int num, rev=0, temp, rem; 5 | printf("\nEnter a number: "); 6 | scanf("%d",&num); 7 | temp = num; 8 | while (temp!=0) 9 | { 10 | rem = temp % 10; 11 | temp = temp / 10; 12 | rev = rev * 10 + rem; 13 | } 14 | 15 | printf("The reversed number is: %d\n", rev); 16 | 17 | if(rev == num) 18 | { 19 | printf(" It is a palindrome\n\n"); 20 | }else 21 | { 22 | printf("It is not a palindrome\n\n"); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-04/README.md: -------------------------------------------------------------------------------- 1 | # Program 04 2 | 3 | An electricity board charges the following rates for the use of electricity: for the first 200 units 80 paise per unit: for the next 100 units 90 paise per unit: beyond 300 units Rs 1 per unit. All users are charged a minimum of Rs. 100 as meter charge. If the total amount is more than Rs.400, then an additional surcharge of 15% of total amount is charged. Write a program to read the name of the user, number of units consumed and print out the charges. 4 | 5 | ## Output 6 | 7 | ```shell 8 | $ gedit program-04.c 9 | $ gcc program-04.c 10 | $ ./a.out 11 | 12 | Enter the name: Chuck 13 | Enter the no.of.units consumed: 100 14 | 15 | Name: Chuck 16 | Units consumed: 100 17 | Charge = Rs 180.000000 18 | 19 | ``` 20 | ## Flowchart 21 | ![f4(1)](https://user-images.githubusercontent.com/42874695/61186582-d3c04d80-a684-11e9-8c3e-c252b5d67dbf.png) 22 | 23 | 24 | ## Screenshot 25 | 26 | ![image](https://user-images.githubusercontent.com/44167922/50256115-c7d81a00-041a-11e9-88cc-75172e510f01.png) 27 | 28 | ## Concept used: 29 | 30 | - if-else conditions 31 | 32 | ## Links for reference: 33 | 34 | Understand if-else in c at [newBoston](https://www.youtube.com/watch?v=KgVzRmUPsdo&index=19&list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq "Link to YouTube video") 35 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-04/program-04.c: -------------------------------------------------------------------------------- 1 | /*To implement an electricity bill*/ 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | float charge; 8 | int units; 9 | char name[25]; 10 | 11 | //Input required 12 | printf("\nEnter the name: "); 13 | scanf("%s", &name); 14 | printf("Enter the no.of.units consumed: "); 15 | scanf("%d", &units); 16 | 17 | //Compute charge 18 | if(units<=200) 19 | { 20 | charge = units*0.8; 21 | } 22 | else if(units<=300) 23 | { 24 | /* 25 | 26 | From previous if(), we have determined that units>200, 27 | but we should charge only 80p for first 200 units, so 200*0.8 = 160 28 | and the next hundred units to be charged 90p, 29 | so no.of units to be charged 90p = units - 300 30 | 31 | */ 32 | charge = 160 + (units-200)*0.9; 33 | } 34 | else 35 | { 36 | /* 37 | 38 | From previous if(), we have determined that units>300, 39 | but we should charge only 80p for first 200 units and 90p for next 100, so 200*0.8 + 100*0.9= 250 40 | and the next units to be charged Rs.1, 41 | so no.of units to be charged Rs.1 = units - 300 42 | 43 | */ 44 | charge = 250 + (units - 300)*1; 45 | } 46 | 47 | //Additional meter charge 48 | charge += 100; 49 | 50 | //Additional 15% tax 51 | if(charge > 400) 52 | { 53 | charge = charge +charge*0.15; 54 | } 55 | 56 | //Required Output 57 | printf("\nName: %s ", name); 58 | printf("\nUnits consumed: %d", units); 59 | printf("\nCharge = Rs %f\n", charge); 60 | 61 | return 0; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-05/README.md: -------------------------------------------------------------------------------- 1 | # Program 05 2 | 3 | Introduce 1D Array manipulation and implement Binary search. 4 | 5 | ## Output 6 | 7 | ```shell 8 | $ gedit program-05.c 9 | $ gcc program-05.c 10 | $ ./a.out 11 | 12 | 13 | Enter the number of elements: 5 14 | Enter the Array in ascending order: 15 | 5 10 15 20 25 16 | Enter the key to be searched 10 17 | 18 | Key is available at 2 location. 19 | 20 | $ ./a.out 21 | 22 | Enter the number of elements: 5 23 | Enter the Array in ascending order: 24 | 10 20 30 40 50 25 | Enter the key to be searched: 13 26 | Key is not Found. 27 | 28 | ``` 29 | ## Flowchart 30 | ![Screenshot from 2019-07-14 21-45-25](https://user-images.githubusercontent.com/42874695/61187096-49c7b300-a68b-11e9-80f8-e30b9e9ff3aa.png) 31 | 32 | ## Screenshot 33 | 34 | ![image](https://user-images.githubusercontent.com/44167922/50255925-f99cb100-0419-11e9-9ac1-ff148b3b4ca3.png) 35 | 36 | ## Concept used: 37 | 38 | - If-else conditions 39 | - Arrays 40 | 41 | ## Links for reference: 42 | 43 | Understand Arrays in c at [newBoston](https://www.youtube.com/watch?v=7F-Q2oVBYKk&index=9&list=PL6gx4Cwl9DGAKIXv8Yr6nhGJ9Vlcjyymq "Link to YouTube video") 44 | 45 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-05/program-05.c: -------------------------------------------------------------------------------- 1 | /*To implement binary search technique in 1D Array*/ 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | int a[100], n, f, mid, l, i, key, flag = 0; 8 | 9 | printf("\nEnter the number of elements: "); 10 | scanf("%d", &n); 11 | printf("Enter the Array in ascending order:\n"); 12 | for(i=0;i 4 | 5 | int isprime(int n) 6 | { 7 | /* 8 | Function that returns 9 | 0 --> when n is not a prime 10 | 1 --> when n is a prime 11 | */ 12 | 13 | int i; 14 | if(n == 1 || n == 0) 15 | { 16 | return 0; 17 | } 18 | 19 | /*Check only till n/2 because numbers > n/2 will never divide n*/ 20 | for(i = 2; i 45 | 46 | ![image](https://user-images.githubusercontent.com/44167922/50380645-40e1a680-0693-11e9-8a7d-d4b4d7ac1770.png) 47 | 48 | ## Concept used: 49 | 50 | - 2D Array Manipulation 51 | 52 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-07/program-07.c: -------------------------------------------------------------------------------- 1 | /*To compute product of two matrices by 2D Array manipulation*/ 2 | 3 | #include 4 | #include //For using exit(0); 5 | 6 | int main() 7 | { 8 | int m1[20][20], m2[20][20], m3[20][20], m, n, p, q, i, j, k; 9 | 10 | printf("\nEnter order of Matrix 1: "); 11 | scanf("%d%d", &m, &n); 12 | printf("Enter order of Matrix 2: "); 13 | scanf("%d%d", &p, &q); 14 | 15 | if(n == p) 16 | { 17 | printf("\nEnter the elements of matrix 1:\n"); 18 | for(i=0; i 4 | #include // Just for comparision between results 5 | 6 | int main() 7 | { 8 | int n, i; 9 | float x, term, sum = 0; 10 | 11 | printf("Enter the value in degrees: "); 12 | scanf("%f", &x); 13 | 14 | printf("Enter the number of terms in Taylor series expansion: "); 15 | scanf("%d", &n); 16 | 17 | 18 | // Convert to radians 19 | x = (x * 3.141592)/180; 20 | term = x; 21 | sum = x; 22 | 23 | for(i = 1; i<10; i++) 24 | { 25 | //Term closest to approximation. 26 | term = (-term*x*x)/(2*i*(2*i + 1)); 27 | 28 | //same as sum = sum + term; 29 | sum += term; 30 | } 31 | 32 | printf("Calculated = %f\n", sum); 33 | printf("Builtin function = %f\n", sin(x)); 34 | 35 | return 0; 36 | } 37 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-09/README.md: -------------------------------------------------------------------------------- 1 | # Program 09 2 | 3 | Write functions to implement string operations such as compare, concatenate, string length. Convince the parameter passing techniques. 4 | 5 | ## Output 6 | 7 | ```shell 8 | $ gedit program-09.c 9 | $ gcc program-09.c 10 | 11 | $ ./a.out 12 | Enter String 1:CPL 13 | Enter String 2:CPL 14 | 15 | Length of String 1: 3 16 | Length of String 2: 3 17 | The strings 'CPL', 'CPL' are equal. 18 | The concatenated string is: CPLCPL 19 | 20 | $ ./a.out 21 | Enter String 1:CPL 22 | Enter String 2:PCD 23 | 24 | Length of String 1: 3 25 | Length of String 2: 3 26 | The strings 'CPL', 'PCD' are not equal. 27 | The concatenated string is: CPLPCD 28 | 29 | ``` 30 | 31 | ## Screenshot 32 | 33 | ![image](https://user-images.githubusercontent.com/44167922/50373692-b05e8400-0608-11e9-99b3-3e4fdbf0c0e1.png) 34 | 35 | 36 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-09/program09.c: -------------------------------------------------------------------------------- 1 | /*To implement user-defined function for string functions*/ 2 | 3 | #include 4 | 5 | int slen(char s[]) 6 | { 7 | /*To compute the string length*/ 8 | 9 | int i, len = 0; 10 | for(i = 0; s[i] != '\0'; i++) 11 | { 12 | len++; 13 | } 14 | 15 | return len; 16 | } 17 | 18 | int scomp(char s1[], char s2[]) 19 | { 20 | /*To check and compare the strings*/ 21 | 22 | int i, j; 23 | 24 | if(slen(s1) != slen(s2)) 25 | { 26 | return 0; 27 | } 28 | 29 | for(i=0; s1[i] != '\0'; i++) 30 | { 31 | if(s1[i] != s2[i]) 32 | { 33 | return 0; 34 | } 35 | } 36 | 37 | return 1; 38 | } 39 | 40 | int scat(char s1[], char s2[]) 41 | { 42 | /*To concatenate 2 strings*/ 43 | 44 | int i, j; 45 | 46 | for(i = slen(s1), j=0; s2[j] != '\0'; i++, j++) 47 | { 48 | s1[i] = s2[j]; 49 | } 50 | 51 | //Assigning last element of string as null, to indicate end of string 52 | s1[i] = '\0'; 53 | 54 | return 0; 55 | } 56 | 57 | int main() 58 | { 59 | char s1[200], s2[200]; 60 | 61 | //using gets() is fine as long as newline character(enter key) is pressed. 62 | printf("Enter String 1:"); 63 | gets(s1); 64 | printf("Enter String 2:"); 65 | gets(s2); 66 | 67 | printf("\nLength of String 1: %d", slen(s1)); 68 | printf("\nLength of String 2: %d", slen(s2)); 69 | 70 | //Comparing s1, s2 71 | if(scomp(s1, s2)) 72 | { 73 | printf("\nThe strings '%s', '%s' are equal.", s1, s2); 74 | } 75 | else 76 | { 77 | printf("\nThe strings '%s', '%s' are not equal.", s1, s2); 78 | } 79 | 80 | //Concatinating s1, s2 81 | scat(s1, s2); 82 | 83 | printf("\nThe concatenated string is: %s\n", s1); 84 | 85 | return 0; 86 | 87 | } 88 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-10/README.md: -------------------------------------------------------------------------------- 1 | # Program 10 2 | 3 | Develop a program to sort the given set of N numbers using Bubble sort. 4 | 5 | ## Output 6 | 7 | ```shell 8 | $ gedit program10.c 9 | $ gcc program10.c 10 | $ ./a.out 11 | 12 | Enter the number of elements: 5 13 | Enter the array: 14 | 15 | 8 3 15 99 26 16 | 17 | The given array is: 18 | 8 3 15 99 26 19 | Array after bubble sorting is: 20 | 3 8 15 26 99 21 | 22 | ``` 23 | ## Flowchart 24 | 25 | ![Screenshot from 2019-07-21 21-43-52](https://user-images.githubusercontent.com/42874695/61593726-cf55e080-ac00-11e9-8798-58e99e5f28ff.png) 26 | 27 | 28 | 29 | ## Screenshot 30 | 31 | ![image](https://user-images.githubusercontent.com/44167922/50185185-275ff800-033d-11e9-8c6c-da72b7a401d7.png) 32 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-10/program10.c: -------------------------------------------------------------------------------- 1 | /*Program to implement bubble sort*/ 2 | 3 | #include 4 | 5 | int main() 6 | { 7 | int a[100], n, i, j, t; 8 | 9 | printf("\nEnter the number of elements: "); 10 | scanf("%d", &n); 11 | printf("Enter the array: \n"); 12 | for(i = 0; i a[j+1]) 29 | { 30 | //Swapping the right adjacent number 31 | t = a[j]; 32 | a[j] = a[j+1]; 33 | a[j+1] = t; 34 | } 35 | } 36 | } 37 | 38 | printf("\nArray after bubble sorting is:\n"); 39 | for(i = 0; i 4 | 5 | int main() 6 | { 7 | float x, n; 8 | int i; 9 | 10 | printf("Enter the number:"); 11 | scanf("%f", &n); 12 | 13 | // storing back-up 14 | x = n; 15 | 16 | //Compute square root using newton-raphson method 17 | for(i = 0; i<10 ; i++) 18 | { 19 | x = (x*x + n)/(2*x); 20 | } 21 | 22 | //Display Square root 23 | printf("The square root of number %f = %f\n", n, x); 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-12/README.md: -------------------------------------------------------------------------------- 1 | # Program 12 2 | 3 | Implement structures to read, write and compute average marks and the students scoring above and below the average marks for a class of N students. 4 | 5 | ## Output 6 | 7 | ```shell 8 | $ gedit program12.c 9 | $ gcc program12.c 10 | $ ./a.out 11 | 12 | Enter the number of students:3 13 | Enter the details: 14 | 15 | Enter student 1: 16 | Enter name: Dave 17 | Enter rollno: 1000 18 | Enter marks: 93 19 | 20 | Enter student 2: 21 | Enter name: Scott 22 | Enter rollno: 1001 23 | Enter marks: 85.75 24 | 25 | Enter student 3: 26 | Enter name: Ana 27 | Enter rollno: 1002 28 | Enter marks: 90.5 29 | Average = 89.750000 30 | 31 | Details of students who scored above average: 32 | Rollno Name Marks 33 | 1000 Dave 93.000000 34 | 1002 Ana 90.500000 35 | Details of students who scored below or equal to average: 36 | Rollno Name Marks 37 | 1001 Scott 85.750000 38 | 39 | ``` 40 | 41 | ## Screenshot 42 | ![image](https://user-images.githubusercontent.com/44167922/50140963-4bcfbc00-02cc-11e9-80b2-4f0aac86a280.png) 43 | -------------------------------------------------------------------------------- /sem-1-2/18CPL17-27_COMPUTER_PROGRAMMING_LABORATORY/Program-12/program12.c: -------------------------------------------------------------------------------- 1 | /*To implement stucture of student records*/ 2 | #include 3 | 4 | struct Student 5 | { 6 | int rollno; 7 | char name[30]; 8 | float marks; 9 | }; 10 | 11 | 12 | main() 13 | { 14 | struct Student S[100]; 15 | int n,i; 16 | float sum, avg; 17 | 18 | printf("Enter the number of students:"); 19 | scanf("%d", &n); 20 | 21 | //Input details into records 22 | printf("Enter the details:\n"); 23 | for(i=0;iavg) 50 | { 51 | printf("%d\t%s\t%f \n", S[i].rollno, S[i].name, S[i].marks); 52 | } 53 | } 54 | 55 | printf("Details of students who scored below or equal to average:\n"); 56 | printf("Rollno\tName\tMarks\n"); 57 | for(i=0;i 4 | #include // Because sqrt() and pow() are used. 5 | 6 | main() 7 | { 8 | float a[100], *p, sum, mean, sd, res; 9 | int n, i; 10 | printf("Enter the number of elements: "); 11 | scanf("%d", &n); 12 | printf("Enter the elements:\n"); 13 | for(i=0;i 4 | 5 | int bintodec(long int binary) 6 | { 7 | if(binary == 0) 8 | { 9 | return 0; 10 | } 11 | else 12 | { 13 | //Conversion to decimal. 14 | return(binary%10 + 2*bintodec(binary/10)); 15 | } 16 | } 17 | 18 | int main() 19 | { 20 | long int binary, decimal; 21 | printf("\nEnter the binary number to be converted: "); 22 | scanf("%ld", &binary); 23 | 24 | //Calling function 25 | decimal = bintodec(binary); 26 | 27 | printf("Decimal of %ld is: %ld\n\n", binary, decimal); 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /sem-1-2/readme.md: -------------------------------------------------------------------------------- 1 | # VTU Lab Material 2 | #### Ever had trouble getting the right VTU lab material to study from? Well look no further here's a collection of all resources required gathered under one roof! 3 | 4 | 5 | # Contributing 6 | To contribute to the project, Please take up the tasks specified in the issues. Add a comment in the issues if you are taking up one. 7 | 8 | ### Instructions 9 | - Fork the repository to your account. 10 | - Copy the clone url of your repository. 11 | - Clone the repository to your machine `git clone https://github.com/YOUR_USER_NAME/VTU-Lab-Material.git` 12 | - Make sure you create a branch with the name as the issue you are working on `git checkout -b YOUR_BRANCH_NAME`, and make sure you are working on the same branch and not the `master`, run `git status` to know which branch you are working on, run `git branch`, your branch will be highlighted with an `*`. If you are not in your branch or want to move to another branch use `git checkout BRANCH_NAME`. 13 | a good branch name should explain what this branch is about eg. `sem-5_CompterSciendce_DBMS` etc. 14 | - Add the upstream url of original repository, follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) 15 | - Make sure your repository is in sync with the original repository's master branch. Follow the instruction [here](https://help.github.com/articles/syncing-a-fork/) to know how to keep your local repository in sync. 16 | - Finally when you have made the changes, submit a pull request through github from the original repository, choose your branch against the master of original or create a new branch. -------------------------------------------------------------------------------- /sem-3/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/.DS_Store -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/01-Operations on Array/01-Operations on Array.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int a[10],n,item,i,pos; 5 | 6 | void create(); 7 | void display(); 8 | void insert(); 9 | void remove(); 10 | 11 | 12 | void create() 13 | { 14 | printf("Enter the size of array:"); 15 | scanf("%d",&n); 16 | printf("\nEnter the elements:\n"); 17 | for(i=0;i=pos;i--) 41 | { 42 | a[i+1]=a[i]; 43 | } 44 | a[pos]=item; 45 | n=n+1; 46 | } 47 | else 48 | { 49 | printf("Invalid position\n"); 50 | } 51 | } 52 | 53 | void remove() 54 | { 55 | printf("Enter the position of element to be deleted in an array:"); 56 | scanf("%d",&pos); 57 | item=a[pos]; 58 | if(pos<=n-1) 59 | { 60 | for(i=pos;i<=n-1;i++) 61 | { 62 | a[i]=a[i+1]; 63 | } 64 | n=n-1; 65 | printf("The deleted element= %d\n",item); 66 | } 67 | else 68 | printf("Invaild pos\n"); 69 | } 70 | 71 | void main() 72 | { 73 | int c; 74 | clrscr(); 75 | do 76 | { 77 | printf("Enter operator:\n"); 78 | printf("***MENU***\n1.CREATE\t2.Display\t3.insert\t4.delete\t5.exit\n"); 79 | scanf("%d",&c); 80 | 81 | switch(c) 82 | { 83 | case 1: create(); 84 | break; 85 | case 2: display(); 86 | break; 87 | case 3: insert(); 88 | break; 89 | case 4: remove(); 90 | break; 91 | case 5: exit(0); 92 | default:printf("invald operator"); 93 | } 94 | }while(c!=5); 95 | getch(); 96 | } 97 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/01-Operations on Array/readme.md: -------------------------------------------------------------------------------- 1 | # Program 01 2 | Design, Develop and Implement a menu driven Program in C for the following Array operations 3 | a. Creating an Array of N Integer Elements 4 | b. Display of Array Elements with Suitable Headings 5 | c. Inserting an Element (ELEM) at a given valid Position (POS) 6 | d. Deleting an Element at a given valid Position(POS) 7 | e. Exit. 8 | Support the program with functions for each of the above operations. 9 | 10 | ## Output 11 | 12 | ```shell 13 | # Paste the output here 14 | ``` 15 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/02-String match and replace/02-String match and replace.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | char str[100],pat[100],rep[100],ans[100]; 4 | int i,j,k,m,c,flag=0; 5 | 6 | 7 | void strmatch() 8 | { 9 | int i=c=m=j=0; 10 | while(str[c]!='\0') 11 | { 12 | if(str[m]==pat[i]) 13 | { 14 | i++;m++; 15 | if(pat[i]=='\0') 16 | { 17 | flag=1; 18 | for(k=0;rep[k]!='\0';k++,j++) 19 | {ans[j]=rep[k]; 20 | i=0;c=m; 21 | } 22 | } 23 | } 24 | else 25 | { 26 | ans[j]=str[c]; 27 | j++; 28 | c++; 29 | m=c; 30 | i=0; 31 | } 32 | } 33 | ans[j]='\0'; 34 | } 35 | 36 | void main() 37 | { 38 | printf("Enter the main string\n"); 39 | scanf("%s",str); 40 | printf("Enter the pat string\n"); 41 | scanf("%s",pat); 42 | printf("Enter the rep string\n"); 43 | scanf("%s",rep); 44 | strmatch(); 45 | if(flag==1) 46 | printf("The final string is:\n%s",ans); 47 | else 48 | printf("Invalid string"); 49 | } 50 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/02-String match and replace/readme.md: -------------------------------------------------------------------------------- 1 | # Program 02 2 | Design, Develop and Implement a Program in C for the following operations on Strings 3 | a. Read a main String (STR), a Pattern String (PAT) and a Replace String (REP) 4 | b. Perform Pattern Matching Operation: Find and Replace all occurrences of PAT in STR with 5 | REP if PAT exists in STR. Report suitable messages in case PAT does not exist in STR 6 | Support the program with functions for each of the above operations. Don't use Built-in functions. 7 | 8 | ## Output 9 | 10 | ```shell 11 | # Paste the output here 12 | ``` 13 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/03-Operations on STACK/readme.md: -------------------------------------------------------------------------------- 1 | # Program 03 2 | Design, Develop and Implement a menu driven Program in C for the following operations on STACK 3 | of Integers (Array Implementation of Stack with maximum size MAX) 4 | a. Push an Element on to Stack 5 | b. Pop an Element from Stack 6 | c. Demonstrate how Stack can be used to check Palindrome 7 | d. Demonstrate Overflow and Underflow situations on Stack 8 | e. Display the status of Stack 9 | f. Exit 10 | Support the program with appropriate functions for each of the above operations 11 | 12 | ## Output 13 | 14 | ```shell 15 | # Paste the output here 16 | ``` 17 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/04-Infix to Postfix Expression/readme.md: -------------------------------------------------------------------------------- 1 | # Program 04 2 | Design, Develop and Implement a Program in C for converting an Infix Expression to Postfix 3 | Expression. Program should support for both parenthesized and free parenthesized expressions with the 4 | operators: +, -, *, /, %( Remainder), ^ (Power) and alphanumeric operands. 5 | 6 | ## Output 7 | 8 | ```shell 9 | # Paste the output here 10 | ``` 11 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/05a-Evaluate a Postfix Expression/05a-Evaluate a Postfix Expression.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define max 10 5 | int symb; 6 | char postfix[50]; 7 | 8 | struct stack 9 | { 10 | int top; 11 | char item[max]; 12 | }s; 13 | 14 | void push(char value) 15 | { 16 | if(s.top==(max-1)) 17 | { 18 | printf("full\n"); 19 | } 20 | else 21 | { 22 | s.item[++s.top]=value; 23 | } 24 | } 25 | 26 | int empty() 27 | { 28 | if(s.top==-1) 29 | return 1; 30 | else 31 | return 0; 32 | } 33 | 34 | char pop() 35 | { 36 | if(!empty()) 37 | { 38 | return(s.item[s.top--]); 39 | } 40 | } 41 | 42 | int operation(int a,int b,int c) 43 | { 44 | switch(c) 45 | { 46 | case '+':return(a+b); 47 | case '-':return(a-b); 48 | case '*':return(a*b); 49 | case '/':return(a/b); 50 | case '%':return(a%b); 51 | case '^':return(pow(a,b)); 52 | } 53 | } 54 | 55 | int evaluate() 56 | { 57 | int i; 58 | int op1,op2,value,ans; 59 | for(i=0;postfix[i]!='\0';i++) 60 | { 61 | symb=postfix[i]; 62 | if(symb>='0'&&symb<='9') 63 | { 64 | push((int)(symb-'0')); 65 | } 66 | else 67 | { 68 | op1=pop(); 69 | op2=pop(); 70 | value=operation(op2,op1,symb); 71 | push(value); 72 | } 73 | } 74 | ans=pop(); 75 | return ans; 76 | } 77 | 78 | void main() 79 | { 80 | int ax; 81 | s.top=-1; 82 | printf("Enter postfix:\n"); 83 | gets(postfix); 84 | ax=evaluate(); 85 | printf("ans=%d\n",ax); 86 | } 87 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/05a-Evaluate a Postfix Expression/readme.md: -------------------------------------------------------------------------------- 1 | # Program 5a 2 | Design, Develop and Implement a Program in C for the following Stack Applications: 3 | a. Evaluation of 4 | Suffix expression with single digit operands and operators: +, -, *, /, %, ^ 5 | 6 | ## Output 7 | 8 | ```shell 9 | # Paste the output here 10 | ``` 11 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/05b-Tower of Hanoi/05b-Tower of Hanoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void tower(int n,int source,int temp,int dest) 6 | { 7 | if(n==0) 8 | return; 9 | tower(n-1,source,dest,temp); 10 | printf("\nMove disk %d from %c to %c\n",n,source,dest); 11 | tower(n-1,temp,source,dest); 12 | } 13 | 14 | void main() 15 | { 16 | int n; 17 | printf("Enter the number of disks:\n"); 18 | scanf("%d",&n); 19 | tower(n,'A','B','C'); 20 | printf("\nThe total number of moves are:\n%d\n",(int)pow(2,n)-1); 21 | } 22 | 23 | 24 | 25 | /* 26 | OUTPUT: 27 | 28 | Enter the number of disks: 29 | 3 30 | 31 | Move disk 1 from A to C 32 | 33 | Move disk 2 from A to B 34 | 35 | Move disk 1 from C to B 36 | 37 | Move disk 3 from A to C 38 | 39 | Move disk 1 from B to A 40 | 41 | Move disk 2 from B to C 42 | 43 | Move disk 1 from A to C 44 | 45 | The total number of moves are: 46 | 7 47 | 48 | 49 | 50 | Enter the number of disks: 51 | 0 52 | 53 | The total number of moves are: 54 | 0 55 | */ 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/05b-Tower of Hanoi/readme.md: -------------------------------------------------------------------------------- 1 | # Program 5b 2 | Design, Develop and Implement a Program in C for the following Stack Applications: 3 | b. Solving Tower of Hanoi problem with n disks 4 | 5 | ## Output 6 | 7 | ```shell 8 | Enter the number of disks: 9 | 3 10 | Move disk 1 from A to C 11 | Move disk 2 from A to B 12 | Move disk 1 from C to B 13 | Move disk 3 from A to C 14 | Move disk 1 from B to A 15 | Move disk 2 from B to C 16 | Move disk 1 from A to C 17 | The total number of moves are: 18 | 7 19 | Enter the number of disks: 20 | 0 21 | The total number of moves are: 22 | 0 23 | ``` 24 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/06-Circular Queue/06-Circular Queue.c: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/06-Circular Queue/readme.md: -------------------------------------------------------------------------------- 1 | # Program 06 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Circular 3 | QUEUE of Characters (Array Implementation of Queue with maximum size MAX) 4 | a. Insert an Element on to Circular QUEUE 5 | b. Delete an Element from Circular QUEUE 6 | c. Demonstrate Overflow and Underflow situations on Circular QUEUE 7 | d. Display the status of Circular QUEUE 8 | e. Exit 9 | Support the program with appropriate functions for each of the above operations 10 | 11 | ## Output 12 | 13 | ```shell 14 | # Paste the output here 15 | ``` 16 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/07-Singally Linked List/readme.md: -------------------------------------------------------------------------------- 1 | # Program 07 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Singly 3 | Linked List (SLL) of Student Data with the fields: USN, Name, Branch, Sem, PhNo 4 | a. Create a SLL of N Students Data by using front insertion. 5 | b. Display the status of SLL and count the number of nodes in it 6 | c. Perform Insertion and Deletion at End of SLL 7 | d. Perform Insertion and Deletion at Front of SLL 8 | e. Demonstrate how this SLL can be used as STACK and QUEUE 9 | f. Exit 10 | 11 | ## Output 12 | 13 | ```shell 14 | # Paste the output here 15 | ``` 16 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/08-Doubally Linked List/readme.md: -------------------------------------------------------------------------------- 1 | # Program 08 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Doubly 3 | Linked List (DLL) of Employee Data with the fields: SSN, Name, Dept, Designation, Sal, PhNo 4 | a. Create a DLL of N Employees Data by using end insertion. 5 | b. Display the status of DLL and count the number of nodes in it 6 | c. Perform Insertion and Deletion at End of DLL 7 | d. Perform Insertion and Deletion at Front of DLL 8 | e. Demonstrate how this DLL can be used as Double Ended Queue 9 | f. Exit 10 | 11 | ## Output 12 | 13 | ```shell 14 | # Paste the output here 15 | ``` 16 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/09-Circular Singally Linked List/readme.md: -------------------------------------------------------------------------------- 1 | # Program 09 2 | Design, Develop and Implement a Program in C for the following operations on Singly Circular 3 | Linked List (SCLL) with header nodes 4 | a. Represent and Evaluate a Polynomial P(x,y,z) = 6x2y2z-4yz5+3x3yz+2xy5z-2xyz3 5 | b. Find the sum of two polynomials POLY1(x,y,z) and POLY2(x,y,z) and store the result in 6 | POLYSUM(x,y,z) 7 | Support the program with appropriate functions for each of the above operations 8 | 9 | ## Output 10 | 11 | ```shell 12 | # Paste the output here 13 | ``` 14 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/10- Binary search tree/readme.md: -------------------------------------------------------------------------------- 1 | # Program 10 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Binary 3 | Search Tree (BST) of Integers 4 | a. Create a BST of N Integers: 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2 5 | b. Traverse the BST in Inorder, Preorder and Post Order 6 | c. Search the BST for a given element (KEY) and report the appropriate message 7 | d. Delete an element(ELEM) from BST 8 | e. Exit 9 | 10 | ## Output 11 | 12 | ```shell 13 | # Paste the output here 14 | ``` 15 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/11-BSF and DSF/11-BSF and DSF.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/11-BSF and DSF/readme.md: -------------------------------------------------------------------------------- 1 | # Program 11 2 | Design, Develop and Implement a Program in C for the following operations on Graph(G) of Cities 3 | a. Create a Graph of N cities using Adjacency Matrix. 4 | b. Print all the nodes reachable from a given starting node in a digraph using BFS method 5 | c. Check whether a given graph is connected or not using DFS method. 6 | 7 | ## Output 8 | 9 | ```shell 10 | # Paste the output here 11 | ``` 12 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LAB/12-Hash Table/readme.md: -------------------------------------------------------------------------------- 1 | # Program 12 2 | Given a File of N employee records with a set K of Keys(4-digit) which uniquely determine the records 3 | in file F. Assume that file F is maintained in memory by a Hash Table(HT) of m memory locations 4 | with L as the set of memory addresses (2-digit) of locations in HT. Let the keys in K and addresses in L 5 | are Integers. Design and develop a Program in C that uses Hash function H: K ®L as H(K)=K mod m 6 | (remainder method), and implement hashing technique to map a given key K to the address space L. 7 | Resolve the collision (if any) using linear probing. 8 | 9 | ## OUTPUT: 10 | ```shell 11 | 12 | Enter the number of employee records 13 | 5 14 | Enter the two digit memory location 15 | 10 16 | Enter the four digit key values employee records 17 | 1234 18 | 1456 19 | 1784 20 | Collision detected and avoided by liner probing1890 21 | 1536 22 | Collision detected and avoided by liner probingHash table contents are: 23 | [0]-->1890 24 | [1]-->-1 25 | [2]-->-1 26 | [3]-->-1 27 | [4]-->1234 28 | [5]-->1784 29 | [6]-->1456 30 | [7]-->1536 31 | [8]-->-1 32 | [9]-->-1 33 | 34 | ``` 35 | -------------------------------------------------------------------------------- /sem-3/computer_science/DS_LabManual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/computer_science/DS_LabManual.pdf -------------------------------------------------------------------------------- /sem-3/electronics_and_communication/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/electronics_and_communication/.gitkeep -------------------------------------------------------------------------------- /sem-3/information_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/.gitkeep -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/01-Half Adder/01-Half Adder.HDL: -------------------------------------------------------------------------------- 1 | module ha( a, b, s, c);  2 | input a, b; 3 | output s, c; 4 | assign s= a ^ b; 5 | assign c= a & b;  6 | endmodule 7 | 8 | -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/01-Half Adder/half adder big.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/01-Half Adder/half adder big.PNG -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/02-Half Subtractor/02-Half Substractor.HDL: -------------------------------------------------------------------------------- 1 | module hs( a, b, d, br);  2 | input a, b;  3 | output d, br; 4 | assign d= a ^ b; 5 | assign br= ~a & b; 6 | endmodule -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/02-Half Subtractor/half subtractor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/02-Half Subtractor/half subtractor.PNG -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/03-Full Subtractor/03-Full Subtractor.HDL: -------------------------------------------------------------------------------- 1 | module fs( a, b, c, d, br);  2 | input a, b, c; 3 | output d, br; 4 | assign d= a ^ b ^ c; 5 | assign br=(( ~a)& (b ^ c)) | (b & c); 6 | endmodule -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/03-Full Subtractor/full subtractor.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/03-Full Subtractor/full subtractor.PNG -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/04-Full Adder/04-Full adder.HDL: -------------------------------------------------------------------------------- 1 | module fa( a, b, c, s, ca); 2 | input a, b, c; 3 | output s, ca; 4 | assign s= a ^ b ^ c; 5 | assign ca=((a&b)|(c&(a^b))); 6 | endmodule -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/04-Full Adder/full adder.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/04-Full Adder/full adder.PNG -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/05-Jk Flip flop/05-JK Flip flop.HDL: -------------------------------------------------------------------------------- 1 | module jkff(j,k,clk,rst, q,qb); 2 | input j,k,clk,rst; 3 | output q,qb; 4 | reg q,qb; 5 | reg [1:0]jk; 6 | always @ (posedge clk,posedge rst) 7 | begin 8 | jk={j,k}; 9 | if(rst==0) 10 | begin 11 | case (jk) 12 | 2'd1:q=1'b0; 13 | 2'd2:q=1'b1; 14 | 2'd3:q=~q; 15 | default: begin 16 | end 17 | endcase 18 | end 19 | else 20 | q=1'b0; 21 | qb=~q; 22 | end 23 | endmodule -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/05-Jk Flip flop/jk output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/05-Jk Flip flop/jk output.png -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/06-Multiplexer/06-8:1 Multiplexer.HDL: -------------------------------------------------------------------------------- 1 | module mux8to1(s,d,y); 2 | input [2:0]s; 3 | output [7:0]d; 4 | output y; 5 | reg y; 6 | always @ (s or d) 7 | case(s) 8 | 0:y= d[0]; 9 | 1:y= d[1]; 10 | 2:y= d[2]; 11 | 3:y= d[3]; 12 | 4:y= d[4]; 13 | 5:y= d[5]; 14 | 6:y= d[6]; 15 | 7:y= d[7]; 16 | endcase 17 | endmodule -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/06-Multiplexer/mux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/06-Multiplexer/mux.png -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/07-Op-amp/1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/07-Op-amp/1.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/07-Op-amp/2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/07-Op-amp/2.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/07-Op-amp/3.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/07-Op-amp/3.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/08-Multi Vibrator/1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/08-Multi Vibrator/1.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/08-Multi Vibrator/2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/08-Multi Vibrator/2.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/09-Window Comparator/1.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/09-Window Comparator/1.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/ADE_LAB/09-Window Comparator/2.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/ADE_LAB/09-Window Comparator/2.jpeg -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/01-Operations on Array/readme.md: -------------------------------------------------------------------------------- 1 | # Program 01 2 | Design, Develop and Implement a menu driven Program in C for the following Array operations 3 | a. Creating an Array of N Integer Elements 4 | b. Display of Array Elements with Suitable Headings 5 | c. Inserting an Element (ELEM) at a given valid Position (POS) 6 | d. Deleting an Element at a given valid Position(POS) 7 | e. Exit. 8 | Support the program with functions for each of the above operations. 9 | 10 | ## Output 11 | 12 | ```shell 13 | # Paste the output here 14 | ``` 15 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/02-String match and replace/02-String match and replace.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | char str[100],pat[100],rep[100],ans[100]; 4 | int i,j,k,m,c,flag=0; 5 | 6 | 7 | void putmat() 8 | { 9 | int i=c=m=j=0; 10 | while(str[c]!='\0') 11 | { 12 | if(str[m]==pat[i]) 13 | { 14 | i++;m++; 15 | if(pat[i]=='\0') 16 | { 17 | flag=1; 18 | for(k=0;rep[k]!='\0';k++,j++) 19 | {ans[j]=rep[k]; 20 | i=0;c=m; 21 | } 22 | } 23 | } 24 | else 25 | { 26 | ans[j]=str[c]; 27 | j++; 28 | c++; 29 | m=c; 30 | i=0; 31 | } 32 | } 33 | ans[j]='\0'; 34 | } 35 | 36 | void main() 37 | { 38 | printf("Enter the main string\n"); 39 | gets(str); 40 | printf("Enter the pat string\n"); 41 | gets(pat); 42 | printf("Enter the rep string\n"); 43 | gets(rep); 44 | putmat(); 45 | if(flag==1) 46 | printf("Pattern string is found in the main string\n The final string is:\n%s",ans); 47 | else 48 | printf("Pattern string is not found on the main string\n"); 49 | } 50 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/02-String match and replace/readme.md: -------------------------------------------------------------------------------- 1 | # Program 02 2 | Design, Develop and Implement a Program in C for the following operations on Strings 3 | a. Read a main String (STR), a Pattern String (PAT) and a Replace String (REP) 4 | b. Perform Pattern Matching Operation: Find and Replace all occurrences of PAT in STR with 5 | REP if PAT exists in STR. Report suitable messages in case PAT does not exist in STR 6 | Support the program with functions for each of the above operations. Don't use Built-in functions. 7 | 8 | ## Output 9 | 10 | ```shell 11 | # Paste the output here 12 | ``` 13 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/03-Operations on STACK/readme.md: -------------------------------------------------------------------------------- 1 | # Program 03 2 | Design, Develop and Implement a menu driven Program in C for the following operations on STACK 3 | of Integers (Array Implementation of Stack with maximum size MAX) 4 | a. Push an Element on to Stack 5 | b. Pop an Element from Stack 6 | c. Demonstrate how Stack can be used to check Palindrome 7 | d. Demonstrate Overflow and Underflow situations on Stack 8 | e. Display the status of Stack 9 | f. Exit 10 | Support the program with appropriate functions for each of the above operations 11 | 12 | ## Output 13 | 14 | ```shell 15 | # Paste the output here 16 | ``` 17 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/04-Infix to Postfix Expression/readme.md: -------------------------------------------------------------------------------- 1 | # Program 04 2 | Design, Develop and Implement a Program in C for converting an Infix Expression to Postfix 3 | Expression. Program should support for both parenthesized and free parenthesized expressions with the 4 | operators: +, -, *, /, %( Remainder), ^ (Power) and alphanumeric operands. 5 | 6 | ## Output 7 | 8 | ```shell 9 | # Paste the output here 10 | ``` 11 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/05a-Evaluate a Postfix Expression/05a-Evaluate a Postfix Expression.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #define max 5 6 | 7 | char postfix[100]; 8 | 9 | struct stack 10 | { 11 | int item[max]; 12 | int top; 13 | }s; 14 | 15 | void push(int value) 16 | { 17 | if(s.top==max-1) printf("overflow\n"); 18 | else 19 | { 20 | //printf("Enter the element to be added\n"); 21 | s.item[++s.top]=value; 22 | } 23 | } 24 | 25 | int pop() 26 | { 27 | if(s.top==-1) printf("underflow\n"); 28 | else return(s.item[s.top--]); 29 | } 30 | 31 | int empty() 32 | { 33 | if(s.top==-1) return 1; 34 | else return 0; 35 | } 36 | int operation(int a,int b,char o) 37 | { 38 | switch (o) 39 | { 40 | case '^':return(pow(a,b)); 41 | case '/':return(a/b); 42 | case '%':return(a%b); 43 | case '*':return(a*b); 44 | case '+':return(a+b); 45 | case '-':return(a-b); 46 | 47 | 48 | } 49 | } 50 | int evaluate() 51 | { 52 | int i,a,b,ans,value; 53 | char symb; 54 | for(i=0;postfix[i]!='\0';i++) 55 | { 56 | symb=postfix[i]; 57 | if(symb>='0' && symb<='9') 58 | { 59 | push((int) (symb-'0')); 60 | } 61 | else 62 | { 63 | a=pop(); 64 | b=pop(); 65 | value=operation(b,a,symb); 66 | push(value); 67 | } 68 | 69 | } 70 | ans=pop(); 71 | return ans; 72 | } 73 | void main() 74 | { 75 | s.top=-1; 76 | int ans; 77 | printf("Enter the postfix expression\n"); 78 | gets(postfix); 79 | ans=evaluate(); 80 | printf("Resultant=%d",ans); 81 | } 82 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/05a-Evaluate a Postfix Expression/readme.md: -------------------------------------------------------------------------------- 1 | # Program 5a 2 | Design, Develop and Implement a Program in C for the following Stack Applications: 3 | a. Evaluation of 4 | Suffix expression with single digit operands and operators: +, -, *, /, %, ^ 5 | 6 | ## Output 7 | 8 | ```shell 9 | # Paste the output here 10 | ``` 11 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/05b-Tower of Hanoi/05b-Tower of Hanoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void tower(int n,int source,int temp,int dest) 6 | { 7 | if(n==0) 8 | return; 9 | tower(n-1,source,dest,temp); 10 | printf("\nMove disk %d from %c to %c\n",n,source,dest); 11 | tower(n-1,temp,source,dest); 12 | } 13 | 14 | void main() 15 | { 16 | int n; 17 | printf("Enter the number of disks:\n"); 18 | scanf("%d",&n); 19 | tower(n,'A','B','C'); 20 | printf("\nThe total number of moves are:\n%d\n",(int)pow(2,n)-1); 21 | } 22 | 23 | 24 | 25 | /* 26 | OUTPUT: 27 | 28 | Enter the number of disks: 29 | 3 30 | 31 | Move disk 1 from A to C 32 | 33 | Move disk 2 from A to B 34 | 35 | Move disk 1 from C to B 36 | 37 | Move disk 3 from A to C 38 | 39 | Move disk 1 from B to A 40 | 41 | Move disk 2 from B to C 42 | 43 | Move disk 1 from A to C 44 | 45 | The total number of moves are: 46 | 7 47 | 48 | 49 | 50 | Enter the number of disks: 51 | 0 52 | 53 | The total number of moves are: 54 | 0 55 | */ 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/05b-Tower of Hanoi/readme.md: -------------------------------------------------------------------------------- 1 | # Program 5b 2 | Design, Develop and Implement a Program in C for the following Stack Applications: 3 | b. Solving Tower of Hanoi problem with n disks 4 | 5 | ## Output 6 | 7 | ```shell 8 | Enter the number of disks: 9 | 3 10 | Move disk 1 from A to C 11 | Move disk 2 from A to B 12 | Move disk 1 from C to B 13 | Move disk 3 from A to C 14 | Move disk 1 from B to A 15 | Move disk 2 from B to C 16 | Move disk 1 from A to C 17 | The total number of moves are: 18 | 7 19 | Enter the number of disks: 20 | 0 21 | The total number of moves are: 22 | 0 23 | ``` 24 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/06-Circular Queue/readme.md: -------------------------------------------------------------------------------- 1 | # Program 06 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Circular 3 | QUEUE of Characters (Array Implementation of Queue with maximum size MAX) 4 | a. Insert an Element on to Circular QUEUE 5 | b. Delete an Element from Circular QUEUE 6 | c. Demonstrate Overflow and Underflow situations on Circular QUEUE 7 | d. Display the status of Circular QUEUE 8 | e. Exit 9 | Support the program with appropriate functions for each of the above operations 10 | 11 | ## Output 12 | 13 | ```shell 14 | # Paste the output here 15 | ``` 16 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/07-Singally Linked List/readme.md: -------------------------------------------------------------------------------- 1 | # Program 07 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Singly 3 | Linked List (SLL) of Student Data with the fields: USN, Name, Branch, Sem, PhNo 4 | a. Create a SLL of N Students Data by using front insertion. 5 | b. Display the status of SLL and count the number of nodes in it 6 | c. Perform Insertion and Deletion at End of SLL 7 | d. Perform Insertion and Deletion at Front of SLL 8 | e. Demonstrate how this SLL can be used as STACK and QUEUE 9 | f. Exit 10 | 11 | ## Output 12 | 13 | ```shell 14 | # Paste the output here 15 | ``` 16 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/08-Doubally Linked List/readme.md: -------------------------------------------------------------------------------- 1 | # Program 08 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Doubly 3 | Linked List (DLL) of Employee Data with the fields: SSN, Name, Dept, Designation, Sal, PhNo 4 | a. Create a DLL of N Employees Data by using end insertion. 5 | b. Display the status of DLL and count the number of nodes in it 6 | c. Perform Insertion and Deletion at End of DLL 7 | d. Perform Insertion and Deletion at Front of DLL 8 | e. Demonstrate how this DLL can be used as Double Ended Queue 9 | f. Exit 10 | 11 | ## Output 12 | 13 | ```shell 14 | # Paste the output here 15 | ``` 16 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/09-Circular Singally Linked List/readme.md: -------------------------------------------------------------------------------- 1 | # Program 09 2 | Design, Develop and Implement a Program in C for the following operations on Singly Circular 3 | Linked List (SCLL) with header nodes 4 | a. Represent and Evaluate a Polynomial P(x,y,z) = 6x2y2z-4yz5+3x3yz+2xy5z-2xyz3 5 | b. Find the sum of two polynomials POLY1(x,y,z) and POLY2(x,y,z) and store the result in 6 | POLYSUM(x,y,z) 7 | Support the program with appropriate functions for each of the above operations 8 | 9 | ## Output 10 | 11 | ```shell 12 | # Paste the output here 13 | ``` 14 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/10- Binary search tree/readme.md: -------------------------------------------------------------------------------- 1 | # Program 10 2 | Design, Develop and Implement a menu driven Program in C for the following operations on Binary 3 | Search Tree (BST) of Integers 4 | a. Create a BST of N Integers: 6, 9, 5, 2, 8, 15, 24, 14, 7, 8, 5, 2 5 | b. Traverse the BST in Inorder, Preorder and Post Order 6 | c. Search the BST for a given element (KEY) and report the appropriate message 7 | d. Delete an element(ELEM) from BST 8 | e. Exit 9 | 10 | ## Output 11 | 12 | ```shell 13 | # Paste the output here 14 | ``` 15 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/11-BSF and DSF/readme.md: -------------------------------------------------------------------------------- 1 | # Program 11 2 | Design, Develop and Implement a Program in C for the following operations on Graph(G) of Cities 3 | a. Create a Graph of N cities using Adjacency Matrix. 4 | b. Print all the nodes reachable from a given starting node in a digraph using BFS method 5 | c. Check whether a given graph is connected or not using DFS method. 6 | 7 | ## Output 8 | 9 | ```shell 10 | # Paste the output here 11 | ``` 12 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LAB/12-Hash Table/readme.md: -------------------------------------------------------------------------------- 1 | # Program 12 2 | Given a File of N employee records with a set K of Keys(4-digit) which uniquely determine the records 3 | in file F. Assume that file F is maintained in memory by a Hash Table(HT) of m memory locations 4 | with L as the set of memory addresses (2-digit) of locations in HT. Let the keys in K and addresses in L 5 | are Integers. Design and develop a Program in C that uses Hash function H: K ®L as H(K)=K mod m 6 | (remainder method), and implement hashing technique to map a given key K to the address space L. 7 | Resolve the collision (if any) using linear probing. 8 | 9 | ## OUTPUT: 10 | ```shell 11 | 12 | Enter the number of employee records 13 | 5 14 | Enter the two digit memory location 15 | 10 16 | Enter the four digit key values employee records 17 | 1234 18 | 1456 19 | 1784 20 | Collision detected and avoided by liner probing1890 21 | 1536 22 | Collision detected and avoided by liner probingHash table contents are: 23 | [0]-->1890 24 | [1]-->-1 25 | [2]-->-1 26 | [3]-->-1 27 | [4]-->1234 28 | [5]-->1784 29 | [6]-->1456 30 | [7]-->1536 31 | [8]-->-1 32 | [9]-->-1 33 | 34 | ``` 35 | -------------------------------------------------------------------------------- /sem-3/information_science/DS_LabManual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-3/information_science/DS_LabManual.pdf -------------------------------------------------------------------------------- /sem-3/readme.md: -------------------------------------------------------------------------------- 1 | # VTU Lab Material 2 | #### Ever had trouble getting the right VTU lab material to study from? Well look no further here's a collection of all resources required gathered under one roof! 3 | 4 | 5 | # Contributing 6 | To contribute to the project, Please take up the tasks specified in the issues. Add a comment in the issues if you are taking up one. 7 | 8 | ### Instructions 9 | - Fork the repository to your account. 10 | - Copy the clone url of your repository. 11 | - Clone the repository to your machine `git clone https://github.com/YOUR_USER_NAME/VTU-Lab-Material.git` 12 | - Make sure you create a branch with the name as the issue you are working on `git checkout -b YOUR_BRANCH_NAME`, and make sure you are working on the same branch and not the `master`, run `git status` to know which branch you are working on, run `git branch`, your branch will be highlighted with an `*`. If you are not in your branch or want to move to another branch use `git checkout BRANCH_NAME`. 13 | a good branch name should explain what this branch is about eg. `sem-5_CompterSciendce_DBMS` etc. 14 | - Add the upstream url of original repository, follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) 15 | - Make sure your repository is in sync with the original repository's master branch. Follow the instruction [here](https://help.github.com/articles/syncing-a-fork/) to know how to keep your local repository in sync. 16 | - Finally when you have made the changes, submit a pull request through github from the original repository, choose your branch against the master of original or create a new branch. -------------------------------------------------------------------------------- /sem-4/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-4/.DS_Store -------------------------------------------------------------------------------- /sem-4/computer_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-4/computer_science/.gitkeep -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P01a.java: -------------------------------------------------------------------------------- 1 | /* 2 | 1) a) Create a Java class called Student with the following details as variables within it. 3 | (i) USN 4 | (ii) Name 5 | (iii) Branch 6 | (iv) Phone 7 | Write a Java program to create n Student objects 8 | and print the USN, Name, Branch, and Phone of these objects with suitable headings. 9 | */ 10 | import java.util.Scanner; 11 | class Student 12 | { 13 | String USN; 14 | String name; 15 | String branch; 16 | String phone; 17 | public void getInfo() 18 | { 19 | Scanner in=new Scanner(System.in); 20 | System.out.println("Enter the USN:"); 21 | USN=in.next(); 22 | System.out.println("Enter the Name:"); 23 | name=in.next(); 24 | System.out.println("Enter the Branch:"); 25 | branch=in.next(); 26 | System.out.println("Enter the Phone No:"); 27 | phone=in.next(); 28 | } 29 | public void display() 30 | { 31 | System.out.println(USN+"\t"+name+"\t"+branch+"\t\t"+phone); 32 | } 33 | } 34 | public class P01a{ 35 | public static void main(String[] args) 36 | { 37 | int i; 38 | Student[] S=new Student[100]; 39 | Scanner in=new Scanner(System.in); 40 | System.out.println("Enter the number of students"); 41 | int n=in.nextInt(); 42 | System.out.println("Enter the Student details"); 43 | for(i=0;i=0; i--) 53 | System.out.println(stk[i]); 54 | } 55 | } 56 | } 57 | public class P02 58 | { 59 | public static void main(String[] args) 60 | { 61 | Scanner in = new Scanner(System.in); 62 | Stack obj=new Stack(); 63 | while(true) 64 | { 65 | System.out.println("-----------Menu------------"); 66 | System.out.println("1.Push\t2.Pop\t3.Display"); 67 | System.out.println("---------------------------"); 68 | System.out.println("Enter your choice"); 69 | int ch = in.nextInt(); 70 | switch(ch) 71 | { 72 | case 1:obj.push(); 73 | break; 74 | case 2:obj.pop(); 75 | break; 76 | case 3:obj.display(); 77 | break; 78 | default:System.out.println("Invalid choice"); 79 | return; 80 | 81 | } 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P02b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 2b. Write a Java class called Customer to store their name and date_of_birth. The date_of_birth format should be dd/mm/yyyy. Write methods to read customer data as and display as using StringTokenizer class considering the delimiter character as “/”. 4 | 5 | */ 6 | import java.util.Scanner; 7 | import java.util.StringTokenizer; 8 | class Customer 9 | { 10 | String cname; 11 | String DOB; 12 | void readData() 13 | { 14 | Scanner in=new Scanner(System.in); 15 | System.out.println("Enter the customer name"); 16 | cname=in.nextLine(); 17 | System.out.println("Enter the Date of Birth"); 18 | DOB=in.next(); 19 | } 20 | void display() 21 | { 22 | StringTokenizer st=new StringTokenizer(DOB,"/"); 23 | System.out.print(cname); 24 | while(st.hasMoreTokens()) 25 | { 26 | System.out.print(", "+st.nextToken()); 27 | } 28 | } 29 | } 30 | public class P02b 31 | { 32 | public static void main(String[] args) 33 | { 34 | Customer c=new Customer(); 35 | c.readData(); 36 | c.display(); 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P03a.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3. a. Write a Java program to read two integers a and b. Compute a/b and print, when b is not zero. 3 | Raise an exception when b is equal to zero. 4 | */import java.util.Scanner; 5 | public class p03a 6 | { 7 | public static void main(String[] args) 8 | { 9 | Scanner in=new Scanner(System.in); 10 | System.out.println("Enter two numbers"); 11 | int a=in.nextInt(); 12 | int b=in.nextInt(); 13 | try 14 | { 15 | if(b==0) 16 | throw new ArithmeticException("Devide by 0 error"); 17 | int result=a/b; 18 | System.out.println(a + "/" + b + "=" + result); 19 | } 20 | catch(ArithmeticException e) 21 | { 22 | System.out.println("Raised exception is " + e); 23 | } 24 | finally 25 | { 26 | System.out.println("Execution Finished"); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P03b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | b. Write a Java program that implements a multi-thread application that has three threads. 4 | First thread generates a random integer for every 1 second; 5 | second thread computes the square of the number and prints; 6 | third thread will print the value of cube of the number. 7 | 8 | */ 9 | import java.util.Random; 10 | class RandomNumThread extends Thread 11 | { 12 | Random rand = new Random(); 13 | public void run() 14 | { 15 | try 16 | { 17 | for(int i=0;i<10;i++) 18 | { 19 | System.out.println("Number generated is " + rand.nextInt(100)+" "); 20 | Thread.sleep(1000); 21 | } 22 | } 23 | catch (InterruptedException e) 24 | { 25 | e.printStackTrace(); 26 | } 27 | } 28 | } 29 | class SquareNum extends Thread 30 | { 31 | int num; 32 | 33 | SquareNum(int a) 34 | { 35 | num = a; 36 | } 37 | public void run() 38 | { 39 | for(int i=1;ij) 22 | sol[i][j]=sol[i-1][j]; 23 | else 24 | sol[i][j]=Math.max((sol[i-1][j]), (sol[i - 1][j - wt[i]] + val[i])); 25 | } 26 | } 27 | System.out.println("The optimal solution is "+sol[N][W]); 28 | int[] selected = new int[N + 1]; 29 | for(i=0;i0&&j>0) 34 | { 35 | if (sol[i][j] !=sol[i-1][j]) 36 | { 37 | selected[i] = 1; 38 | j = j - wt[i]; 39 | } 40 | i--; 41 | } 42 | System.out.println("\nItems selected : "); 43 | for ( i = 1; i < N + 1; i++) 44 | if (selected[i] == 1) 45 | System.out.print(i +" "); 46 | System.out.println(); 47 | } 48 | } 49 | public class P06a 50 | { 51 | public static void main(String[] args) 52 | { 53 | Scanner scan = new Scanner(System.in); 54 | knapsackDP ks = new knapsackDP(); 55 | System.out.println("Enter number of elements "); 56 | int n = scan.nextInt(); 57 | int[] wt = new int[n + 1]; 58 | int[] val = new int[n + 1]; 59 | System.out.println("\nEnter weight of "+ n +" elements"); 60 | for (int i = 1; i <= n; i++) 61 | wt[i] = scan.nextInt(); 62 | System.out.println("\nEnter values of "+ n +" elements"); 63 | for (int i = 1; i <= n; i++) 64 | val[i] = scan.nextInt(); 65 | System.out.println("\nEnter knapsack capacity "); 66 | int W = scan.nextInt(); 67 | ks.solve(wt, val, W, n); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P06b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Knapsack using 4 | (b) Greedy method. 5 | 6 | */ 7 | 8 | import java.util.Scanner; 9 | public class P06b 10 | { 11 | public static void main(String[] args) 12 | { 13 | int i,j=0,max_qty,m,n; 14 | float sum=0,max; 15 | Scanner sc = new Scanner(System.in); 16 | int array[][]=new int[2][20]; 17 | System.out.println("Enter no of items"); 18 | n=sc.nextInt(); 19 | System.out.println("Enter the weights of each items"); 20 | for(i=0;i=0) 29 | { 30 | max=0; 31 | for(i=0;imax) 34 | { 35 | max=((float)array[1][i])/((float)array[0][i]); 36 | j=i; 37 | } 38 | } 39 | if(array[0][j]>m) 40 | { 41 | System.out.println("Quantity of item number: "+ (j+1) + " added is " +m); 42 | sum+=m*max; 43 | m=-1; 44 | } 45 | else 46 | { 47 | System.out.println("Quantity of item number: " + (j+1) + " added is " + array[0][j]); 48 | m-=array[0][j]; 49 | sum+=(float)array[1][j]; 50 | array[1][j]=0; 51 | } 52 | System.out.println("The total profit is " + sum); 53 | sc.close(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P07.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 7. From a given vertex in a weighted connected graph, find shortest paths to other vertices using Dijkstra's algorithm. 4 | Write the program in Java. 5 | 6 | */ 7 | 8 | import java.util.*; 9 | class Dijkstra 10 | { 11 | int d[]=new int[10]; 12 | int p[]=new int[10]; 13 | int visited[]=new int[10]; 14 | public void dijk(int[][]a, int s, int n) 15 | { 16 | int u=-1,v,i,j,min; 17 | for(v=1;v<=n;v++) 18 | { 19 | d[v]=99; 20 | p[v]=-1; 21 | } 22 | d[s]=0; 23 | for(i=1;i<=n;i++) 24 | { 25 | min=99; 26 | for(j=1;j<=n;j++) 27 | { 28 | if(d[j]"+v+" "); 51 | } 52 | void display(int s,int n) 53 | { 54 | int i; 55 | for(i=1;i<=n;i++) 56 | { 57 | if(i!=s) 58 | { 59 | System.out.print(s+" "); 60 | path(i,s); 61 | } 62 | if(i!=s) 63 | System.out.print("="+d[i]+" "); 64 | System.out.println(); 65 | } 66 | } 67 | } 68 | public class P07 69 | { 70 | public static void main(String[] args) 71 | { 72 | int a[][]=new int[10][10]; 73 | int i,j,n,s; 74 | System.out.println("enter the number of vertices"); 75 | Scanner sc = new Scanner(System.in); 76 | n=sc.nextInt(); 77 | System.out.println("enter the weighted matrix"); 78 | for(i=1;i<=n;i++) 79 | for(j=1;j<=n;j++) 80 | a[i][j]=sc.nextInt(); 81 | System.out.println("enter the source vertex"); 82 | s=sc.nextInt(); 83 | Dijkstra tr=new Dijkstra(); 84 | tr.dijk(a,s,n); 85 | System.out.println("the shortest path between source "+s+" to remaining vertices are"); 86 | tr.display(s,n); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P08.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 8. Find Minimum Cost Spanning Tree of a given connected undirected graph using Kruskal's algorithm. 4 | Use Union-Find algorithms in your program. 5 | 6 | */ 7 | 8 | import java.util.Scanner; 9 | class Krushkal 10 | { 11 | int kruskals(int n, int cost[][]) 12 | { 13 | int k = 1, a = 0, u = 0, b = 0, v = 0, min, mincost = 0; 14 | int parent[] = new int[10]; 15 | while (k < n) 16 | { 17 | min = 999; 18 | for (int i = 1; i <= n; i++) 19 | { 20 | for (int j = 1; j <= n; j++) 21 | { 22 | if (cost[i][j] < min) 23 | { 24 | min = cost[i][j]; 25 | a = u = i; 26 | b = v = j; 27 | } 28 | } 29 | } 30 | while (parent[u] > 0) 31 | u = parent[u]; 32 | while (parent[v] > 0) 33 | v = parent[v]; 34 | if (u != v) 35 | { 36 | System.out.println((k++) + ">minimum edge is :"); 37 | System.out.println("(" + a + "," + b + 38 | ") and its cost is:" + min); 39 | mincost += min; 40 | parent[v] = u; 41 | } 42 | cost[a][b] = cost[b][a] = 999; 43 | } 44 | return mincost; 45 | } 46 | } 47 | 48 | 49 | 50 | public class P08 51 | { 52 | public static void main(String[] args) 53 | { 54 | int cost[][] = new int[10][10]; 55 | int i, j, mincost = 0; 56 | Scanner in = new Scanner(System.in); 57 | 58 | System.out.println("Enter the number of nodes: "); 59 | int n = in.nextInt(); 60 | System.out.println("Enter the cost matrix"); 61 | for (i = 1; i <= n; i++) 62 | { 63 | for (j = 1; j <= n; j++) 64 | { 65 | cost[i][j] = in.nextInt(); 66 | } 67 | } 68 | System.out.println("The entered cost matrix is"); 69 | for (i = 1; i <= n; i++) 70 | { 71 | for (j = 1; j <= n; j++) 72 | { 73 | System.out.print(cost[i][j] + "\t"); 74 | } 75 | System.out.println(); 76 | } 77 | Krushkal k=new Krushkal(); 78 | mincost = k.kruskals(n, cost); 79 | System.out.println("The minimum spanning tree cost is:"); 80 | System.out.println(mincost); 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P09.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 9. Find Minimum Cost Spanning Tree of a given connected undirected graph using Prim's algorithm. 4 | 5 | */ 6 | 7 | import java.util.Scanner; 8 | public class P09 9 | { 10 | public static void main(String[] args) 11 | { 12 | int w[][]=new int[10][10]; 13 | int n,i,j,s,k=0; 14 | int min; 15 | int sum=0; 16 | int u=0,v=0; 17 | int flag=0; 18 | int sol[]=new int[10]; 19 | Scanner sc=new Scanner(System.in); 20 | System.out.println("Enter the number of vertices"); 21 | n=sc.nextInt(); 22 | for(i=1;i<=n;i++) 23 | sol[i]=0; 24 | System.out.println("Enter the weighted graph"); 25 | for(i=1;i<=n;i++) 26 | for(j=1;j<=n;j++) 27 | w[i][j]=sc.nextInt(); 28 | System.out.println("Enter the source vertex"); 29 | s=sc.nextInt(); 30 | sol[s]=1; 31 | k=1; 32 | while (k<=n-1) 33 | { 34 | min=99; 35 | for(i=1;i<=n;i++) 36 | for(j=1;j<=n;j++) 37 | if(sol[i]==1&&sol[j]==0) 38 | if(i!=j&&min>w[i][j]) 39 | { 40 | min=w[i][j]; 41 | u=i; 42 | v=j; 43 | } 44 | sol[v]=1; 45 | sum=sum+min; 46 | k++; 47 | System.out.println(u+"->"+v+"="+min); 48 | } 49 | 50 | for(i=1;i<=n;i++) 51 | if(sol[i]==0) 52 | flag=1; 53 | if(flag==1) 54 | System.out.println("No spanning tree"); 55 | else 56 | System.out.println("The cost of minimum spanning tree is "+sum); 57 | sc.close(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P10a.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 10. Write Java programs to 4 | a. Implement All-Pairs Shortest Paths problem using Floyd's algorithm. 5 | 6 | */ 7 | 8 | import java.util.Scanner; 9 | class Floyd 10 | { 11 | void flyd(int[][]w,int n) 12 | { 13 | int i,j,k; 14 | for(k=1;k<=n;k++) 15 | for(i=1;i<=n;i++) 16 | for(j=1;j<=n;j++) 17 | w[i][j]=Math.min(w[i][j],w[i][k]+w[k][j]); 18 | } 19 | } 20 | public class P10a 21 | { 22 | public static void main(String[] args) 23 | { 24 | int a[][]=new int[10][10]; 25 | int n,i,j; 26 | System.out.println("enter the number of vertices"); 27 | Scanner sc=new Scanner(System.in); 28 | n=sc.nextInt(); 29 | System.out.println("Enterthe weighted matrix"); 30 | for(i=1;i<=n;i++) 31 | for(j=1;j<=n;j++) 32 | a[i][j]=sc.nextInt(); 33 | Floyd f=new Floyd(); 34 | f.flyd(a,n); 35 | System.out.println("The shortest path matrix is"); 36 | for(i=1;i<=n;i++) 37 | { 38 | for(j=1;j<=n;j++) 39 | { 40 | System.out.print(a[i][j]+" "); 41 | } 42 | System.out.println(); 43 | } 44 | sc.close(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P10b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 10 b. Implement Travelling Sales Person problem using Dynamic programming. 3 | */ 4 | 5 | import java.util.*; 6 | class Sales 7 | { 8 | int cost_opt; 9 | int a[][]=new int[100][100]; 10 | int visit[]=new int[100]; 11 | void mincost_opt(int city,int n) 12 | { 13 | int i,ncity; 14 | visit[city]=1; 15 | System.out.print(city+"-->"); 16 | ncity=least_opt(city,n); 17 | if(ncity==999) 18 | { 19 | ncity=1; 20 | System.out.println(ncity); 21 | cost_opt+=a[city][ncity]; 22 | return; 23 | } 24 | mincost_opt(ncity,n); 25 | } 26 | int least_opt(int c,int n) 27 | { 28 | int i,nc=999; 29 | int min=999,kmin=999; 30 | for(i=1;i<=n;i++) 31 | { 32 | if((a[c][i]!=0)&&visit[i]==0) 33 | if(a[c][i]0) 37 | { 38 | for(int i=1;i<=Math.pow(2,n)-1;i++) 39 | { 40 | s.subset(i,n,x); 41 | sum=0; 42 | for(j=1;j<=n;j++) 43 | if(x[j]==1) 44 | sum=sum+a[j]; 45 | if(d==sum) 46 | { 47 | System.out.print("Subset={ "); 48 | present=1; 49 | for(j=1;j<=n;j++) 50 | if(x[j]==1) 51 | System.out.print(a[j]+" " 52 | + ""); 53 | System.out.print("}="+d); 54 | System.out.println(); 55 | } 56 | } 57 | } 58 | if(present==0) 59 | System.out.println("Solution does not exists"); 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /sem-4/computer_science/ADA/P12.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 12. Design and implement in Java to find all Hamiltonian Cycles in a connected undirected Graph G of n vertices 4 | using backtracking principle. 5 | 6 | */ 7 | 8 | import java.util.*; 9 | class Hamiltoniancycle 10 | { 11 | private int adj[][],x[],n; 12 | public Hamiltoniancycle() 13 | { 14 | Scanner src = new Scanner(System.in); 15 | System.out.println("Enter the number of nodes"); 16 | n=src.nextInt(); 17 | x=new int[n]; 18 | x[0]=0; 19 | for(int i=1;i 2 | void main (void) 3 | { 4 | int a,b,c,d,e,f; 5 | a=4; 6 | b=5; 7 | d=3; 8 | e=6; 9 | c=a+b; 10 | f=e-d; 11 | a=5; 12 | b=4; 13 | d=3; 14 | e=2; 15 | } -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/08A-BCD-Updown.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | CR EQU 0E883H 5 | 6 | .CODE 7 | 8 | START: 9 | MOV AX,DATA 10 | MOV DS,AX 11 | MOV AL,82H 12 | MOV DX,CR 13 | OUT DX,AL 14 | MOV AL,00H 15 | MOV DX,PORTA 16 | UP: 17 | OUT DX,AL 18 | CALL DELAY 19 | INC AL 20 | CMP AL,99H 21 | JNE UP 22 | MOV AL,99H 23 | MOV DX,PORTA 24 | DOWN: 25 | OUT DX,AL 26 | CALL DELAY 27 | DEC AL 28 | CMP AL,0FFH 29 | JNE DOWN 30 | MOV AH,4CH 31 | INT 21H 32 | 33 | DELAY PROC 34 | MOV BX 0F000H 35 | L1: 36 | MOV CX,0FFFFH 37 | L2: 38 | LOOP L2 39 | DEC BX 40 | JNZ L1 41 | RET 42 | DELAY ENDP 43 | END 44 | -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/08B-MutiplyARM.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | PORTB EQU 0E881H 5 | CR EQU 0E883H 6 | .CODE 7 | MOV AX,@DATA 8 | MOV DS,AX 9 | MOV AL,82H 10 | MOV DX,CR 11 | OUT DX,AL 12 | 13 | MOV DX,PORTB 14 | IN AL,DX 15 | MOV BL,AL 16 | MOV AH,01H 17 | INT 21H 18 | MOV DX,PORTB 19 | IN AL,DX 20 | MUL BL 21 | MOV DX,PORTA 22 | OUT DX,AL 23 | PUSH AX 24 | MOV AH,01H 25 | INT 21H 26 | POP AX 27 | MOV AL,AH 28 | MOV DX,PORTA 29 | OUT DX,AL 30 | MOV AH,4CH 31 | INT 21H 32 | END 33 | -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/09-FIRE&HELP.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | PORTC EQU 0E882H 5 | CR EQU 0E883H 6 | FIRE DB 79H,50H,06H,71H,0,0 7 | HELP DB 73H,38H,79H,76H,0,0 8 | 9 | .CODE 10 | MOV AX,@DATA 11 | MOV DS,AX 12 | MOV AL,80H 13 | MOV DX,CR 14 | OUT DX,AL 15 | MOV CX,2 16 | AGAIN: 17 | MOV DI,20 18 | DISP1: 19 | LEA SI,FIRE 20 | CALL DISPLAY 21 | DEC DI 22 | JNZ DISP1 23 | MOV DI,20 24 | DISP2: 25 | LEA SI,HELP 26 | CALL DISPLAY 27 | DEC DI 28 | JNZ DISP2 29 | LOOP AGAIN 30 | MOV AH,4CH 31 | INT 21H 32 | 33 | DISPLAY PROC 34 | MOV AH,0 35 | BACK: 36 | MOV AL,AH 37 | MOV DX,PORTC 38 | OUT DX,AL 39 | LODSB 40 | MOV DX,PORTA 41 | OUT DX,AL 42 | CALL DELAY 43 | INC AH 44 | CMP AH,4 45 | JNZ BACK 46 | RET 47 | DISPLAY ENDP 48 | 49 | DELAY PROC 50 | PUSH BX 51 | PUSH CX 52 | MOV BX,0FFFH 53 | L1: MOV CX,0FFFH 54 | L2: LOOP L2 55 | DEC BX 56 | JNZ L1 57 | POP CX 58 | POP BX 59 | RET 60 | DELAY ENDP 61 | END -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/10-StepperMotor.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTC EQU 0E882H 4 | CR EQU 0E883H 5 | N EQU 05 6 | 7 | .CODE 8 | MOV AX,@DATA 9 | MOV DS,AX 10 | MOV AL,80H 11 | MOV DX,CR 12 | OUT DX,AL 13 | MOV CX,N 14 | MOV AL,33H 15 | MOV DX,PORTC 16 | BACKR: 17 | OUT DX,AL 18 | ROR AL,01H 19 | PUSH CX 20 | CALL DELAY 21 | POP CX 22 | LOOP BACKR 23 | MOV AH.4CH 24 | INT 21H 25 | 26 | DELAY PROC 27 | MOV BX,0F000H 28 | L1: 29 | MOV CX,00FFFH 30 | L2: 31 | LOOP L2 32 | DEC BX 33 | JNZ LI 34 | RET 35 | DELAY ENDP 36 | END 37 | -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/11a-FullSinWave.asm: -------------------------------------------------------------------------------- 1 | PROGRAM 2 | .MODEL SMALL 3 | .DATA 4 | PORTA EQU 0E880H 5 | CR EQU 0E883H 6 | ARR DB 7FH,8CH,99H,0A6H,0B2H,0BFH,0CAH,0D4H,0DDH,0E6H,0EDH,0F3H,0F8H,0FDH,0FCH, 7 | DB 0FBH,0F8H,0F3H,0EDH,0E6H,0DDH,0D4H,0CAH,0BFH,0B2H,0A6H,99H,08CH,7FH,72H, 8 | DB 65H,58H,4CH,3FH,34H,2AH,21H,18H,11H,0BH,06H,03H,01H,00H,01H, 9 | DB 03H, 06H,0BH,11H,18H,21H,2AH,34H,3FH,4CH,58H,65H,72H,7FH 10 | .CODE 11 | MOV AX,@DATA 12 | MOV DS,AX 13 | MOV AL,80H ; only port A of 8255 is used as output 14 | MOV DX,CR 15 | OUT DX,AL 16 | 17 | AGAIN: 18 | LEA SI,ARR ; use SI as pointer to array 19 | MOV DX,PORTA 20 | MOV CX,37 21 | BACK: 22 | LODSB 23 | OUT DX,AL ;send it to port (CRO) 24 | CALL DELAY 25 | LOOP BACK 26 | MOV AH,1 27 | INT 16H 28 | JZ AGAIN 29 | MOV AH,4CH 30 | INT 21H 31 | 32 | DELAY PROC 33 | MOV BX,0FFFH 34 | L1: DEC BX 35 | JNZ L1 36 | RET 37 | DELAY ENDP 38 | END -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/11b-HalfSinWave.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | CR EQU 0E883H 5 | ARR DB 7FH,8CH,99H,0A6H,0B2H,0BFH,0CAH,0D4H,0DDH,0E6H,0EDH,0F3H,0F8H,0FDH,0FCH, 6 | DB 0FBH,0F8H,0F3H,0EDH,0E6H,0DDH,0D4H,0CAH,0BFH,0B2H,0A6H,99H,08CH,7FH,7FH, 7 | DB 7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH, 8 | DB 7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH 9 | .CODE 10 | MOV AX,@DATA 11 | MOV DS,AX 12 | MOV AL,80H ; only port A of 8255 is used as output 13 | MOV DX,CR 14 | OUT DX,AL 15 | 16 | AGAIN: 17 | LEA SI,ARR ; use SI as pointer to array 18 | MOV DX,PORTA 19 | MOV CX,37 20 | BACK: 21 | LODSB 22 | OUT DX,AL ;send it to port (CRO) 23 | CALL DELAY 24 | LOOP BACK 25 | MOV AH,1 26 | INT 16H 27 | JZ AGAIN 28 | MOV AH,4CH 29 | INT 21H 30 | 31 | DELAY PROC 32 | MOV BX,0FFFH 33 | L1: DEC BX 34 | JNZ L1 35 | RET 36 | DELAY ENDP 37 | END -------------------------------------------------------------------------------- /sem-4/computer_science/MP Lab/13-ARM-StepperMotor.c: -------------------------------------------------------------------------------- 1 | #include 2 | void delay(unsigned int value); 3 | void gpio_init(); 4 | unsigned char cmd1[4]= {0x11,0x22,0x44,0x88}; 5 | //unsigned int j; 6 | int main() 7 | { unsigned int i; 8 | gpio_init(); 9 | while(1) //* // Loop forever 10 | { 11 | for (i=0;i<4;i++) 12 | { 13 | IO0PIN =cmd1[i]<<15; 14 | delay(0X5000); 15 | } 16 | } 17 | } 18 | void gpio_init() 19 | { 20 | PINSEL0 = 0x00000000; // P1.15 - P1.18 as GPIO 21 | IODIR0 |= 0x00078000; // Set Port0 as Output 22 | IOCLR0 = 0x00078000; 23 | } 24 | void delay(unsigned int value) 25 | { 26 | unsigned int k; 27 | for(k=0;k=max-1) System.out.println("Stack overflow"); 18 | else 19 | { 20 | System.out.println("Enter the element"); 21 | int elem = sc.nextInt(); 22 | s[++top]=elem; 23 | } 24 | } 25 | void pop() 26 | { 27 | if(top==-1) System.out.println("Stack Underflow"); 28 | else System.out.println("Popped element : "+s[top--]); 29 | 30 | } 31 | void display() 32 | { 33 | if(top==-1) System.out.println("Stack is empty"); 34 | else 35 | { 36 | System.out.println("Stack elements are:"); 37 | for(int i=top; i>=0; i--) 38 | System.out.println(s[i]); 39 | } 40 | } 41 | public static void main(String[] args) 42 | { 43 | Scanner in = new Scanner(System.in); 44 | Stack obj=new Stack(); 45 | while(true) 46 | { 47 | System.out.println("\n-----------Menu------------"); 48 | System.out.println("1.Push\t2.Pop\t3.Display"); 49 | System.out.println("---------------------------"); 50 | System.out.println("Enter your choice"); 51 | int ch = in.nextInt(); 52 | switch(ch) 53 | { 54 | case 1:obj.push(); break; 55 | case 2:obj.pop(); break; 56 | case 3:obj.display(); break; 57 | default:System.out.println("Invalid choice"); 58 | return; 59 | 60 | } 61 | } 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P02b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 2b. Write a Java class called Customer to store their name and date_of_birth. The date_of_birth format should be dd/mm/yyyy. Write methods to read customer data as and display as using StringTokenizer class considering the delimiter character as “/”. 4 | 5 | */ 6 | import java.util.Scanner; 7 | import java.util.StringTokenizer; 8 | class Customer 9 | { 10 | String cname; 11 | String DOB; 12 | void readData() 13 | { 14 | Scanner in=new Scanner(System.in); 15 | System.out.println("Enter the customer name"); 16 | cname=in.nextLine(); 17 | System.out.println("Enter the Date of Birth"); 18 | DOB=in.next(); 19 | } 20 | void display() 21 | { 22 | StringTokenizer st=new StringTokenizer(DOB,"/"); 23 | System.out.print(cname); 24 | while(st.hasMoreTokens()) 25 | { 26 | System.out.print(", "+st.nextToken()); 27 | } 28 | } 29 | } 30 | public class P02b 31 | { 32 | public static void main(String[] args) 33 | { 34 | Customer c=new Customer(); 35 | c.readData(); 36 | c.display(); 37 | 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P03a.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3. a. Write a Java program to read two integers a and b. Compute a/b and print, when b is not zero. 3 | Raise an exception when b is equal to zero. 4 | */import java.util.Scanner; 5 | public class p03a 6 | { 7 | public static void main(String[] args) 8 | { 9 | Scanner in=new Scanner(System.in); 10 | System.out.println("Enter two numbers"); 11 | int a=in.nextInt(); 12 | int b=in.nextInt(); 13 | try 14 | { 15 | if(b==0) 16 | throw new ArithmeticException("Devide by 0 error"); 17 | int result=a/b; 18 | System.out.println(a + "/" + b + "=" + result); 19 | } 20 | catch(ArithmeticException e) 21 | { 22 | System.out.println("Raised exception is " + e); 23 | } 24 | finally 25 | { 26 | System.out.println("Execution Finished"); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P03b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | b. Write a Java program that implements a multi-thread application that has three threads. 4 | First thread generates a random integer for every 1 second; 5 | second thread computes the square of the number and prints; 6 | third thread will print the value of cube of the number. 7 | 8 | */ 9 | import java.util.Random; 10 | class RandomNumThread extends Thread 11 | { 12 | Random rand = new Random(); 13 | public void run() 14 | { 15 | try 16 | { 17 | for(int i=0;i<10;i++) 18 | { 19 | System.out.println("Number generated is " + rand.nextInt(100)+" "); 20 | Thread.sleep(1000); 21 | } 22 | } 23 | catch (InterruptedException e) 24 | { 25 | e.printStackTrace(); 26 | } 27 | } 28 | } 29 | class SquareNum extends Thread 30 | { 31 | int num; 32 | 33 | SquareNum(int a) 34 | { 35 | num = a; 36 | } 37 | public void run() 38 | { 39 | for(int i=1;ij) 22 | sol[i][j]=sol[i-1][j]; 23 | else 24 | sol[i][j]=Math.max((sol[i-1][j]), (sol[i - 1][j - wt[i]] + val[i])); 25 | } 26 | } 27 | System.out.println("The optimal solution is "+sol[N][W]); 28 | int[] selected = new int[N + 1]; 29 | for(i=0;i0&&j>0) 34 | { 35 | if (sol[i][j] !=sol[i-1][j]) 36 | { 37 | selected[i] = 1; 38 | j = j - wt[i]; 39 | } 40 | i--; 41 | } 42 | System.out.println("\nItems selected : "); 43 | for ( i = 1; i < N + 1; i++) 44 | if (selected[i] == 1) 45 | System.out.print(i +" "); 46 | System.out.println(); 47 | } 48 | } 49 | public class P06a 50 | { 51 | public static void main(String[] args) 52 | { 53 | Scanner scan = new Scanner(System.in); 54 | knapsackDP ks = new knapsackDP(); 55 | System.out.println("Enter number of elements "); 56 | int n = scan.nextInt(); 57 | int[] wt = new int[n + 1]; 58 | int[] val = new int[n + 1]; 59 | System.out.println("\nEnter weight of "+ n +" elements"); 60 | for (int i = 1; i <= n; i++) 61 | wt[i] = scan.nextInt(); 62 | System.out.println("\nEnter values of "+ n +" elements"); 63 | for (int i = 1; i <= n; i++) 64 | val[i] = scan.nextInt(); 65 | System.out.println("\nEnter knapsack capacity "); 66 | int W = scan.nextInt(); 67 | ks.solve(wt, val, W, n); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P06b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Knapsack using 4 | (b) Greedy method. 5 | 6 | */ 7 | 8 | import java.util.Scanner; 9 | public class P06b 10 | { 11 | public static void main(String[] args) 12 | { 13 | int i,j=0,max_qty,m,n; 14 | float sum=0,max; 15 | Scanner sc = new Scanner(System.in); 16 | int array[][]=new int[2][20]; 17 | System.out.println("Enter no of items"); 18 | n=sc.nextInt(); 19 | System.out.println("Enter the weights of each items"); 20 | for(i=0;i=0) 29 | { 30 | max=0; 31 | for(i=0;imax) 34 | { 35 | max=((float)array[1][i])/((float)array[0][i]); 36 | j=i; 37 | } 38 | } 39 | if(array[0][j]>m) 40 | { 41 | System.out.println("Quantity of item number: "+ (j+1) + " added is " +m); 42 | sum+=m*max; 43 | m=-1; 44 | } 45 | else 46 | { 47 | System.out.println("Quantity of item number: " + (j+1) + " added is " + array[0][j]); 48 | m-=array[0][j]; 49 | sum+=(float)array[1][j]; 50 | array[1][j]=0; 51 | } 52 | System.out.println("The total profit is " + sum); 53 | sc.close(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P07.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 7. From a given vertex in a weighted connected graph, find shortest paths to other vertices using Dijkstra's algorithm. 4 | Write the program in Java. 5 | 6 | */ 7 | 8 | import java.util.*; 9 | class Dijkstra 10 | { 11 | int d[]=new int[10]; 12 | int p[]=new int[10]; 13 | int visited[]=new int[10]; 14 | public void dijk(int[][]a, int s, int n) 15 | { 16 | int u=-1,v,i,j,min; 17 | for(v=1;v<=n;v++) 18 | { 19 | d[v]=99; 20 | p[v]=-1; 21 | } 22 | d[s]=0; 23 | for(i=1;i<=n;i++) 24 | { 25 | min=99; 26 | for(j=1;j<=n;j++) 27 | { 28 | if(d[j]"+v+" "); 51 | } 52 | void display(int s,int n) 53 | { 54 | int i; 55 | for(i=1;i<=n;i++) 56 | { 57 | if(i!=s) 58 | { 59 | System.out.print(s+" "); 60 | path(i,s); 61 | } 62 | if(i!=s) 63 | System.out.print("="+d[i]+" "); 64 | System.out.println(); 65 | } 66 | } 67 | } 68 | public class P07 69 | { 70 | public static void main(String[] args) 71 | { 72 | int a[][]=new int[10][10]; 73 | int i,j,n,s; 74 | System.out.println("enter the number of vertices"); 75 | Scanner sc = new Scanner(System.in); 76 | n=sc.nextInt(); 77 | System.out.println("enter the weighted matrix"); 78 | for(i=1;i<=n;i++) 79 | for(j=1;j<=n;j++) 80 | a[i][j]=sc.nextInt(); 81 | System.out.println("enter the source vertex"); 82 | s=sc.nextInt(); 83 | Dijkstra tr=new Dijkstra(); 84 | tr.dijk(a,s,n); 85 | System.out.println("the shortest path between source "+s+" to remaining vertices are"); 86 | tr.display(s,n); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P08.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 8. Find Minimum Cost Spanning Tree of a given connected undirected graph using Kruskal's algorithm. 4 | Use Union-Find algorithms in your program. 5 | 6 | */ 7 | 8 | import java.util.Scanner; 9 | class Krushkal 10 | { 11 | int kruskals(int n, int cost[][]) 12 | { 13 | int k = 1, a = 0, u = 0, b = 0, v = 0, min, mincost = 0; 14 | int parent[] = new int[10]; 15 | while (k < n) 16 | { 17 | min = 999; 18 | for (int i = 1; i <= n; i++) 19 | { 20 | for (int j = 1; j <= n; j++) 21 | { 22 | if (cost[i][j] < min) 23 | { 24 | min = cost[i][j]; 25 | a = u = i; 26 | b = v = j; 27 | } 28 | } 29 | } 30 | while (parent[u] > 0) 31 | u = parent[u]; 32 | while (parent[v] > 0) 33 | v = parent[v]; 34 | if (u != v) 35 | { 36 | System.out.println((k++) + ">minimum edge is :"); 37 | System.out.println("(" + a + "," + b + 38 | ") and its cost is:" + min); 39 | mincost += min; 40 | parent[v] = u; 41 | } 42 | cost[a][b] = cost[b][a] = 999; 43 | } 44 | return mincost; 45 | } 46 | } 47 | 48 | 49 | 50 | public class P08 51 | { 52 | public static void main(String[] args) 53 | { 54 | int cost[][] = new int[10][10]; 55 | int i, j, mincost = 0; 56 | Scanner in = new Scanner(System.in); 57 | 58 | System.out.println("Enter the number of nodes: "); 59 | int n = in.nextInt(); 60 | System.out.println("Enter the cost matrix"); 61 | for (i = 1; i <= n; i++) 62 | { 63 | for (j = 1; j <= n; j++) 64 | { 65 | cost[i][j] = in.nextInt(); 66 | } 67 | } 68 | System.out.println("The entered cost matrix is"); 69 | for (i = 1; i <= n; i++) 70 | { 71 | for (j = 1; j <= n; j++) 72 | { 73 | System.out.print(cost[i][j] + "\t"); 74 | } 75 | System.out.println(); 76 | } 77 | Krushkal k=new Krushkal(); 78 | mincost = k.kruskals(n, cost); 79 | System.out.println("The minimum spanning tree cost is:"); 80 | System.out.println(mincost); 81 | } 82 | } 83 | 84 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P09.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 9. Find Minimum Cost Spanning Tree of a given connected undirected graph using Prim's algorithm. 4 | 5 | */ 6 | 7 | import java.util.Scanner; 8 | public class P09 9 | { 10 | public static void main(String[] args) 11 | { 12 | int w[][]=new int[10][10]; 13 | int n,i,j,s,k=0; 14 | int min; 15 | int sum=0; 16 | int u=0,v=0; 17 | int flag=0; 18 | int sol[]=new int[10]; 19 | Scanner sc=new Scanner(System.in); 20 | System.out.println("Enter the number of vertices"); 21 | n=sc.nextInt(); 22 | for(i=1;i<=n;i++) 23 | sol[i]=0; 24 | System.out.println("Enter the weighted graph"); 25 | for(i=1;i<=n;i++) 26 | for(j=1;j<=n;j++) 27 | w[i][j]=sc.nextInt(); 28 | System.out.println("Enter the source vertex"); 29 | s=sc.nextInt(); 30 | sol[s]=1; 31 | k=1; 32 | while (k<=n-1) 33 | { 34 | min=99; 35 | for(i=1;i<=n;i++) 36 | for(j=1;j<=n;j++) 37 | if(sol[i]==1&&sol[j]==0) 38 | if(i!=j&&min>w[i][j]) 39 | { 40 | min=w[i][j]; 41 | u=i; 42 | v=j; 43 | } 44 | sol[v]=1; 45 | sum=sum+min; 46 | k++; 47 | System.out.println(u+"->"+v+"="+min); 48 | } 49 | 50 | for(i=1;i<=n;i++) 51 | if(sol[i]==0) 52 | flag=1; 53 | if(flag==1) 54 | System.out.println("No spanning tree"); 55 | else 56 | System.out.println("The cost of minimum spanning tree is "+sum); 57 | sc.close(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P10a.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 10. Write Java programs to 4 | a. Implement All-Pairs Shortest Paths problem using Floyd's algorithm. 5 | 6 | */ 7 | 8 | import java.util.Scanner; 9 | class Floyd 10 | { 11 | void flyd(int[][]w,int n) 12 | { 13 | int i,j,k; 14 | for(k=1;k<=n;k++) 15 | for(i=1;i<=n;i++) 16 | for(j=1;j<=n;j++) 17 | w[i][j]=Math.min(w[i][j],w[i][k]+w[k][j]); 18 | } 19 | } 20 | public class P10a 21 | { 22 | public static void main(String[] args) 23 | { 24 | int a[][]=new int[10][10]; 25 | int n,i,j; 26 | System.out.println("enter the number of vertices"); 27 | Scanner sc=new Scanner(System.in); 28 | n=sc.nextInt(); 29 | System.out.println("Enterthe weighted matrix"); 30 | for(i=1;i<=n;i++) 31 | for(j=1;j<=n;j++) 32 | a[i][j]=sc.nextInt(); 33 | Floyd f=new Floyd(); 34 | f.flyd(a,n); 35 | System.out.println("The shortest path matrix is"); 36 | for(i=1;i<=n;i++) 37 | { 38 | for(j=1;j<=n;j++) 39 | { 40 | System.out.print(a[i][j]+" "); 41 | } 42 | System.out.println(); 43 | } 44 | sc.close(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P10b.java: -------------------------------------------------------------------------------- 1 | /* 2 | 10 b. Implement Travelling Sales Person problem using Dynamic programming. 3 | */ 4 | 5 | import java.util.*; 6 | class Sales 7 | { 8 | int cost_opt; 9 | int a[][]=new int[100][100]; 10 | int visit[]=new int[100]; 11 | void mincost_opt(int city,int n) 12 | { 13 | int i,ncity; 14 | visit[city]=1; 15 | System.out.print(city+"-->"); 16 | ncity=least_opt(city,n); 17 | if(ncity==999) 18 | { 19 | ncity=1; 20 | System.out.println(ncity); 21 | cost_opt+=a[city][ncity]; 22 | return; 23 | } 24 | mincost_opt(ncity,n); 25 | } 26 | int least_opt(int c,int n) 27 | { 28 | int i,nc=999; 29 | int min=999,kmin=999; 30 | for(i=1;i<=n;i++) 31 | { 32 | if((a[c][i]!=0)&&visit[i]==0) 33 | if(a[c][i]0) 37 | { 38 | for(int i=1;i<=Math.pow(2,n)-1;i++) 39 | { 40 | s.subset(i,n,x); 41 | sum=0; 42 | for(j=1;j<=n;j++) 43 | if(x[j]==1) 44 | sum=sum+a[j]; 45 | if(d==sum) 46 | { 47 | System.out.print("Subset={ "); 48 | present=1; 49 | for(j=1;j<=n;j++) 50 | if(x[j]==1) 51 | System.out.print(a[j]+" " 52 | + ""); 53 | System.out.print("}="+d); 54 | System.out.println(); 55 | } 56 | } 57 | } 58 | if(present==0) 59 | System.out.println("Solution does not exists"); 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /sem-4/information_science/ADA/P12.java: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | 12. Design and implement in Java to find all Hamiltonian Cycles in a connected undirected Graph G of n vertices 4 | using backtracking principle. 5 | 6 | */ 7 | 8 | import java.util.*; 9 | class Hamiltoniancycle 10 | { 11 | private int adj[][],x[],n; 12 | public Hamiltoniancycle() 13 | { 14 | Scanner src = new Scanner(System.in); 15 | System.out.println("Enter the number of nodes"); 16 | n=src.nextInt(); 17 | x=new int[n]; 18 | x[0]=0; 19 | for(int i=1;i 2 | void main (void) 3 | { 4 | int a,b,c,d,e,f; 5 | a=4; 6 | b=5; 7 | d=3; 8 | e=6; 9 | c=a+b; 10 | f=e-d; 11 | a=5; 12 | b=4; 13 | d=3; 14 | e=2; 15 | } -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/08A-BCD-Updown.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | CR EQU 0E883H 5 | 6 | .CODE 7 | 8 | START: 9 | MOV AX,DATA 10 | MOV DS,AX 11 | MOV AL,82H 12 | MOV DX,CR 13 | OUT DX,AL 14 | MOV AL,00H 15 | MOV DX,PORTA 16 | UP: 17 | OUT DX,AL 18 | CALL DELAY 19 | INC AL 20 | CMP AL,99H 21 | JNE UP 22 | MOV AL,99H 23 | MOV DX,PORTA 24 | DOWN: 25 | OUT DX,AL 26 | CALL DELAY 27 | DEC AL 28 | CMP AL,0FFH 29 | JNE DOWN 30 | MOV AH,4CH 31 | INT 21H 32 | 33 | DELAY PROC 34 | MOV BX 0F000H 35 | L1: 36 | MOV CX,0FFFFH 37 | L2: 38 | LOOP L2 39 | DEC BX 40 | JNZ L1 41 | RET 42 | DELAY ENDP 43 | END 44 | -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/08B-MutiplyARM.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | PORTB EQU 0E881H 5 | CR EQU 0E883H 6 | .CODE 7 | MOV AX,@DATA 8 | MOV DS,AX 9 | MOV AL,82H 10 | MOV DX,CR 11 | OUT DX,AL 12 | 13 | MOV DX,PORTB 14 | IN AL,DX 15 | MOV BL,AL 16 | MOV AH,01H 17 | INT 21H 18 | MOV DX,PORTB 19 | IN AL,DX 20 | MUL BL 21 | MOV DX,PORTA 22 | OUT DX,AL 23 | PUSH AX 24 | MOV AH,01H 25 | INT 21H 26 | POP AX 27 | MOV AL,AH 28 | MOV DX,PORTA 29 | OUT DX,AL 30 | MOV AH,4CH 31 | INT 21H 32 | END 33 | -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/09-FIRE&HELP.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | PORTC EQU 0E882H 5 | CR EQU 0E883H 6 | FIRE DB 79H,50H,06H,71H,0,0 7 | HELP DB 73H,38H,79H,76H,0,0 8 | 9 | .CODE 10 | MOV AX,@DATA 11 | MOV DS,AX 12 | MOV AL,80H 13 | MOV DX,CR 14 | OUT DX,AL 15 | MOV CX,2 16 | AGAIN: 17 | MOV DI,20 18 | DISP1: 19 | LEA SI,FIRE 20 | CALL DISPLAY 21 | DEC DI 22 | JNZ DISP1 23 | MOV DI,20 24 | DISP2: 25 | LEA SI,HELP 26 | CALL DISPLAY 27 | DEC DI 28 | JNZ DISP2 29 | LOOP AGAIN 30 | MOV AH,4CH 31 | INT 21H 32 | 33 | DISPLAY PROC 34 | MOV AH,0 35 | BACK: 36 | MOV AL,AH 37 | MOV DX,PORTC 38 | OUT DX,AL 39 | LODSB 40 | MOV DX,PORTA 41 | OUT DX,AL 42 | CALL DELAY 43 | INC AH 44 | CMP AH,4 45 | JNZ BACK 46 | RET 47 | DISPLAY ENDP 48 | 49 | DELAY PROC 50 | PUSH BX 51 | PUSH CX 52 | MOV BX,0FFFH 53 | L1: MOV CX,0FFFH 54 | L2: LOOP L2 55 | DEC BX 56 | JNZ L1 57 | POP CX 58 | POP BX 59 | RET 60 | DELAY ENDP 61 | END -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/10-StepperMotor.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTC EQU 0E882H 4 | CR EQU 0E883H 5 | N EQU 05 6 | 7 | .CODE 8 | MOV AX,@DATA 9 | MOV DS,AX 10 | MOV AL,80H 11 | MOV DX,CR 12 | OUT DX,AL 13 | MOV CX,N 14 | MOV AL,33H 15 | MOV DX,PORTC 16 | BACKR: 17 | OUT DX,AL 18 | ROR AL,01H 19 | PUSH CX 20 | CALL DELAY 21 | POP CX 22 | LOOP BACKR 23 | MOV AH.4CH 24 | INT 21H 25 | 26 | DELAY PROC 27 | MOV BX,0F000H 28 | L1: 29 | MOV CX,00FFFH 30 | L2: 31 | LOOP L2 32 | DEC BX 33 | JNZ LI 34 | RET 35 | DELAY ENDP 36 | END 37 | -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/11a-FullSinWave.asm: -------------------------------------------------------------------------------- 1 | PROGRAM 2 | .MODEL SMALL 3 | .DATA 4 | PORTA EQU 0E880H 5 | CR EQU 0E883H 6 | ARR DB 7FH,8CH,99H,0A6H,0B2H,0BFH,0CAH,0D4H,0DDH,0E6H,0EDH,0F3H,0F8H,0FDH,0FCH, 7 | DB 0FBH,0F8H,0F3H,0EDH,0E6H,0DDH,0D4H,0CAH,0BFH,0B2H,0A6H,99H,08CH,7FH,72H, 8 | DB 65H,58H,4CH,3FH,34H,2AH,21H,18H,11H,0BH,06H,03H,01H,00H,01H, 9 | DB 03H, 06H,0BH,11H,18H,21H,2AH,34H,3FH,4CH,58H,65H,72H,7FH 10 | .CODE 11 | MOV AX,@DATA 12 | MOV DS,AX 13 | MOV AL,80H ; only port A of 8255 is used as output 14 | MOV DX,CR 15 | OUT DX,AL 16 | 17 | AGAIN: 18 | LEA SI,ARR ; use SI as pointer to array 19 | MOV DX,PORTA 20 | MOV CX,37 21 | BACK: 22 | LODSB 23 | OUT DX,AL ;send it to port (CRO) 24 | CALL DELAY 25 | LOOP BACK 26 | MOV AH,1 27 | INT 16H 28 | JZ AGAIN 29 | MOV AH,4CH 30 | INT 21H 31 | 32 | DELAY PROC 33 | MOV BX,0FFFH 34 | L1: DEC BX 35 | JNZ L1 36 | RET 37 | DELAY ENDP 38 | END -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/11b-HalfSinWave.asm: -------------------------------------------------------------------------------- 1 | .MODEL SMALL 2 | .DATA 3 | PORTA EQU 0E880H 4 | CR EQU 0E883H 5 | ARR DB 7FH,8CH,99H,0A6H,0B2H,0BFH,0CAH,0D4H,0DDH,0E6H,0EDH,0F3H,0F8H,0FDH,0FCH, 6 | DB 0FBH,0F8H,0F3H,0EDH,0E6H,0DDH,0D4H,0CAH,0BFH,0B2H,0A6H,99H,08CH,7FH,7FH, 7 | DB 7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH, 8 | DB 7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH,7FH 9 | .CODE 10 | MOV AX,@DATA 11 | MOV DS,AX 12 | MOV AL,80H ; only port A of 8255 is used as output 13 | MOV DX,CR 14 | OUT DX,AL 15 | 16 | AGAIN: 17 | LEA SI,ARR ; use SI as pointer to array 18 | MOV DX,PORTA 19 | MOV CX,37 20 | BACK: 21 | LODSB 22 | OUT DX,AL ;send it to port (CRO) 23 | CALL DELAY 24 | LOOP BACK 25 | MOV AH,1 26 | INT 16H 27 | JZ AGAIN 28 | MOV AH,4CH 29 | INT 21H 30 | 31 | DELAY PROC 32 | MOV BX,0FFFH 33 | L1: DEC BX 34 | JNZ L1 35 | RET 36 | DELAY ENDP 37 | END -------------------------------------------------------------------------------- /sem-4/information_science/MP Lab/13-ARM-StepperMotor.c: -------------------------------------------------------------------------------- 1 | #include 2 | void delay(unsigned int value); 3 | void gpio_init(); 4 | unsigned char cmd1[4]= {0x11,0x22,0x44,0x88}; 5 | //unsigned int j; 6 | int main() 7 | { unsigned int i; 8 | gpio_init(); 9 | while(1) //* // Loop forever 10 | { 11 | for (i=0;i<4;i++) 12 | { 13 | IO0PIN =cmd1[i]<<15; 14 | delay(0X5000); 15 | } 16 | } 17 | } 18 | void gpio_init() 19 | { 20 | PINSEL0 = 0x00000000; // P1.15 - P1.18 as GPIO 21 | IODIR0 |= 0x00078000; // Set Port0 as Output 22 | IOCLR0 = 0x00078000; 23 | } 24 | void delay(unsigned int value) 25 | { 26 | unsigned int k; 27 | for(k=0;k cap) { 37 | drop = count - cap; 38 | count = cap; 39 | } 40 | System.out.print(i + 1); 41 | System.out.print("\t\t" + inp[i]); 42 | mini = min(count, process); 43 | System.out.print("\t\t" + mini); 44 | count -= mini; 45 | System.out.print("\t\t" + count); 46 | System.out.println("\t\t" + drop); 47 | drop = 0; 48 | } 49 | for (; count != 0; i++) { 50 | if (count > cap) { 51 | drop = count - cap; 52 | count = cap; 53 | } 54 | System.out.print(i + 1); 55 | System.out.print("\t\t0"); 56 | mini = min(count, process); 57 | System.out.print("\t\t" + mini); 58 | count -= mini; 59 | System.out.print("\t\t" + count); 60 | System.out.println("\t\t" + drop); 61 | } 62 | sc.close(); 63 | } 64 | } -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/RSA.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/computer_science/CN_Lab/RSA.class -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/RSA.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | /** 5 | * RSA 6 | */ 7 | public class RSA { 8 | public static void main(String[] args) throws IOException { 9 | Scanner sc = new Scanner(System.in); 10 | InputStreamReader r = new InputStreamReader(System.in); 11 | BufferedReader br = new BufferedReader(r); 12 | String message1; 13 | int[] plainText = new int[100]; 14 | int[] cipherText = new int[100]; 15 | int n, d, e, z, p, q; 16 | System.out.println("Enter the values of p and q:"); 17 | p = sc.nextInt(); 18 | q = sc.nextInt(); 19 | n = p * q; 20 | z = (p - 1) * (q - 1); 21 | System.out.println("Select a value for e:"); 22 | e = sc.nextInt(); 23 | System.out.println("Error message:"); 24 | message1 = br.readLine(); 25 | char[] msg = message1.toCharArray(); 26 | for (int i = 0; i < msg.length; i++) { 27 | plainText[i] = msg[i]; 28 | } 29 | for (d = 0; d < z; d++) { 30 | if ((e * d) % z == 1) { 31 | break; 32 | } 33 | } 34 | System.out.println("p = " + p + "\tq = " + q + "\tn = " + n + "\tz = " + z + "\te = " + e + "\td = " + d); 35 | System.out.println("Cipher Text = "); 36 | for (int i = 0; i < msg.length; i++) { 37 | cipherText[i] = mult(plainText[i], e, n); 38 | } 39 | for (int i = 0; i < msg.length; i++) { 40 | System.out.print(cipherText[i] + "\t"); 41 | } 42 | System.out.println(); 43 | System.out.println("Plain Text = "); 44 | for (int i = 0; i < msg.length; i++) { 45 | plainText[i] = mult(cipherText[i], d, n); 46 | } 47 | for (int i = 0; i < msg.length; i++) { 48 | System.out.print((char) plainText[i]); 49 | } 50 | System.out.println(); 51 | sc.close(); 52 | } 53 | 54 | static int mult(int x, int y, int n) { 55 | int k = 1; 56 | for (int i = 0; i < y; i++) { 57 | k = (k * x) % n; 58 | } 59 | return k; 60 | } 61 | } -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/TCPClient.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/computer_science/CN_Lab/TCPClient.class -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/TCPClient.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.net.*; 3 | 4 | /** 5 | * TCPClient 6 | */ 7 | public class TCPClient { 8 | 9 | public static void main(String[] args) throws IOException { 10 | Socket sock = new Socket("127.0.0.1", 4000); 11 | System.out.print("Enter the file name: "); 12 | BufferedReader keyRead = new BufferedReader(new InputStreamReader(System.in)); 13 | String fName = keyRead.readLine(); 14 | 15 | OutputStream oStream = sock.getOutputStream(); 16 | PrintWriter pWrite = new PrintWriter(oStream, true); 17 | pWrite.println(fName); 18 | 19 | InputStream iStream = sock.getInputStream(); 20 | BufferedReader socketRead = new BufferedReader(new InputStreamReader(iStream)); 21 | 22 | String str; 23 | while ((str = socketRead.readLine()) != null) { 24 | System.out.println(str); 25 | } 26 | pWrite.close(); 27 | socketRead.close(); 28 | keyRead.close(); 29 | sock.close(); 30 | iStream.close(); 31 | } 32 | } -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/TCPServer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/computer_science/CN_Lab/TCPServer.class -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/TCPServer.java: -------------------------------------------------------------------------------- 1 | import java.net.*; 2 | import java.io.*; 3 | 4 | /** 5 | * TCPServer 6 | */ 7 | public class TCPServer { 8 | public static void main(String[] args) throws IOException { 9 | ServerSocket sersock = new ServerSocket(4000); 10 | System.out.println("Server ready for connection."); 11 | Socket sock = sersock.accept(); 12 | System.out.println("Connection is succesful and ready for chatting."); 13 | InputStream iStream = sock.getInputStream(); 14 | BufferedReader fileRead = new BufferedReader(new InputStreamReader(iStream)); 15 | String fName = fileRead.readLine(); 16 | BufferedReader contentRead = new BufferedReader(new FileReader(fName)); 17 | 18 | OutputStream oStream = sock.getOutputStream(); 19 | PrintWriter pWrite = new PrintWriter(oStream, true); 20 | 21 | String str; 22 | while ((str = contentRead.readLine()) != null) { 23 | pWrite.println(str); 24 | } 25 | sock.close(); 26 | sersock.close(); 27 | pWrite.close(); 28 | fileRead.close(); 29 | contentRead.close(); 30 | } 31 | } -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/UDPClient.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/computer_science/CN_Lab/UDPClient.class -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/UDPClient.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.net.*; 3 | 4 | /** 5 | * UDPClient 6 | */ 7 | public class UDPClient { 8 | public static void main(String[] args) throws IOException { 9 | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); 10 | DatagramSocket clientSocket = new DatagramSocket(); 11 | InetAddress IPAddress = InetAddress.getByName("localhost"); 12 | byte[] sendData = new byte[1024]; 13 | byte[] receiveData = new byte[1024]; 14 | String sentence = "Hello server"; 15 | sendData = sentence.getBytes(); 16 | DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 9876); 17 | clientSocket.send(sendPacket); 18 | DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); 19 | clientSocket.receive(receivePacket); 20 | String modifiedSentence = new String(receivePacket.getData()); 21 | System.out.println("FROM SERVER: " + modifiedSentence); 22 | clientSocket.close(); 23 | } 24 | } -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/UDPServer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/computer_science/CN_Lab/UDPServer.class -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/UDPServer.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.net.*; 3 | 4 | /** 5 | * UDPServer 6 | */ 7 | public class UDPServer { 8 | public static void main(String[] args) throws IOException { 9 | DatagramSocket serverSocket = new DatagramSocket(9876); 10 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 11 | byte[] receiveData = new byte[1024]; 12 | byte[] sendData = new byte[1024]; 13 | DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); 14 | serverSocket.receive(receivePacket); 15 | String sentence = new String(receivePacket.getData()); 16 | System.out.println("RECEIVED: " + sentence); 17 | InetAddress IPAddress = receivePacket.getAddress(); 18 | int port = receivePacket.getPort(); 19 | System.out.println("Enter the message:"); 20 | String data = br.readLine(); 21 | sendData = data.getBytes(); 22 | DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port); 23 | serverSocket.send(sendPacket); 24 | serverSocket.close(); 25 | 26 | } 27 | } -------------------------------------------------------------------------------- /sem-5/computer_science/CN_Lab/abc.txt: -------------------------------------------------------------------------------- 1 | Hello 2 | -------------------------------------------------------------------------------- /sem-5/electronics_and_communication/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/electronics_and_communication/.gitkeep -------------------------------------------------------------------------------- /sem-5/information_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/information_science/.gitkeep -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/CN LAB MANUAL.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-5/information_science/cn_lab/CN LAB MANUAL.pdf -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_10/program_10.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.net.*; 3 | class Dataudp{ 4 | public static int serverport=1632; 5 | public static int clientport=1633; 6 | public static byte[] buffer=new byte[100]; 7 | public static DatagramSocket ds; 8 | 9 | public static void Theserver()throws Exception{ 10 | int pos=0; 11 | while(true){ 12 | int c=System.in.read(); 13 | switch(c){ 14 | case -1:System.out.println("Server Quits"); 15 | return; 16 | case '\r':break; 17 | case '\n':ds.send(new DatagramPacket(buffer,pos,InetAddress.getLocalHost(),clientport)); 18 | pos=0; 19 | break; 20 | default:buffer[pos++]=(byte)c; 21 | } 22 | } 23 | } 24 | 25 | public static void Theclient()throws Exception{ 26 | while(true){ 27 | DatagramPacket p=new DatagramPacket(buffer, buffer.length); 28 | ds.receive(p); 29 | System.out.println(new String(p.getData(),0,p.getLength())); 30 | } 31 | } 32 | 33 | public static void main(String args[])throws Exception{ 34 | if(args.length==1){ 35 | ds=new DatagramSocket(serverport); 36 | Theserver(); 37 | } 38 | else{ 39 | ds=new DatagramSocket(clientport); 40 | Theclient(); 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_10/readme.md: -------------------------------------------------------------------------------- 1 | # Program 10 2 | ## Question 3 | Write a program on datagram socket for client/server to display the messages on client side, typedat the server side. 4 | ## Output 5 | ![image](https://user-images.githubusercontent.com/42874695/106568446-4e97d480-6559-11eb-9287-a166af6f5be9.png) 6 | ![image](https://user-images.githubusercontent.com/42874695/106568496-61120e00-6559-11eb-85bd-5401a2c2add9.png) 7 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_11/program_11.java: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | import java.util.*; 3 | class rsa{ 4 | static int mult(int x,int y,int z){ //to calculate cipher text 5 | int k=1; 6 | for(int i=0;i127 15 | Scanner sc=new Scanner(System.in); 16 | int p=sc.nextInt(); 17 | int q=sc.nextInt(); 18 | int n=p*q; 19 | int z=(p-1)*(q-1); 20 | System.out.println("Enter the e value"); 21 | int e=sc.nextInt(); 22 | BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); 23 | System.out.println("Enter Text Mesaage"); 24 | String msg=br.readLine(); 25 | char msg1[]=msg.toCharArray(); 26 | for(int i=0;icap){ 22 | drop=count-cap; 23 | count=cap; 24 | } 25 | if(count>out){ 26 | mini=out; 27 | count-=out; 28 | } 29 | else{ 30 | mini=count; 31 | count=0; 32 | } 33 | System.out.println(i+1+"\t"+inp[i]+"\t\t"+mini+"\t\t"+count+"\t\t"+drop); 34 | drop =0; 35 | } 36 | for(;count!=0;i++){ //if data is remaining in bucket after input becomes null 37 | if(count>cap){ 38 | drop=count-cap; 39 | count=cap; 40 | } 41 | if(count>out){ 42 | mini=out; 43 | count-=out; 44 | } 45 | else{ 46 | mini=count; 47 | count=0; 48 | } 49 | System.out.println(i+1+"\t"+inp[i]+"\t\t"+mini+"\t\t"+count+"\t\t"+drop); 50 | drop = 0; 51 | } 52 | sc.close(); 53 | } 54 | } 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_12/readme.md: -------------------------------------------------------------------------------- 1 | # Program 12 2 | ## Question 3 | Write a program for congestion control using leaky bucket algorithm. 4 | ## Output 5 | ![image](https://user-images.githubusercontent.com/42874695/106454783-4ab07780-64b1-11eb-8d98-527ca1602048.png) 6 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_7/readme.md: -------------------------------------------------------------------------------- 1 | # Program 7 2 | ## Question 3 | Write a program for error detecting code using CRC-CCITT (16- bits). 4 | ## Output 5 | ![image](https://user-images.githubusercontent.com/42874695/106429647-bafad100-6490-11eb-9b25-fc07d025849c.png) 6 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_8/program_8.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class bell { 3 | public static void main(String args[]){ 4 | 5 | System.out.println("Enter the number of nodes"); 6 | Scanner sc=new Scanner(System.in); 7 | int n=sc.nextInt(); 8 | int adj[][]=new int[n+1][n+1]; 9 | 10 | System.out.println("Enter the adjacency matrix"); 11 | for(int i=1;i<=n;i++) 12 | for(int j=1;j<=n;j++) 13 | adj[i][j]=sc.nextInt(); 14 | 15 | 16 | for(int i=1;i<=n;i++) 17 | for(int j =1; j<=n; j++) 18 | if (i==j) 19 | adj[i][j] = 0; 20 | else 21 | if(adj[i][j]==0) 22 | adj[i][j] = 999; 23 | 24 | int dist[]=new int[n+1]; 25 | System.out.println("Enter the source node"); 26 | int s=sc.nextInt(); 27 | 28 | for(int i=1;i<=n;i++) 29 | dist[i]=999; 30 | 31 | dist[s]=0; 32 | for(int i=1;i<=n;i++) 33 | for(int u=1;u<=n;u++) 34 | for(int v=1;v<=n;v++) 35 | if(adj[u][v]!= 999) 36 | if(dist[v] > dist[u]+adj[u][v]) 37 | dist[v] = dist[u]+adj[u][v]; 38 | 39 | for(int u=1;u<=n;u++) 40 | for(int v=1;v<=n;v++) 41 | if(adj[u][v]!= 999) 42 | if(dist[v] > dist[u]+adj[u][v]) 43 | System.out.println("Negative edge detected"); 44 | 45 | for(int i=1;i<=n;i++) 46 | System.out.println("cost from "+s+" to "+i+" is "+dist[i]); 47 | 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_8/readme.md: -------------------------------------------------------------------------------- 1 | # Program 8 2 | ## Question 3 | Write a program to find the shortest path between vertices using bellman-ford algorithm. 4 | ## Output 5 | 6 | ![image](https://user-images.githubusercontent.com/42874695/106451069-07073f00-64ac-11eb-8209-0d9a5773d22f.png) 7 | 8 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_9/program_9_client.java: -------------------------------------------------------------------------------- 1 | import java.net.*; 2 | import java.io.*; 3 | import java.util.Scanner; 4 | 5 | public class try_client { 6 | public static void main(String args[]) throws Exception { 7 | String temp; 8 | Socket s = new Socket("127.0.0.1", 6300); 9 | Scanner sc = new Scanner(System.in); 10 | BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 11 | System.out.println("Enter file name"); 12 | String fname = br.readLine(); 13 | PrintWriter pw = new PrintWriter(s.getOutputStream(), true); 14 | pw.println(fname); 15 | BufferedReader br1 = new BufferedReader(new InputStreamReader(s.getInputStream())); 16 | while ((temp = br1.readLine()) != null) { 17 | System.out.println(temp); 18 | } 19 | s.close(); 20 | sc.close(); 21 | } 22 | } -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_9/program_9_server.java: -------------------------------------------------------------------------------- 1 | 2 | import java.net.*; 3 | import java.io.*; 4 | 5 | public class try_server { 6 | public static void main(String args[]) throws Exception { 7 | ServerSocket ss = new ServerSocket(6300); 8 | String temp; 9 | System.out.println("Listening to the network"); 10 | Socket s = ss.accept(); 11 | System.out.println("Connected"); 12 | BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); 13 | String fname = br.readLine(); 14 | BufferedReader br1 = new BufferedReader(new FileReader(fname)); 15 | PrintWriter pw = new PrintWriter(s.getOutputStream(), true); 16 | while ((temp = br1.readLine()) != null) { 17 | pw.println(temp); 18 | } 19 | br.close(); 20 | br1.close(); 21 | s.close(); 22 | ss.close(); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /sem-5/information_science/cn_lab/program_9/readme.md: -------------------------------------------------------------------------------- 1 | # Program 9 2 | ## Question 3 | Using TCP/IP sockets, write a client – server program to make the client send the file name and tomake the server send back the contents of the requested file if present. 4 | ## Output 5 | ![image](https://user-images.githubusercontent.com/42874695/106510645-38f0c380-64f5-11eb-858a-27c1d1c39e3a.png) 6 | ![image](https://user-images.githubusercontent.com/42874695/106510678-4148fe80-64f5-11eb-974f-904bb43f26cc.png) 7 | -------------------------------------------------------------------------------- /sem-5/readme.md: -------------------------------------------------------------------------------- 1 | # VTU Lab Material 2 | #### Ever had trouble getting the right VTU lab material to study from? Well look no further here's a collection of all resources required gathered under one roof! 3 | 4 | 5 | # Contributing 6 | To contribute to the project, Please take up the tasks specified in the issues. Add a comment in the issues if you are taking up one. 7 | 8 | ### Instructions 9 | - Fork the repository to your account. 10 | - Copy the clone url of your repository. 11 | - Clone the repository to your machine `git clone https://github.com/YOUR_USER_NAME/VTU-Lab-Material.git` 12 | - Make sure you create a branch with the name as the issue you are working on `git checkout -b YOUR_BRANCH_NAME`, and make sure you are working on the same branch and not the `master`, run `git status` to know which branch you are working on, run `git branch`, your branch will be highlighted with an `*`. If you are not in your branch or want to move to another branch use `git checkout BRANCH_NAME`. 13 | a good branch name should explain what this branch is about eg. `sem-5_CompterSciendce_DBMS` etc. 14 | - Add the upstream url of original repository, follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) 15 | - Make sure your repository is in sync with the original repository's master branch. Follow the instruction [here](https://help.github.com/articles/syncing-a-fork/) to know how to keep your local repository in sync. 16 | - Finally when you have made the changes, submit a pull request through github from the original repository, choose your branch against the master of original or create a new branch. -------------------------------------------------------------------------------- /sem-6/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-6/.DS_Store -------------------------------------------------------------------------------- /sem-6/computer_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-6/computer_science/.gitkeep -------------------------------------------------------------------------------- /sem-6/electronics_and_communication/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-6/electronics_and_communication/.gitkeep -------------------------------------------------------------------------------- /sem-6/information_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-6/information_science/.gitkeep -------------------------------------------------------------------------------- /sem-6/information_science/FS-Lab/1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "reverse.h" 7 | using namespace std; 8 | int main() 9 | { 10 | int choice; 11 | string name, rv, s, infile, outfile; 12 | fstream f1, f2; 13 | int len, i, count; 14 | while (1) 15 | { 16 | cout << "Enter your choice \n 1. From Standard I/O\n 2. From File\n 3.Exit\n"; 17 | cin >> choice; 18 | switch (choice) 19 | { 20 | case 1: 21 | cout << "From Standard I/O\n"; 22 | cout << "How many?\n"; 23 | cin >> count; 24 | while (count--) 25 | { 26 | cout << "\nName:"; 27 | cin >> name; 28 | rv = rev(name); 29 | cout << "Reverse:" << rv << endl; 30 | } 31 | break; 32 | case 2: 33 | f1.open("str.txt", ios::in); 34 | cout << "Input file : str.txt\n"; 35 | f2.open("rev.txt", ios::out); 36 | cout << "Output file : rev.txt\n"; 37 | while (!f1.eof()) 38 | { 39 | s.erase(); 40 | f1 >> s; 41 | rv.erase(); 42 | rv = rev(s); 43 | f2 << rv << "\n"; 44 | } 45 | cout << " Reversed contents copied\n"; 46 | break; 47 | case 3: 48 | return (0); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sem-6/information_science/FS-Lab/1a.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "reverse.h" 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | string rv,s; 10 | fstream f1,f2; 11 | int len,i; 12 | f1.open("str.txt",ios::in); 13 | f2.open("rev.txt",ios::out); 14 | while(!f1.eof()) 15 | { 16 | s.erase(); 17 | f1>>s; 18 | rv.erase(); 19 | rv=rev(s); 20 | f2< 2 | #include 3 | #include 4 | using namespace std; 5 | 6 | class Coseq 7 | { 8 | private: 9 | string list1[100], list2[100]; 10 | int count1, count2; 11 | 12 | public: 13 | void load_list(); 14 | void sort_list(); 15 | void match(); 16 | }; 17 | 18 | void Coseq::load_list() 19 | { 20 | fstream file; 21 | string name; 22 | count1 = -1; 23 | count2 = -1; 24 | 25 | file.open("name1.txt"); 26 | while (!file.eof()) 27 | { 28 | name.erase(); 29 | getline(file, name); 30 | list1[++count1] = name; 31 | } 32 | file.close(); 33 | 34 | file.open("name2.txt"); 35 | while (!file.eof()) 36 | { 37 | name.erase(); 38 | getline(file, name); 39 | list2[++count2] = name; 40 | } 41 | file.close(); 42 | } 43 | 44 | void Coseq::sort_list() 45 | { 46 | int i, j; 47 | string temp; 48 | for (i = 0; i <= count1; i++) 49 | { 50 | for (j = i + 1; j < count1; j++) 51 | { 52 | if (list1[i] > list1[j]) 53 | { 54 | temp = list1[i]; 55 | list1[i] = list1[j]; 56 | list1[j] = temp; 57 | } 58 | } 59 | } 60 | for (i = 0; i < count2; i++) 61 | { 62 | for (j = i + 1; j <= count2; j++) 63 | { 64 | if (list2[i] > list2[j]) 65 | { 66 | temp = list2[i]; 67 | list2[i] = list2[j]; 68 | list2[j] = temp; 69 | } 70 | } 71 | } 72 | } 73 | void Coseq::match() 74 | { 75 | int i = 0, j = 0, flag = 0; 76 | while (i <= count1 && j <= count2) 77 | { 78 | if (list1[i] == list2[j]) 79 | { 80 | cout << list1[i] << "\n"; 81 | i++; 82 | j++; 83 | flag = 1; 84 | } 85 | if (list1[i] < list2[j]) 86 | i++; 87 | if (list1[i] > list2[j]) 88 | j++; 89 | } 90 | if (flag == 0) 91 | cout << "No match found\n"; 92 | } 93 | int main() 94 | { 95 | Coseq c1; 96 | c1.load_list(); 97 | c1.sort_list(); 98 | c1.match(); 99 | return 0; 100 | } 101 | -------------------------------------------------------------------------------- /sem-6/information_science/FS-Lab/reverse.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | using namespace std; 4 | string rev(string c) 5 | { 6 | int l; 7 | string s; 8 | l = c.length() - 1; 9 | for (; l >= 0; l--) 10 | { 11 | s += c[l]; 12 | } 13 | return s; 14 | } 15 | -------------------------------------------------------------------------------- /sem-6/readme.md: -------------------------------------------------------------------------------- 1 | # VTU Lab Material 2 | #### Ever had trouble getting the right VTU lab material to study from? Well look no further here's a collection of all resources required gathered under one roof! 3 | 4 | 5 | # Contributing 6 | To contribute to the project, Please take up the tasks specified in the issues. Add a comment in the issues if you are taking up one. 7 | 8 | ### Instructions 9 | - Fork the repository to your account. 10 | - Copy the clone url of your repository. 11 | - Clone the repository to your machine `git clone https://github.com/YOUR_USER_NAME/VTU-Lab-Material.git` 12 | - Make sure you create a branch with the name as the issue you are working on `git checkout -b YOUR_BRANCH_NAME`, and make sure you are working on the same branch and not the `master`, run `git status` to know which branch you are working on, run `git branch`, your branch will be highlighted with an `*`. If you are not in your branch or want to move to another branch use `git checkout BRANCH_NAME`. 13 | a good branch name should explain what this branch is about eg. `sem-5_CompterSciendce_DBMS` etc. 14 | - Add the upstream url of original repository, follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) 15 | - Make sure your repository is in sync with the original repository's master branch. Follow the instruction [here](https://help.github.com/articles/syncing-a-fork/) to know how to keep your local repository in sync. 16 | - Finally when you have made the changes, submit a pull request through github from the original repository, choose your branch against the master of original or create a new branch. -------------------------------------------------------------------------------- /sem-7/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-7/.DS_Store -------------------------------------------------------------------------------- /sem-7/computer_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-7/computer_science/.gitkeep -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/01. Find-S Algorithm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | """ 4 | Created on Sat Dec 8 23:36:12 IST 2018 5 | @author: Hitoshirenu 6 | """ 7 | 8 | # Import modules 9 | import csv 10 | 11 | # Initialize a variable as list to save dataset 12 | data = [] # data --> dataset 13 | 14 | print("The Given Training Data:") 15 | # Open the csv file in read mode and add rows to data 16 | with open("datasets/enjoysport.csv", "r") as csvFile: 17 | reader = csv.reader(csvFile) 18 | for row in reader: 19 | data.append(row) 20 | print(row) 21 | 22 | # Number of attributes i.e. all columns, excluding the last column 23 | num_attributes = len(data[0]) - 1 24 | 25 | # The number of "?" and "0" represent the number of attributes 26 | print("\nThe most general hypothesis :\n", ["0"] * num_attributes) 27 | print("\nThe most specific hypothesis :\n", ["?"] * num_attributes) 28 | 29 | hypothesis = ["0"] * num_attributes 30 | print("\nInitial value of the hypothesis:\n",hypothesis) 31 | 32 | # First row values of the dataset without the last column value 33 | hypothesis = data[1][:-1] 34 | 35 | print("\n**** Find S: Finding Maximally specific hypothesis ****\n") 36 | for i in range(1, len(data)): 37 | # Check if the rows last value is "yes" 38 | if data[i][num_attributes] == "yes": 39 | for j in range(num_attributes): 40 | hypothesis[j] = "?" if data[i][j] != hypothesis[j] else data[i][j] 41 | print("For training example no :{} Hypothesis:{}".format(i, hypothesis)) 42 | 43 | print("\nThe Maximally Specific Hypothesis for the given Training Examples:\n", hypothesis) -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/02. Candidate Elimination.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | # Repo link: 4 | 5 | # Import modules 6 | import numpy as np 7 | import pandas as pd 8 | 9 | # Read the csv file and add values to data 10 | data = pd.read_csv('datasets/enjoysport.csv') 11 | 12 | # Initialize values 13 | concepts = np.array(data.iloc[:, :-1]) 14 | target = np.array(data.iloc[:, -1]) 15 | 16 | def learn(concepts, target): 17 | specific_h = concepts[0].copy() 18 | general_h = [["?" for i in range(len(specific_h))] for j in range(len(specific_h))] 19 | for i, h in enumerate(concepts): 20 | if target[i] == 'yes': 21 | for x in range(len(specific_h)): 22 | if h[x] != specific_h[x]: 23 | specific_h[x] = '?' 24 | general_h[x][x] = '?' 25 | if target[i] == 'no': 26 | for x in range(len(specific_h)): 27 | if h[x] != specific_h[x]: 28 | general_h[x][x] = specific_h[x] 29 | else: 30 | general_h[x][x] = '?' 31 | indices = [i for i, val in enumerate(general_h) if val == ['?', '?', '?', '?', '?', '?']] 32 | for i in indices: 33 | general_h.remove(['?', '?', '?', '?', '?', '?']) 34 | return specific_h, general_h 35 | 36 | s_final, g_final = learn(concepts, target) 37 | 38 | print("Maximally specific hypotheses - S:\n", s_final) 39 | print("Maximally general hypotheses - G:\n", g_final) -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/08. EM & K-MEANS ALGORITHM.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | """ 4 | Created on Sat Dec 8 23:36:12 IST 2018 5 | @author: Hitoshirenu 6 | """ 7 | 8 | # Import modules 9 | import matplotlib.pyplot as plt 10 | from sklearn import datasets 11 | from sklearn.cluster import KMeans 12 | import pandas as pd 13 | import numpy as np 14 | 15 | # Load the iris dataset 16 | iris = datasets.load_iris() 17 | 18 | # Initialize values 19 | X = pd.DataFrame(iris.data) 20 | y = pd.DataFrame(iris.target) 21 | X.columns = ['Sepal_Length','Sepal_Width','Petal_Length','Petal_Width'] 22 | y.columns = ['Targets'] 23 | 24 | 25 | # Build the K Means Model 26 | model = KMeans(n_clusters = 3) 27 | 28 | # Fit the dataset values into model 29 | model.fit(X) 30 | 31 | # Size and color use to plot graphs 32 | plt.figure(figsize=(14, 14)) 33 | colormap = np.array(['red', 'lime', 'black']) 34 | 35 | # Plot real cluster 36 | plt.subplot(2, 2, 1) 37 | plt.scatter(X.Petal_Length, X.Petal_Width, c=colormap[y.Targets], s=40) 38 | plt.title('Real Clusters') 39 | plt.xlabel('Petal Length') 40 | plt.ylabel('Petal Width') 41 | 42 | # Plot K-means cluster 43 | plt.subplot(2, 2, 2) 44 | plt.scatter(X.Petal_Length, X.Petal_Width, c=colormap[model.labels_], s=40) 45 | plt.title('K-Means Clustering') 46 | plt.xlabel('Petal Length') 47 | plt.ylabel('Petal Width') 48 | 49 | # General EM for GMM 50 | from sklearn import preprocessing 51 | scaler = preprocessing.StandardScaler() 52 | scaler.fit(X) 53 | xsa = scaler.transform(X) 54 | xs = pd.DataFrame(xsa, columns = X.columns) 55 | 56 | from sklearn.mixture import GaussianMixture 57 | gmm = GaussianMixture(n_components = 3) 58 | gmm.fit(xs) 59 | gmm_y = gmm.predict(xs) 60 | plt.subplot(2, 2, 3) 61 | plt.scatter(X.Petal_Length, X.Petal_Width, c=colormap[gmm_y], s=40) 62 | plt.title('GMM Clustering') 63 | plt.xlabel('Petal Length') 64 | plt.ylabel('Petal Width') 65 | print('Observation: The GMM using EM algorithm based clustering matched the true labels more closely than the Kmeans.') -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/09. k-NEAREST NEIGHBOUR ALGORITHM.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding: utf-8 3 | """ 4 | Created on Sat Dec 8 23:36:12 IST 2018 5 | @author: Hitoshirenu 6 | """ 7 | 8 | # Import modules 9 | from sklearn.model_selection import train_test_split 10 | from sklearn.neighbors import KNeighborsClassifier 11 | from sklearn import datasets 12 | 13 | # Load the iris dataset 14 | iris = datasets.load_iris() 15 | 16 | # Split the data into train and test samples 17 | xtrain, xtest, ytrain, ytest = train_test_split(iris.data, iris.target, test_size=0.1) 18 | print("\nDataset is split into Training:{} and Testing:{} instances".format(xtrain.shape[0], xtest.shape[0])) 19 | 20 | # Show what number corresponds to which label 21 | for index, value in enumerate(iris.target_names): 22 | print("Label: {} --> {}".format(index, value)) 23 | 24 | # Create object of KNN classifier 25 | classifier = KNeighborsClassifier(n_neighbors = 1) 26 | 27 | # Perform Training 28 | classifier.fit(xtrain, ytrain) 29 | 30 | # Perform testing 31 | y_pred = classifier.predict(xtest) 32 | 33 | # Display the results 34 | print("Results of Classification using K-nn with K=1 ") 35 | for r in range(len(xtest)): 36 | print("Sample:{} Actual-label:{} Predicted-label:{}".format(xtest[r], ytest[r], y_pred[r])) 37 | print("Classification Accuracy :" , classifier.score(xtest, ytest)); -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/datasets/PlayTennis.csv: -------------------------------------------------------------------------------- 1 | ,PlayTennis,Outlook,Temperature,Humidity,Wind 2 | 0,No,Sunny,Hot,High,Weak 3 | 1,No,Sunny,Hot,High,Strong 4 | 2,Yes,Overcast,Hot,High,Weak 5 | 3,Yes,Rain,Mild,High,Weak 6 | 4,Yes,Rain,Cool,Normal,Weak 7 | 5,No,Rain,Cool,Normal,Strong 8 | 6,Yes,Overcast,Cool,Normal,Strong 9 | 7,No,Sunny,Mild,High,Weak 10 | 8,Yes,Sunny,Cool,Normal,Weak 11 | 9,Yes,Rain,Mild,Normal,Weak 12 | 10,Yes,Sunny,Mild,Normal,Strong 13 | 11,Yes,Overcast,Mild,High,Strong 14 | 12,Yes,Overcast,Hot,Normal,Weak 15 | 13,No,Rain,Mild,High,Strong 16 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/datasets/enjoysport.csv: -------------------------------------------------------------------------------- 1 | sky,airTemp,humidity,wind,water,forecast,enjoySport 2 | sunny,warm,normal,strong,warm,same,yes 3 | sunny,warm,high,strong,warm,same,yes 4 | rainy,cold,high,strong,warm,change,no 5 | sunny,warm,high,strong,cool,change,yes 6 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL76_MACHINE_LEARNING_LABORATORY/datasets/text_doc.csv: -------------------------------------------------------------------------------- 1 | 2 | I love this sandwich,pos 3 | This is an amazing place,pos 4 | I feel very good about these beers,pos 5 | This is my best work,pos 6 | What an awesome view,pos 7 | I do not like this restaurant,neg 8 | I am tired of this stuff,neg 9 | I can't deal with this,neg 10 | He is my sworn enemy,neg 11 | My boss is horrible,neg 12 | This is an awesome place,pos 13 | I do not like the taste of this juice,neg 14 | I love to dance,pos 15 | I am sick and tired of this place,neg 16 | What a great holiday,pos 17 | That is a bad locality to stay,neg 18 | We will have good fun tomorrow,pos 19 | I went to my enemy's house today,neg -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-01/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Simple Calculator 5 | 8 | 9 | 10 |

Simple Calculator

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 | 39 | 40 | 41 | 42 | 43 | 44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-02/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Squares and Cubes 5 | 6 | 7 |

Squares and Cubes

8 | 9 | 10 | 11 | 13 | 14 |
NumberSquare 12 | Cube
15 | 22 | 23 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-03/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Growing and Skrinking Text 4 | 5 | 6 |

7 | 8 | 37 | 38 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-04/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Number or Vowel? 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 |
14 | 15 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-05/index.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Rick Sanchez 6 | 4SF15CS102 7 | Sahyadri College of Engineering and Management 8 | Computer Science 9 | 2015 10 | ricksanchez@gmail.com 11 | 12 | 13 | 14 | Jessica 15 | 4SF15CS103 16 | Sahyadri College of Engineering and Management 17 | Computer Science 18 | 2015 19 | jessica@gmail.com 20 | 21 | 22 | 23 | Morty Smith 24 | 4SF15CS104 25 | Sahyadri College of Engineering and Management 26 | Computer Science 27 | 2015 28 | mortysmith@gmail.com 29 | 30 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-05/style.css: -------------------------------------------------------------------------------- 1 | students { 2 | background: lightblue; 3 | } 4 | 5 | name{ 6 | color: darkblue; 7 | font-size: 20px; 8 | } 9 | 10 | usn, branch, year, college, email{ 11 | display: block; 12 | color: blue; 13 | font-size: 20px; 14 | padding: 5px 20px; 15 | } 16 | 17 | /* To show tag names we use content attribute which requires a pseudo element like ":before"*/ 18 | usn:before { 19 | content:"USN: "; 20 | font-weight: bold; 21 | color: red; 22 | } 23 | college:before { 24 | content:"College: "; 25 | font-weight: bold; 26 | color: red; 27 | } 28 | branch:before { 29 | content:"Branch: "; 30 | font-weight: bold; 31 | color: red; 32 | } 33 | year:before { 34 | content:"Year: "; 35 | font-weight: bold; 36 | color: red; 37 | } 38 | email:before { 39 | content:"Email: "; 40 | font-weight: bold; 41 | color: red; 42 | } -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-06/count.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-06/count.txt -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-06/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Visiter Count 5 | 6 | 7 | Page Views:' . $file_content . ''; 14 | // Write the value back into the file 15 | file_put_contents("count.txt", $file_content); 16 | ?> 17 | 18 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-07/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Displaying Time using PHP 5 | 6 | 7 | 8 | '.date ("h:i:s A").''; 10 | ?> 11 | 12 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-08_a/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Simple Calculator 5 | 6 | 7 |
8 |

1st Operand:

9 |

2nd Operand:

10 |

Choose Operator: 11 | Add( + ) 12 | Subtract( - ) 13 | Multiply( * ) 14 | Divide( / ) 15 |

16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-08_a/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Result Page 6 | 7 | 8 | Division by 0 error'; 24 | exit(0); 25 | } 26 | $res=$op1/$op2; 27 | break; 28 | } 29 | echo '

Simple Calculator

'; 30 | echo '

'.$op1.$operator.$op2.'='.$res.'

'; 31 | ?> 32 | 33 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-08_b/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Matrix Transpose 5 | 6 | 7 | '; 14 | for($i=0; $i"; 19 | } 20 | echo ''; 21 | } 22 | 23 | // Create transpose of the matrix 24 | for($i = 0; $i < count($matrix); $i++){ 25 | for($j = 0; $j < count($matrix[0]); $j++){ 26 | $transpose[$j][$i] = $matrix[$i][$j]; 27 | } 28 | } 29 | 30 | echo '

Actual Matrix is:

'; 31 | print_matrix($matrix); 32 | echo '

Transpose Matrix is:

'; 33 | print_matrix($transpose); 34 | ?> 35 | 36 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-08_c/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Matrix Multiplication 5 | 6 | 7 | '; 15 | for($i=0; $i"; 20 | } 21 | echo ''; 22 | } 23 | 24 | if(count($matA[0]) != count($matB)){ 25 | echo '

Incompatible Matrices

'; 26 | exit(0); 27 | } 28 | 29 | // Multiplying two matrices 30 | for($i = 0; $i < count($matA); $i++){ 31 | for($j = 0; $j < count($matB[0]); $j++){ 32 | $res[$i][$j] = 0; 33 | for($k=0; $k < count($matB); $k++){ 34 | $res[$i][$j] = $res[$i][$j] + $matA[$i][$k]*$matB[$k][$j]; 35 | } 36 | } 37 | } 38 | 39 | echo '

Matrix A:

'; 40 | print_matrix($matA); 41 | echo '

Matrix B

'; 42 | print_matrix($matB); 43 | echo '

Matrix A X B

'; 44 | print_matrix($res); 45 | ?> 46 | 47 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-08_d/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Matrix Addition 5 | 6 | 7 | '; 15 | for($i=0; $i"; 20 | } 21 | echo ''; 22 | } 23 | 24 | // Compatibility condition for addition 25 | if((count($matA) != count($matB)) || (count($matA[0]) != count($matB[0]))){ 26 | echo '

Incompatible Matrices

'; 27 | exit(0); 28 | } 29 | 30 | // Adding two matrices 31 | for($i = 0; $i < count($matA); $i++){ 32 | for($j = 0; $j < count($matA[0]); $j++){ 33 | $res[$i][$j] = $matA[$i][$j] + $matB[$i][$j]; 34 | } 35 | } 36 | 37 | echo '

Matrix A:

'; 38 | print_matrix($matA); 39 | echo '

Matrix B

'; 40 | print_matrix($matB); 41 | echo '

Matrix A + B

'; 42 | print_matrix($res); 43 | ?> 44 | 45 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-09/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Pattern Matching using Python 4 | 5 | 6 | Statement is: '.$match[4].''; 10 | echo '

Word that end with xas: '.$match[0].'

'; 11 | echo '

Word that Starts with k and ends with s(Case Insensitive): '.$match[1].'

'; 12 | echo '

Word that starts with M and ends with s: '.$match[2].'

'; 13 | echo '

Word that end with a: '.$match[3].'

'; 14 | ?> 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /sem-7/computer_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-09/match.py: -------------------------------------------------------------------------------- 1 | import re 2 | states = "Mississippi Alabama Texas Massachusetts Kansas" 3 | # Split the sentence into words 4 | statesArr = states.split() 5 | statesLists = list() 6 | for val in statesArr: 7 | if(re.search('xas$',val)): 8 | statesLists.append(val) 9 | for val in statesArr: 10 | if(re.search('^k.*s$',val,re.I)): 11 | statesLists.append(val) 12 | for val in statesArr: 13 | if(re.search('^M.*s$',val)): 14 | statesLists.append(val) 15 | for val in statesArr: 16 | if(re.search('a$',val)): 17 | statesLists.append(val) 18 | for val in statesLists: 19 | print(val) 20 | print(states) -------------------------------------------------------------------------------- /sem-7/electronics_and_communication/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-7/electronics_and_communication/.gitkeep -------------------------------------------------------------------------------- /sem-7/information_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-7/information_science/.gitkeep -------------------------------------------------------------------------------- /sem-7/information_science/15CSL76_MACHINE_LEARNING_LABORATORY/Datasets/EnjoySport.csv: -------------------------------------------------------------------------------- 1 | slno,sky,airTemp,humidity,wind,water,forecast,enjoySport 2 | 1,sunny,warm,normal,strong,warm,same,yes 3 | 2,sunny,warm,high,strong,warm,same,yes 4 | 3,rainy,cold,high,strong,warm,change,no 5 | 4,sunny,warm,high,strong,cool,change,yes 6 | -------------------------------------------------------------------------------- /sem-7/information_science/15CSL76_MACHINE_LEARNING_LABORATORY/Datasets/PlayTennis.csv: -------------------------------------------------------------------------------- 1 | ,Outlook,Temperature,Humidity,Wind,PlayTennis 2 | 0,Sunny,Hot,High,Weak,No 3 | 1,Sunny,Hot,High,Strong,No 4 | 2,Overcast,Hot,High,Weak,Yes 5 | 3,Rain,Mild,High,Weak,Yes 6 | 4,Rain,Cool,Normal,Weak,Yes 7 | 5,Rain,Cool,Normal,Strong,No 8 | 6,Overcast,Cool,Normal,Strong,Yes 9 | 7,Sunny,Mild,High,Weak,No 10 | 8,Sunny,Cool,Normal,Weak,Yes 11 | 9,Rain,Mild,Normal,Weak,Yes 12 | 10,Sunny,Mild,Normal,Strong,Yes 13 | 11,Overcast,Mild,High,Strong,Yes 14 | 12,Overcast,Hot,Normal,Weak,Yes 15 | 13,Rain,Mild,High,Strong,No 16 | -------------------------------------------------------------------------------- /sem-7/information_science/15CSL76_MACHINE_LEARNING_LABORATORY/Datasets/document.csv: -------------------------------------------------------------------------------- 1 | 2 | I love this sandwich,pos 3 | This is an amazing place,pos 4 | I feel very good about these beers,pos 5 | This is my best work,pos 6 | What an awesome view,pos 7 | I do not like this restaurant,neg 8 | I am tired of this stuff,neg 9 | I can't deal with this,neg 10 | He is my sworn enemy,neg 11 | My boss is horrible,neg 12 | This is an awesome place,pos 13 | I do not like the taste of this juice,neg 14 | I love to dance,pos 15 | I am sick and tired of this place,neg 16 | What a great holiday,pos 17 | That is a bad locality to stay,neg 18 | We will have good fun tomorrow,pos 19 | I went to my enemy's house today,neg -------------------------------------------------------------------------------- /sem-7/information_science/15CSL76_MACHINE_LEARNING_LABORATORY/Datasets/finance.csv: -------------------------------------------------------------------------------- 1 | slno,Refund,MaritalStatus,TaxableIncome,Cheat 2 | 1,Yes,Single,M,No 3 | 2,No,Married,L,No 4 | 3,No,Single,L,No 5 | 4,Yes,Married,M,No 6 | 5,No,Divorced,L,Yes 7 | 6,No,Married,L,No 8 | 7,Yes,Divorced,H,No 9 | 8,No,Single,L,Yes 10 | 9,No,Married,L,No 11 | 10,No,Single,L,Yes 12 | -------------------------------------------------------------------------------- /sem-7/information_science/15CSL76_MACHINE_LEARNING_LABORATORY/play_tennis.csv: -------------------------------------------------------------------------------- 1 | outlook,temp,humidity,wind,play 2 | Sunny,Hot,High,Weak,No 3 | Sunny,Hot,High,Strong,No 4 | Overcast,Hot,High,Weak,Yes 5 | Rain,Mild,High,Weak,Yes 6 | Rain,Cool,Normal,Weak,Yes 7 | Rain,Cool,Normal,Strong,No 8 | Overcast,Cool,Normal,Strong,Yes 9 | Sunny,Mild,High,Weak,No 10 | Sunny,Cool,Normal,Weak,Yes 11 | Rain,Mild,Normal,Weak,Yes 12 | Sunny,Mild,Normal,Strong,Yes 13 | Overcast,Mild,High,Strong,Yes 14 | Overcast,Hot,Normal,Weak,Yes 15 | Rain,Mild,High,Strong,No -------------------------------------------------------------------------------- /sem-7/information_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-02/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Squares and Cubes 6 | 7 | 8 | 9 |

Squares and Cubes using JavaScript

10 |
11 |
12 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /sem-7/information_science/15CSL77_WEB_TECHNOLOGY_LABORATORY_WITH_MINI_PROJECT/program-03/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Program for Text Animation 7 | 35 | 36 | 37 | 38 |

39 | Program for Increasing/Decreasing Size of a Text 40 |

41 |

42 | 43 | 44 | -------------------------------------------------------------------------------- /sem-8/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-8/.DS_Store -------------------------------------------------------------------------------- /sem-8/computer_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-8/computer_science/.gitkeep -------------------------------------------------------------------------------- /sem-8/electronics_and_communication/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-8/electronics_and_communication/.gitkeep -------------------------------------------------------------------------------- /sem-8/information_science/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/swaaz/VTU-Lab-Material/30f501b4337109e0139279af27c6b09ca6f618d6/sem-8/information_science/.gitkeep -------------------------------------------------------------------------------- /sem-8/readme.md: -------------------------------------------------------------------------------- 1 | # VTU Lab Material 2 | #### Ever had trouble getting the right VTU lab material to study from? Well look no further here's a collection of all resources required gathered under one roof! 3 | 4 | 5 | # Contributing 6 | To contribute to the project, Please take up the tasks specified in the issues. Add a comment in the issues if you are taking up one. 7 | 8 | ### Instructions 9 | - Fork the repository to your account. 10 | - Copy the clone url of your repository. 11 | - Clone the repository to your machine `git clone https://github.com/YOUR_USER_NAME/VTU-Lab-Material.git` 12 | - Make sure you create a branch with the name as the issue you are working on `git checkout -b YOUR_BRANCH_NAME`, and make sure you are working on the same branch and not the `master`, run `git status` to know which branch you are working on, run `git branch`, your branch will be highlighted with an `*`. If you are not in your branch or want to move to another branch use `git checkout BRANCH_NAME`. 13 | a good branch name should explain what this branch is about eg. `sem-5_CompterSciendce_DBMS` etc. 14 | - Add the upstream url of original repository, follow the instructions [here](https://help.github.com/articles/configuring-a-remote-for-a-fork/) 15 | - Make sure your repository is in sync with the original repository's master branch. Follow the instruction [here](https://help.github.com/articles/syncing-a-fork/) to know how to keep your local repository in sync. 16 | - Finally when you have made the changes, submit a pull request through github from the original repository, choose your branch against the master of original or create a new branch. --------------------------------------------------------------------------------