Skip to main content

Posts

Candidate Elimination Algorithm in Kannada | VTU Machine Learning Lab Pr...

Recent posts

File Structure Lab Manual with Algorithms_Program3

Program 3. Write a program to read and write and student objects with variable-length records using any suitable record structure. Implement pack(), unpack(), modify() and search() methods. Algorithm: Step 1: Start Step 2: Enter the choice            1.Write 2. Display 3. Search 4. Modify 5.Exit            case 1: write() //Read the name, usn, age, sem, branch            case 2: unpack()                        display()            case 3: unpack()                        search()            case 4: unpack()                       search()                        modify() Step 3: Stop Algorithm: write() Step 1: Start Step 2: Enter the name, usn, age, sem, branch Step 3: call pack(t) function Step 4: Stop Algorithm: pack(t) Step 1: Start Step 2: Open a file hello.txt Step 3: copy the strings- name, usn, age, branch and concatenate in buffer Step 4: Now read length of buffer -strlen(buffer) Step 5: close a file Step 6: Stop Algorithm: unpack() Step 1: Start

File Structure Lab Manual with Algorithms_Program2

Prg2. Write a program to read and write and student objects with fixed-length records and the fields delimited by “|”. Implement pack(), unpack(),modify() and search() methods. Algorithm: Step 1: Start Step 2: Enter the choice            1.Write 2. Display 3. Search 4. Modify 5. Exit             case 1: write() //Read the name, usn, age, sem, branch             case 2: unpack()                         display()             case 3: unpack()                         search()             case 4: unpack()                         search()                         modify() Step 3: Stop Algorithm: write() Step 1: Start Step 2: Enter the name, usn, age, sem, branch Step 3: call pack(t) function Step 4: Stop Algorithm: pack(t) Step 1: Start Step 2: Open a file hello.txt Step 3: copy the strings- name, usn, age, branch and concatenate in buffer Step 4: Now read length of buffer -strlen(buffer) Step 5: close a file Step 6: Stop Algorithm: unpack() Step 1: Start S

File Structure Lab Manual with Algorithms_Program1

Program 1. Write a program to read series of names, one per line, from standard input and  write these names spelled in reverse order to the standard output using I/O  redirection and pipes. Repeat the exercise using an input file specified by the user  instead of the standard input and using an output file specified by the user instead of  the standard output. _ Algorithm: Step 1: Start Step 2: Enter your choice 1. From standard I/O 2. From Files Step 3: Select the choice- 1: Using Standard file 2: Using Files             Case 1: [using standard I/O]                          Enter the number of names to be read                          Read the value of N                          a. Read one name at a time                          b. call reverse(name) function                          display the reversed name on standard output                          Repeat a and b for N times             Case 2: [Using Files]                           Open the file for reading  

Write a program for congestion control using leaky bucket algorithm

import java.util.*; public class LBA {        public static void main(String[] args ) {              // TODO Auto-generated method stub              int op ;              Scanner s = new Scanner(System. in );              int bktcap =0;              int remain =0;              int pkt []= new int [10];              System. out .println( "Enter Bucket size" );              bktcap = s .nextInt();              System. out .println( "Enter value n" );              int n = s .nextInt();              System. out .println( "Enter datarate" );              int dr = s .nextInt();              System. out .println( "Enter input values" );              for ( int i =0; i < n ; i ++){              int val = s .nextInt();              pkt [ i ]= val ;              }              for ( int i =0; i <= n ; i ++){                     int total = pkt [ i ]+ remain ;                     if ( t

Write a program for simple RSA algorithm to encrypt and decrypt the data.

import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.*; public class RSA{        public static void main(String[] args) {              // TODO Auto-generated method stub              Scanner s=new Scanner(System.in);              RSA r=new RSA();              System.out.println("Enter value for p");              int p=s.nextInt();              System.out.println("Enter value for q");              int q=s.nextInt();              int n=(p*q);              int fai=((p-1)*(q=1));               System.out.println("Enter value for e");              int e=s.nextInt();                           while(true) {                     if(GCD(fai,e)!=1) {                            System.out.println("Enter value for e"