Sei sulla pagina 1di 109

Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1.
a) Create a Java class called Student with the following details as variables within it.
(i) USN
(ii) Name
(iii) Branch
(iv) Phone
Write a Java program to create n Student objects and print the USN, Name,
Branch, and Phone of these objects with suitable headings :-

import java.util.Scanner;
class Student
{
String usn,name,branch,phone;
void read()
{
Scanner input=new Scanner(System.in);
System.out.println("Enter the USN,Name,Branch,Phone");
usn=input.next();
name=input.next();
branch=input.next();
phone=input.next();
}
void display()
{
System.out.println(usn+"\t"+name+"\t"+branch+"\t"+phone);
}
}
public class Pgm1a
{
public static void main(String[] args)
{
int n;
Scanner input=new Scanner(System.in);
System.out.println("Enter the number of students:-");
n=input.nextInt();
Student [] s=new Student[n];
for(int i=0;i<=n-1;i++)
{
s[i]=new Student();
s[i].read();
}
for(int i=0;i<=n-1;i++)
{

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 1


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

s[i].display();
}
}
}

-:OUTPUT:-

Enter the number of students:-


3

Enter the USN,Name,Branch,Phone


4gk16cs406 Prabhakar Cse 9988665522

Enter the USN,Name,Branch,Phone


4gk15cs053 Vikram Cse 9998882221

Enter the USN,Name,Branch,Phone


4gk16cs405 Nikhil Cse 8887774441

4gk16cs406 Prabhakar Cse 9988665522


4gk15cs053 Vikram Cse 9998882221
4gk16cs405 Nikhil Cse 8887774441

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 2


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

b) Write a Java program to implement the Stack using arrays. Write Push(), Pop(),
and Display() methods to demonstrate its working :-

import java.util.*;
class Pgm1b
{
public static int top=-1;
public static int size=4;
public static int s[]=new int [size];
public static void main(String[] args)
{
int choice;
Scanner input=new Scanner(System.in);
while(true)
{
System.out.println("\n 1.PUSH\n 2.POP\n 3.DISPLAY\n4.EXIT");
System.out.println("Enter your choice:-");
choice=input.nextInt();
switch(choice)
{
case 1:push();
break;
case 2:pop();
break;
case 3:display();
break;
default:System.exit(0);
}
}
}
public static void push()
{
int elem;
if(top==size-1)
{
System.out.println("Stack is Overflow, Stack is full");
}
else
{
Scanner input=new Scanner(System.in);
System.out.print("Enter an element tobe pushed:- ");
elem=input.nextInt();
top=top+1;
s[top]=elem;

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 3


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
}
public static void pop()
{
if(top==-1)
{
System.out.println("Stack is Underflow, Stack is empty");
}
else
{
System.out.print("Deleted element is:- "+ s[top]);
top=top-1;
}
}
public static void display()
{
int i;
if(top==-1)
{
System.out.println("Display is not possible");
}
else
{
System.out.print("Stack elements are:- ");
for(i=0;i<=top;i++)
{
System.out.print(+s[i] + "\t");
}
}
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 4


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
1
Enter an element tobe pushed:- 10

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
1
Enter an element tobe pushed:- 20

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
1
Enter an element tobe pushed:- 30

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
1
Enter an element tobe pushed:- 40

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
1
Stack is Overflow, Stack is full

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 5


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
1
Stack is Overflow, Stack is full

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
3
Stack elements are:-10 20 30 40

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
2
Deleted element is:- 40

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
2
Deleted element is:- 30

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
2
Deleted element is:- 20

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 6


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
2
Deleted element is:- 10

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
2
Stack is Underflow, Stack is empty

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
3
Display is not possible

1.PUSH
2.POP
3.DISPLAY
4.EXIT
Enter your choice:-
4

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 7


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2.
a) Design a super class called Staff with details as Staff Id, Name, Phone, Salary.
Extend this class by writing three subclasses namely Teaching (domain,
publications), Technical(skills), and Contract(period). Write a Java program to
read and display at least 3 staff objects of all three categories :-

import java.util.*;
class Staff
{
int staffid;
float salary;
String name;
long phone;
Staff(int staffid,String name, long phone,float salary )
{
this.staffid=staffid;
this.salary=salary;
this.name=name;
this.phone=phone;
}
void display()
{
System.out.println("Staff ID:"+this.staffid);
System.out.println("Name:"+this.name);
System.out.println("Phone:"+this.phone);
System.out.println("Salary:"+this.salary);
}

}
class Teaching extends Staff
{
String domain, publication;
Teaching(int staffid,String name,long phone,float salary,String dom,String
pub)
{
super(staffid,name,phone,salary);
domain=dom;
publication=pub;
}
void displayTeach()
{
System.out.println("Domain:"+domain);
System.out.println("Publication:"+publication);

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 8


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

System.out.println("-----------------------------");
}
}
class Technical extends Staff
{
String skills;
Technical(int staffid,String name,long phone,float salary,String skill)
{
super(staffid,name,phone,salary);
skills=skill;
}
void displayTechnical()
{
System.out.println("Skils:- "+skills);
System.out.println("-----------------------------");
}
}

class Contract extends Staff


{
int period;
Contract(int staffid,String name,long phone,float salary,int per)
{
super(staffid,name,phone,salary);
period=per;
}
public void displayCont()
{
System.out.println("Period:- "+period);
System.out.println("-----------------------------");
}
}
public class Pgm2a
{
public static void main(String[] args)
{
int choice,n,staffid,period;
float salary;
long phone;
String name,domain,publication,skill;
do
{
System.out.println("Enter your category:- 1. Teaching, 2. Technical.
3.Contract");

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 9


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

Scanner sobj=new Scanner(System.in);


choice=sobj.nextInt();
switch(choice)
{
case 1: System.out.println("Enter the number of teachers staff
minimum 3:-");
n=sobj.nextInt();
Teaching[] te=new Teaching[n];
for(int i=0;i<te.length;i++)
{
System.out.println("Enter staffid, Name, Phone, salary ,
domain and Publications");
staffid=sobj.nextInt();
name=sobj.next();
phone=sobj.nextLong();
salary=sobj.nextFloat();
domain=sobj.next();
publication=sobj.next();
te[i]=new
Teaching(staffid,name,phone,salary,domain,publication);
}
for(int i=0;i<te.length;i++)
{
te[i].display();
te[i].displayTeach();

}
break;
case 2: System.out.println("Enter the number of
technical staff minimum 3:-");
n=sobj.nextInt();
Technical[] tech=new Technical[n];
for(int i=0;i<tech.length;i++)
{
System.out.println("Enter staffid, Name, Phone, salary , and
Skills");
staffid=sobj.nextInt();
name=sobj.next();
phone=sobj.nextLong();
salary=sobj.nextFloat();
skill=sobj.next();

tech[i]=new Technical(staffid,name,phone,salary,skill);
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 10


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

for(int i=0;i<tech.length;i++)
{
tech[i].display();
tech[i].displayTechnical();
}
break;
case 3: System.out.println(" Enter the number of contract staff
minimum 3:-");
n=sobj.nextInt();
Contract[] con=new Contract[n];for(int i=0;i<con.length;i++)
{
System.out.println("Enter staffid, Name, Phone, salary ,and
period");
staffid=sobj.nextInt();
name=sobj.next();
phone=sobj.nextLong();
salary=sobj.nextFloat();
period=sobj.nextInt();

con[i]=new Contract(staffid,name,phone,salary,period);
}
for(int i=0;i<con.length;i++)
{
con[i].display();
con[i].displayCont();
}
break;
default: System.out.println("Invalid option");
}
}
while(choice!=4);
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 11


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter your category:- 1. Teaching, 2. Technical. 3.Contract


1
Enter the number of teachers staff minimum 3:-
3
Enter staffid, Name, Phone, salary , domain and Publications
410 Venkatesh 8882288822 50000 daa css
Enter staffid, Name, Phone, salary , domain and Publications
120 pavitra 9845385521 20000 java ssp
Enter staffid, Name, Phone, salary , domain and Publications
222 preethi 9988664422 25000 se swapna
Staff ID:410
Name:Venkatesh
Phone:8882288822
Salary:50000.0
Domain:daa
Publication:css
-----------------------------
Staff ID:120
Name:pavitra
Phone:9845385521
Salary:20000.0
Domain:java
Publication:ssp
-----------------------------

Staff ID:222
Name:preethi
Phone:9988664422
Salary:25000.0
Domain:se
Publication:swapna
-------------------------------------------------------------------------------------------------------

Enter your category:- 1. Teaching, 2. Technical. 3.Contract


2
Enter the number of technical staff minimum 3:-
3

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 12


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

Enter staffid, Name, Phone, salary , and Skills


408 Shrikanth 778899554411 28000 program
Enter staffid, Name, Phone, salary , and Skills
212 Kumar 8866442211 35000 testing
Enter staffid, Name, Phone, salary , and Skills
110 Sahithya 7766446699 42000 coding
Staff ID:408
Name:Shrikanth
Phone:778899554411
Salary:28000.0
Skils:- program
-----------------------------
Staff ID:212
Name:Kumar
Phone:8866442211
Salary:35000.0
Skils:- testing
-----------------------------
Staff ID:110
Name:Sahithya
Phone:7766446699
Salary:42000.0
Skils:- coding
-------------------------------------------------------------------------------------------------------

Enter your category:- 1. Teaching, 2. Technical. 3.Contract


3
Enter the number of contract staff minimum 3:-
3
Enter staffid, Name, Phone, salary ,and period
369 Manu 8574632109 15000 2

Enter staffid, Name, Phone, salary ,and period


786 Shwetha 9383735373 26000 1
Enter staffid, Name, Phone, salary ,and period
246 Sunil 7845126589 55000 4
Staff ID:369
Name:Manu
Phone:8574632109
Salary:15000.0

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 13


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

Period:- 2
-----------------------------
Staff ID:786
Name:Shwetha
Phone:9383735373
Salary:26000.0
Period:- 1
-----------------------------
Staff ID:246
Name:Sunil
Phone:7845126589
Salary:55000.0
Period:- 4
-------------------------------------------------------------------------------------------------------

Enter your category:- 1. Teaching, 2. Technical. 3.Contract

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 14


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

b) 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 < name, dd/mm/yyyy> and display as < name, dd, mm, yyyy>
using String To kenizer class considering the delimiter character as “/” :-

import java.util.Scanner;
import java.util.StringTokenizer;
class Customer
{
String cname,dob;
Scanner sobj=new Scanner(System.in);
void read()
{
System.out.println("Enter Customer name:");
cname=sobj.next();
System.out.println("Enter Customer DOB in the format dd/mm/yyyy");
dob=sobj.next();
}
void display()
{
StringTokenizer st = new StringTokenizer(dob, "/");
System.out.println(cname);
while (st.hasMoreTokens())
{
String s = st.nextToken();
System.out.print(s+"-");
}
}
}
public class Pgm2b
{
public static void main(String[] args)
{
Customer cobj=new Customer();
cobj.read();
System.out.println("Customer Details.................");
cobj.display();
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 15


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter Customer name:


Kumar
Enter Customer DOB in the format dd/mm/yyyy
04/12/1993
Customer Details.................
Kumar
04-12-1993-

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 16


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3.
a) Write a Java program to read two integers a and b. Compute a/band print,
when b is not zero. Raise an exception when b is equal to zero :-

import java.util.*;
public class Pgm3a
{
public static void main(String[] args)
{
int a,b;
float c;
try
{
Scanner input=new Scanner(System.in);
System.out.print("Enter the value of a :-");
a=input.nextInt();
System.out.print("Enter the value of b :-");
b=input.nextInt();
c=a/b;
System.out.println("Result = "+c);
}
catch(ArithmeticException e)
{
System.out.println("Divide by zero error");
}
}
}

-:OUTPUT:-

Enter the value of a :- 10


Enter the value of b :- 2
Result = 5.0

-------------------------------------------------------------------------------------------------------

Enter the value of a :- 10


Enter the value of b :- 0
Divide by zero error

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 17


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

b) Write a Java program that implements a multi-thread application that has three
threads. First thread generates a random integer for every 1 second; second
thread computes the square of the number and prints; third thread will print
the value of cube of the number :-

import java.util.*;
public class Pgm3b
{
static int randomInteger;
public static void main(String args[])
{
System.out.println("For 10 random numbers :-");
mythread thread=new mythread();
thread.start();
}
}
class mythread extends Thread
{
public void run()
{
int i=0;
try
{
while(i<10)
{
Random rand=new Random();
Pgm3b.randomInteger=rand.nextInt(100);
System.out.println("Random integer is :- " + Pgm3b.randomInteger);
new mythread2().start();
new mythread3().start();
Thread.sleep(1000*1);
System.out.println();
}
}
catch(InterruptedException exception)
{
exception.printStackTrace();
}
}
}
class mythread2 extends Thread
{
public void run()

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 18


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

{
System.out.println("Square of " +Pgm3b.randomInteger + " is "
+ Pgm3b.randomInteger * Pgm3b.randomInteger);
}
}
class mythread3 extends Thread
{
public void run()
{
System.out.println("Cube of " +Pgm3b.randomInteger + " is "
+ Pgm3b.randomInteger * Pgm3b.randomInteger);
}
}

-:OUTPUT:-

For 10 random numbers :-

Random integer is :- 15
Square of 15 is 225
Cube of 15 is 225

Random integer is :- 65
Square of 65 is 4225
Cube of 65 is 4225

Random integer is :- 89
Square of 89 is 7921
Cube of 89 is 7921

Random integer is :- 62
Square of 62 is 3844
Cube of 62 is 3844

Random integer is :- 25
Square of 25 is 625
Cube of 25 is 625

Random integer is :- 59
Square of 59 is 3481
Cube of 59 is 3481

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 19


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

Random integer is :- 31
Square of 31 is 961
Cube of 31 is 961

Random integer is :- 75
Square of 75 is 5625
Cube of 75 is 5625

Random integer is :- 26
Square of 26 is 676
Cube of 26 is 676

Random integer is :- 34
Square of 34 is 1156
Cube of 34 is 1156

Random integer is :- 73
Square of 73 is 5329
Cube of 73 is 5329

Random integer is :- 29
Square of 29 is 841
Cube of 29 is 841

Random integer is :- 9
Square of 9 is 81
Cube of 9 is 81

Random integer is :- 52
Square of 52 is 2704
Cube of 52 is 2704

Random integer is :- 95
Square of 95 is 9025
Cube of 95 is 9025

Random integer is :- 56
Square of 56 is 3136
Cube of 56 is 3136

Random integer is :- 82
Square of 82 is 6724
Cube of 82 is 6724

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 20


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4. Sort a given set of n integer elements using Quick Sort method


and compute its time complexity. Run the program for varied values
of n> 5000 and record the time taken to sort. Plot a graph of the time
taken versus non graph sheet. The elements can be read from a file or
can be generated using the random number generator. Demonstrate
using Java how the divide and-conquer method works along with its
time complexity analysis: worst case, average case and best case :-

import java.util.Random;
import java.util.Scanner;
import java.util.*;
public class Pgm4
{
public static void main(String args[])
{
int i,n,min=0,max=6000000;
int a[];
Scanner input=new Scanner(System.in);
System.out.println("Enter the no. of elements :- ");
n=input.nextInt();
a=new int [n];
Random rand=new Random();
for(i=0;i<=n-1;i++)
{
int number=rand.nextInt((max-min)+1)+min;
a[i]=number;
}
System.out.println("Enter the Elements are :- ");
for(i=0;i<=n-1;i++)
{
System.out.print(a[i] +"\t");
}
long start=System.currentTimeMillis();
for(long k=1;k<1000;k++)
quicksort(a,0,n-1);
long end=System.currentTimeMillis();
float time=(end-start);
System.out.println();
System.out.println("The sorted array is shown below :- ");
for(i=0;i<=n-1;i++)
{
System.out.print(a[i]+"\t");

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 21


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
System.out.println();
System.out.println("Time = " +time);
}
public static void quicksort(int a[],int low,int high)
{
int j;
if(low<high)
{
j=partition(a,low,high);
quicksort(a,low,j-1);
quicksort(a,j+1,high);
}
}
public static int partition(int a[],int low,int high)
{
int i,j;
boolean b;
int key,temp;
b=true;
key=a[low];
i=low+1;
j=high;
while(b)
{
while(i<high && a[i]<key)
i++;
while(a[j]>key)
j--;
if(i<j)
{
temp=a[i];
a[i]=a[j];
a[j]=temp;
}
else
{
temp=a[low];
a[low]=a[j];
a[j]=temp;
return j;
}
}
return 0;

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 22


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
}

-:OUTPUT:-

Enter the no. of elements :-


5000
Enter the Elements are :-
4738259 1880387 5959261 2878737 1516199 1601368
863064 399184 2496861 3362950 844721 5886213
2722438 2397468 1225555 3357741 2398284 3136508
1684561 1170624 1450189 974242 2352731 2679384
3146327 3506440 4739600 1060354 3457526 1537843
2305149 3174131 2526190 2096200 5551772 2763552
1296106 210693 1926910 5276648 1975281 875235
1492053 5223149 3200377 4789272 5908911 5127329
2988812 4666912 2595679 4580352 1688135 603550
5479485 1652627 303960 1617962 4461922 991838
105959 1744869 4985886 610242 5210969 4603690
3255751 3202406 5892092 543523 2787814 2328640
4333692 435666 3993425 5615810 3235482 3534758
4465008 5844293 561580 1310938 2097003 2518679
1150062 4262373 1941309 4192947 2260923 2515319
3489388 2058588 2924643 2022229 2117661 1439722
2815340 929477 5348616 2094803 1232915 2174795
4567254 1757844 944298 871221 5567301 3391091
4429378 5586169 3710601 3399812 4887035 4443651
839068 2742679 4833995 3299087 559093 3534524
5906357 2155175 110855 2120264 2550215 2979767
2373923 1813749 1806166 2593957 3743948 1839840
354396 1806700 3482182 1248309 5090957 1049676
1752342 3580405 2305879 1443835 5210924 3721369
2454163 2171851 2433399 754358 3940412 4204086
5120061 5632277 2679014 474882 2668101 5530777
1789714 1965286 5102749 3056247 2773979 1710735
1632759 5094987 5792084 2699516 3911956 5864967
128106 3377587 4607224 26126 5788180 4848290
5117260 892410 3683736 5270283 864318 4491955
3854534 601417 5337446 5256784 1795756 718061
4000477 497985 5621743 4532973 253275 2961219

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 23


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5516544 3641553 3272258 5738670 5947772 5040814


1609437 3967550 2696542 83839 2127724 352795
2277905 1992505 2555561 2185558 1120643 156068
3685838 266762 5324845 1821237 367915 208063
2447059 3348291 3790013 5592717 315546 4165284
5582556 5769373 3995773 1194900 5819174 2413676
3949585 3245405 985950 5744202 5075129 2137908
1401150 4455908 1824170 215254 1485491 3519461
1812772 5302306 648102 5493156 4648972 3270397
1394630 1846561 1825133 2717026 5919347 5199717
1211889 3320443 932861 454576 5419645 4665659
4955236 1400291 5399901 5781155 1776114 889483
2214496 4430242 2001130 4198046 3223258 1526375
4620541 1878785 5381784 5170672 1596555 2743453
5627206 5336367 4418782 3012069 977807 903996
2765113 1804698 622445 1738670 539205 5320462
3656252 4141118 5579527 4126676 3987714 1569792
1933225 887392 3564549 5113114 5363310 785291
148885 121582 1539672 3108680 1414795 242386
2240332 573915 5875790 3914969 3145384 4792425
2892662 4581140 5900961 4042870 679786 3027820
3385335 3955511 2969050 1257525 349930 2871891
2633558 3253610 308701 1838965 2323683 1104591
4859755 2844548 5324142 4494241 5861768 4387720
3066334 5437319 3281500 5594736 2268684 3485449
4160700 5040486 2455626 5784166 5985468 4084919
5534470 3610776 2613756 324708 5532065 2521073
3711832 335513 2446193 1573083 5654379 3545017
1716865 5463553 2328279 5691694 2165086 3033150
182172 3644690 4833617 5381855 1614714 3366132
5036208 4056908 2988567 722861 4400390 5914695
3189542 3288001 5240732 1771098 3977322 3373802
3850075 4998213 1030869 651279 791104 1659141
2951198 3711361 4365969 1739864 1636630 323282
3435460 172811 3546882 1183578 4568707 5109393
5635631 2262223 351075 3827900 2938587 2207897
4932046 401092 2154028 3381886 4048841 5601327
5339164 1299814 1696933 914145 5191929 1841839
4778926 1664948 386278 58016 1240083 5496532
5760593 2634602 3165979 3212782 5959819 5340293
4941419 1156780 3708594 5918830 863287 5063122
5572767 4663578 471587 5496116 2556899 5450270
2978512 2224740 1074697 3185274 3706043 4826171
3540840 1024171 3276036 2567870 3040630 2000913

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 24


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2454628 5365275 3654087 3399725 4502151 5747466


593796 1926407 770279 383923 3940381 4272484
5384773 3823341 2788693 5806115 3250069 5297194
4642884 4482312 1207052 5518166 853162 5945149
2157111 4186233 2672491 1725365 976591 5513239
2974235 3159021 359980 2288567 4814873 713
4476626 5192256 711579 5363527 5552154 5895049
1873415 4757263 5493964 182824 267190 2592953
4049716 1161564 3945288 3106845 5599781 2536340
4116176 4120391 516767 2822528 5232477 1827652
2851584 3588400 4273456 1808680 36785 894166
581917 1252668 5785475 1981240 3089749 509641
1187 263394 2495885 4636005 4542532 3644169
2251008 1173273 4989305 4973819 4272527 2331823
2042558 5147090 115088 4890364 768495 4524688
2026346 3923257 3044785 3004862 861112 2523188
2995898 5560709 5982584 5320455 3687526 4090618
2777845 3213837 1527258 3582865 2689246 5504196
5577026 4928560 202766 628351 2373998 5218048
2877315 5844542 3982570 3144962 5634219 5335691
2508332 5685706 2258393 2903770 290624 1749861
2814825 4961263 3504126 1536794 3345884 3557951
2508450 1776970 4240845 1466425 2575420 5604039
4837010 2722841 3654979 5799377 4501889 4219130
3315449 2804221 3715460 5014924 5757764 3921144
4886654 2896653 4659233 4745331 3747777 2597361
491698 194147 4084974 3034366 4751993 1709071
4339582 1012645 4095956 2263322 3705721 2491740
5389552 662262 4388290 1330561 126062 5554562
5517618 1480798 4657835 5569326 3138487 2624333
1938030 450015 2948175 940298 2856664 5530299
1582573 353645 1729836 4069284 3731289 1615196
1295332 1643508 175891 3916702 3076780 4156414
5555229 4790832 3063357 4986737 5629484 5884301
4914475 4009525 3796158 5128654 3063781 2844442
4561137 5206542 2013987 3691392 5643506 4180925
4359068 471761 3111230 5150247 232189 5708976
1996108 1505360 801623 2323752 3538626 1753950
3093536 1343430 2684065 4083442 5979097 2618362
825188 172225 5227908 2453734 2999742 2656982
2056258 5613820 4664364 2561031 3092023 2198395
4384872 5780539 2819040 2615768 4113241 125432
2167052 3353021 105599 1117325 2155674 1116188
419739 47694 2925737 764992 815016 2855616

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 25


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

15778 5160364 5665362 836055 3390789 3630300


3660000 5988128 1313561 1368827 2549758 763730
1368777 966748 395755 3946404 3394113 5710202
960898 1958669 38914 1660665 1932927 3332576
1104339 4377440 5499637 5668436 4115989 1012419
5971502 5391207 3359398 2115935 5199345 4582661
2149868 5619580 1358822 5082698 4965224 4601327
1978615 5410745 5161327 1260223 3643656 3236438
3003502 1402130 5692540 4904685 3419180 743614
169374 5999137 3602894 2638657 2666313 5083310
266195 3964442 4206375 3479115 2961998 1647105
1728182 3307881 5735072 1159534 2133649 2156906
1454169 408561 965775 4792215 4330275 3393775
1791340 4203967 5099708 510310 3551399 5442437
2313686 2458488 107440 4437804 1202937 2817076
4110322 2306246 3798005 5085345 3502785 2364136
2769439 2863122 2033386 4389862 5777576 312254
1398980 3995364 3277805 5096395 102897 20750
1971065 3048929 391476 1506526 3213317 5664600
4598036 5997859 391952 3183622 911231 2513634
2040943 1962539 5737200 4156786 3785476 193005
1023203 2999252 5726879 5112633 4717185 5109527
5510578 3269756 3292837 3651125 4817535 2805318
5237109 1473026 3014918 5379763 1233419 4803894
46080 1886837 238239 4314936 1953487 3855315
5282894 1266269 2451870 4681679 2705862 5736321
5951198 5338225 3630764 4474688 5236759 5388936
1061720 3474503 5544525 639623 2706546 5590807
4497084 5450981 5529477 702649 1481011 5234679
3416694 53321 3404033 538645 5958194 1833715
3072024 4105394 2348994 3138947 116602 4747452
1734329 5863392 4451859 2321068 3758772 4231698
4127147 2222317 2267096 3103336 2374894 2702825
5472117 4226954 5545964 1921436 1218474 733046
5221836 5235618 1026477 1660840 3995079 1277531
1424977 3716644 610498 1457705 2110022 2666076
5451407 568848 4048121 4009180 3243730 1701523
2035819 5936415 5206268 4652041 4591406 829368
3814059 4285054 4400037 1445608 1225416 2971951
1480486 1754767 869933 1322673 4052503 5613318
2783852 4796356 5627238 3948686 964065 4826444
5559723 2893186 397538 5563182 5679537 1325726
4720876 1447159 2742349 1855654 5327387 2802767
2182376 1289373 5499981 2058218 2554546 2392147

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 26


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3309672 3727958 2686107 2210956 3256405 2943382


144190 1704787 3131842 4085768 3439936 3006561
1850841 2121762 5003007 3421969 5242511 657641
3550249 4108534 5123097 1592003 456336 2520357
3283988 1389357 2615473 4622745 5650702 1676591
2241759 2542964 2688391 4788535 174572 4585554
3370916 1728183 4885089 2060447 730312 943319
2082484 3849059 3647397 4003414 2954602 595587
1641901 2579710 4679266 81474 2297035 3454541
4383065 2787079 2598328 5702951 2915577 2452320
2838038 2980039 5839857 4670224 5437694 1461625
3485623 4022326 4113133 520384 2375045 4008616
1717955 66821 1551604 178991 5973256 2318547
4838620 3392020 3518227 1956703 497351 3323977
4322526 3852288 3054645 2425120 5416106 5250931
3637034 4624012 1554683 766001 2050321 3497146
1126219 3182475 2866629 764274 2563235 3372770
4305565 179731 4142455 4996492 3097582 931028
3512277 4781532 1873713 2118960 4281277 4093177
3099980 2151451 1810521 3271327 839941 4023338
3620830 2365837 1555782 600480 1991274 1645598
812264 1668789 4420770 1412610 1704197 4879696
4604985 1372756 1233225 5158185 1639621 2432530
2227577 2616495 3502030 2617083 3666261 4322560
1839835 3751660 4334059 751660 3777383 5004132
3313303 2347776 2619767 390181 5262668 1325401
539730 3211092 746491 3733917 4352237 3195647
1287347 2047981 5529890 4857731 3914198 3612172
326730 2080183 5859408 4170710 5688622 2085482
4300886 4355565 3834005 293763 803263 1272383
1486311 5175665 691737 860290 4148696 1991736
1270108 92404 5171315 1767794 4319193 4506947
760161 4712965 1656205 3914684 3005908 5999110
84928 1573845 1219374 4273842 3906917 1927372
3688904 4625851 1468742 5012053 5430342 3722904
3006730 4177447 1525201 4412083 894309 5410098
701731 2835576 112589 1249983 1535745 4739153
1900904 1652146 5868976 5281994 2859010 3649982
2012881 580543 4336071 4613145 5717957 1882791
830740 3114337 2859058 2998499 3556631 2500150
904296 416904 5545436 4568244 478326 4808496
4568947 4359259 5700859 4909725 2131921 4945666
1922526 99948 3801938 2889158 4469681 2306957
5979736 5301129 4676660 1153535 5643915 3150936

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 27


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4661005 1618339 2404663 3300774 5535827 2052345


1380340 4440461 4023636 4440525 956588 3911257
2941870 1248981 5381403 5260518 3284886 841714
43141 5969932 4633942 1305377 3938535 2061629
5323439 297333 5831626 3038685 5667526 1799164
2402420 4362421 1801877 5020154 3349373 5331622
5560223 643109 936256 4698663 4257234 3613996
4534628 2980067 606971 5920758 5058660 2746904
5325762 947702 5305468 5408133 1711861 174898
2822566 5427552 4677820 2029855 4857778 2937936
254175 4504923 3463549 546171 5450495 4845470
493001 457569 3192985 3659874 4864043 1377485
5134444 5228323 5363781 2136518 1203343 3247452
2278058 4523825 2714695 755790 5656928 5042558
4760024 4372237 1798923 1463090 871289 1261519
4630819 137378 2888575 1798049 4343997 3116853
4672154 937002 1115250 52593 1178832 2035318
2477709 4025896 2046820 516601 4270383 3926622
2261043 399554 2827567 5539485 4325511 2428995
2004174 5462236 2019877 1156333 855810 237734
1317711 4352201 1793558 5365299 2513219 2993974
2157461 4480020 1067821 1694224 1784886 2943462
1852857 31414 4307237 7661 5683712 4255381
4053601 4498917 4915328 357645 3611770 3807939
4697683 978622 3059521 4406175 1092022 761869
3366535 3470036 5795011 3255764 4948336 977091
1432677 1084287 3196596 2114154 2144911 5923108
1681599 1843514 1328874 2441970 4509376 4737510
4393487 1638762 5535665 687178 1180055 3519397
828753 3826926 4946731 2444123 5716196 364469
844376 5734558 2471034 5571120 5797673 1736969
3853686 1394093 1357416 4340080 1173657 917800
2403240 3906201 77031 4431824 146364 37194
3521631 5392860 628503 4215693 4407201 4116095
1780882 759079 5609665 2681746 3877578 1380063
4654105 3446267 965936 5178767 3154971 5235107
5093141 506997 4353751 3952907 1011912 2038103
3660970 2864210 1744099 650632 2950559 4053347
4683177 1508678 2652265 1526562 899264 3683553
92601 4454587 423577 197945 4279048 1810762
5808576 3343005 5367622 1955462 5357651 3476630
5585531 3318079 4408886 5584784 514756 3706354
1431745 5352165 3123249 4404368 311732 3006861
3314373 3964195 3343017 2622967 3047169 4322321

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 28


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2329026 4228226 559584 525004 1588721 5810151


5627979 5906811 1698733 3068517 5189955 166423
4518510 2636711 4795171 4030027 1323374 26833
293716 5601506 3791568 950895 5249999 5694239
5107811 5482049 1506215 298150 4159089 1358836
2975779 33885 5550488 4653618 449566 626789
4311652 3672706 4157588 1863277 3818527 3714952
389922 4974540 4218608 5363509 3871428 3448753
5187453 1466395 2681559 2226315 4988892 660493
329631 1503560 3421324 1790503 2808384 61603
1038837 2186336 4460443 650478 403458 3191350
5018550 5883127 3038915 3801623 5502484 4090016
1274041 1931020 1715176 1096410 2334518 5890203
5111653 1930309 416730 2954279 2311641 2732804
1691907 5900677 2373539 398718 2232007 5749137
4134648 749460 4525109 13322 2808377 5779418
5391058 5899368 1331982 4084832 4269458 4398151
4341268 4256957 308625 5206068 5041258 1661566
5454944 4948676 3200501 1774555 2613851 1675865
892296 1462531 4143131 2702324 4898859 3357825
5778790 3259602 5842920 4673293 5648279 2623389
2453663 4788381 386757 4974674 2570905 3657475
1506254 197910 286440 2307307 2023424 4278089
4916965 3037647 5448153 3086337 3835650 4270530
4295714 4902932 3788581 332165 2560751 2981619
5810792 4459355 135189 1769127 99125 1226644
4294796 1231149 2668409 4997780 200217 3487872
1640914 5609052 5925831 2913935 1428493 548826
3726335 4207470 5215563 263030 2516918 636928
2892978 63793 216635 4338370 4911338 5170691
2061873 4778905 560592 2419437 2983162 5334728
4634183 512972 2733539 5796275 2751044 2266448
293708 4031834 2743313 3600872 191142 4098797
4825967 4947854 2149712 1092022 4815979 3114987
1387745 5423002 1420289 2946848 5179010 4554949
4017239 2833852 5987985 2919820 4919939 4843761
1932189 1368380 1293769 41619 637397 4299721
5244411 974296 959282 2182235 1549129 3216272
5650768 649700 3051545 1579259 3897617 3155893
3892238 417887 4067935 4870584 2645075 5530245
2154893 5809760 2853836 2894353 1816197 413288
235062 2089798 4635786 295180 5332742 3821671
488580 2129939 2651346 569507 2850682 483577
1216018 2007642 4739070 5722922 12592 3152455

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 29


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

379972 2431801 2538912 5588433 432952 5025640


81388 3297184 2736516 3272798 4715236 415707
4902030 5951830 481643 2315061 5425793 49903
3610309 1651487 2338936 4344128 1073045 1279287
4571051 3883574 5465205 2323375 439999 3299072
5375844 3317518 1222309 4321348 4777039 46427
4203516 1163696 4714445 3923643 734974 3816460
5783791 4771660 4579966 573626 4885198 1485529
1900159 5987203 2934146 3508961 5131267 2461893
2683294 3877747 1240881 4679319 1439999 5059558
208592 685339 1317007 1595581 3230738 2635409
2480168 3183467 4150842 1017706 4805441 1478345
170334 755753 5827992 3081580 2802863 5485619
535976 5130953 1063842 1010246 2286371 4312400
5827411 4635377 1866790 1541082 2179025 298537
3472734 4421227 577861 3553802 3776940 5503405
5712087 5459025 928511 48512 3902712 806037
163721 2333190 3599751 3040081 1692890 2510487
2761696 113212 3160773 1051079 5505599 2042378
1700456 5952846 3332590 2992139 4934581 5759220
5142708 4781427 1333286 786837 3176880 4231961
1497893 712461 5909476 2522857 4499070 3311455
996070 258815 5482559 994821 2513294 2743325
1134178 5099953 95996 483498 1001717 4195916
5302818 466412 5458338 2991910 2786483 129975
673693 3622981 223314 5565311 3692097 390888
2593403 3580618 3371783 4952114 653735 246013
2130331 3847865 1750712 5083475 2729547 2832925
2323192 162024 2537061 1771266 2418620 5549915
577135 3194317 1146715 3507186 4966336 751352
4546197 3672426 4372324 3261815 1072738 4547672
3056015 4149883 4904941 4334437 407657 48893
4106007 659782 4436859 5218679 2088729 1395236
3184163 3246365 904076 1345525 2212722 1892905
2713983 500815 1616231 5239125 5779127 1381229
4869023 2235269 1286600 426085 5396436 3307442
1518129 3619104 3851801 2856581 1087792 4613397
3743824 2743301 3649334 519443 1248840 1920169
442402 5203774 3496525 5142506 2760074 3416739
5962614 5570397 801277 459367 1359132 3404704
2582809 1973236 4641381 2726796 242439 2148738
3141667 1790835 2224434 3307539 3848768 4551012
3678079 2830091 3479695 5776388 2321310 2163313
3184569 2829640 5574436 4831377 2359891 1954632

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 30


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1642632 3108949 1186916 3433634 4537476 1483516


1580888 2187345 617026 3279668 1801938 901236
5884002 1502842 1369546 5715497 5778769 1442525
3446319 4126097 243905 3801338 452032 3036622
5079536 2243673 2097742 2354550 352944 5287047
4304620 2905714 862024 959532 810961 4696731
51896 3191244 3813720 1478063 156261 871560
2513442 1868241 5936029 803342 5997244 5688890
2547750 683654 1760419 109512 772345 830911
2076802 1924308 587960 1174661 1743952 572480
222483 1455476 1877105 3083021 5753163 272520
648474 1854227 4685888 3043889 891947 1190910
419285 2786114 668452 2973582 4397341 4223896
563565 3803501 3053094 2114360 1968630 2857138
3544931 3793765 3791513 5437680 5448559 939682
36521 112836 1260445 544081 3940043 5747399
5138632 327066 5965457 807022 4872801 5923000
2779254 631625 4348979 5021368 82844 3276764
497194 2025608 3403051 230217 4402030 3986736
5095988 5764687 5685389 5818621 5264110 1179746
4366137 193329 2787863 4310982 4838166 2334588
2525503 3014028 428309 847065 1522643 2105339
5759903 487334 826994 5691580 2898320 4822149
2512890 2179681 2302567 272402 3190835 1225482
5911708 1088474 5813546 1720320 4152611 1155686
3907925 5984592 4971715 2092594 434409 3986975
4623667 1787770 3806976 3775676 3638070 955933
4376223 2604124 3699687 1491897 1275420 4106049
3753859 2493361 5140001 3845375 776421 46751
447656 4864920 1011689 3131016 2574189 4790092
3622823 5951548 1810419 3630176 5918990 1546937
2302923 4266549 729892 1155063 5654767 4260225
2222884 4794037 535778 2964735 4535247 2108035
596761 1467511 4378801 5539429 3967298 1885775
4599457 2141270 4886154 1752061 4731423 1753139
779204 2784697 5518285 204460 4857751 4138425
1756471 3940393 2641235 3602002 1811018 319925
2258732 2974678 1225851 4075248 3225863 5781396
5549690 3506897 556590 7939 2935247 1806780
330764 2569940 4491703 3988559 1723624 1833667
3898381 3245799 2163984 1705082 4276228 5348764
1321851 2649395 4405731 3624630 769323 3532402
3689700 2770814 2147939 2458068 5800624 5132143
5864070 3982017 281446 2045862 3480106 5327262

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 31


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

100686 5291231 194899 2221690 3549611 1429064


1697337 5277563 2033188 775732 1985370 3481594
3200494 5467742 5245545 1294515 3015538 846724
4136782 5999021 1822744 2377127 1832480 3836669
4838641 915186 723853 2239320 912230 5458870
5070836 4351197 5859986 4561460 700751 5226565
2572633 2663957 4709250 1907377 2317925 1959214
1697520 4657219 4178344 2029506 3740265 413528
3534961 3610693 2207842 4191050 5989017 1545880
3453682 4937979 5399171 5665207 961071 4442335
2701837 3568841 3962034 4712818 5470497 1398814
751997 435760 2264503 5797941 831270 4177695
4830774 5762139 2368252 1128324 1969629 5832361
16482 1768140 1239070 3471299 3813488 1625052
5956015 1149738 2951725 868236 5292861 4427822
599539 4927152 4507307 4659573 5053462 3117415
4123007 1101428 1164449 3333327 5094935 2012343
937559 2399221 4324716 5149389 4742903 3528740
4494691 3081940 5220116 1130231 4002881 1208925
2389693 2386256 1463498 3433466 306867 4344300
137831 1269079 5553792 1087867 5063041 3135769
203296 4880635 1154265 320961 651178 5204052
109820 2739260 4606618 5481836 5419633 935738
2823198 5207682 3663466 2781544 793324 3610150
4711761 5375332 2593840 2999507 2710622 4541569
1104671 443213 3522720 5505728 5855276 3833933
5468734 5153205 1694701 1701418 4928814 3784492
4595722 5222757 5878462 1076695 5019006 3667199
5837494 4505706 3942237 127647 5890838 1429582
5482267 634895 1767315 1235060 5536452 2713456
5165232 5764044 1384131 11615 332973 4708682
1561649 4522116 2033871 694184 3220178 539196
1337499 5383122 2460527 210685 2816286 4458413
3607732 4025970 3172921 4827829 493642 3256854
5973030 66542 1250170 3801129 4330130 3211715
4935429 3489751 5902277 208437 5692837 3810847
4683875 1187939 4607541 4469742 4588029 5763077
1675480 4552934 3320101 4019322 1189234 2967714
1141449 921721 5953615 4193919 3123305 1103968
1573284 5647699 3483163 4312867 1904207 2311245
3208098 3346858 4268637 4405445 2647418 3022917
291361 2738363 3533533 2350940 4739457 4359000
4497342 960302 5954600 5211280 5487946 3371134
4478134 3055707 2857332 1280367 734096 1006339

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 32


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5120601 1463672 3758458 1110023 5561274 2689525


4427165 1284266 3964905 4096691 4399124 2410811
3516856 346433 3114818 3301549 1802340 1508956
674929 2423045 2596648 693119 1454052 531400
220502 2548785 5840944 24019 5235221 3211542
3716513 3371356 3690044 193311 899888 737508
740192 4379356 1606464 2166507 1674098 825148
3615127 333276 1778542 2642790 3917057 2784802
5822784 2556935 4762254 4772522 2444775 5214721
4611656 3905365 2928799 5434217 3992629 3602867
5289473 1764712 5771390 5457973 5593581 359887
2467657 1211368 4716027 2821239 2535085 4017067
1443445 4567951 5893379 5820300 926573 3728386
1555062 3535348 95212 5101364 615116 637552
5878531 2917103 5288293 21799 3376379 2596841
4293908 5372251 1886546 3918241 197559 2706572
4049815 1820517 5876513 1157707 3087659 4228327
4659182 2959922 2001324 4876089 2793123 1528378
327113 1350969 1072958 1459029 574467 2944876
564005 5300288 2023508 1318567 1050480 5891802
349578 1375496 4247436 5331909 2262965 3490994
766527 1570610 1006044 809105 1565638 3349012
1524141 455811 1831282 4444017 1053395 2097371
1123553 5667449 1493676 1261540 1993064 2668247
1128794 5085731 3632641 5359368 2986637 4438671
3295925 653936 5303103 5886249 4154932 5496961
3727274 3968064 3145488 4731146 4286281 4975533
757021 2175234 4967942 276046 3393473 1086399
3835006 637146 5409077 1475221 3067619 1420812
4139183 3890010 2529620 2007182 3781057 1684943
3072384 3250847 5346724 4665996 54140 2880193
3892827 5944702 5120539 1881985 4273540 2875465
3374917 4652422 1202213 2776505 2266086 4486496
4232751 3457035 5750046 2240631 1544435 3812972
5978130 4282381 5900888 3409156 5780704 2481723
3773964 3222325 1647276 2522464 4318717 4609783
3001906 2943554 2715179 270126 1211492 5074651
3299055 4015383 4076378 2924020 3024151 2278330
4287032 8579 3933192 1480090 339220 5670869
4597274 5858367 1623611 110183 5446497 1838533
1710803 3665229 1315762 5002891 4044787 5899660
4508610 3365957 112946 3547791 792076 4526015
2199831 864343 5120644 3369638 3743575 2439384
5064071 2688425 1398582 652253 4316742 3093076

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 33


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3334787 5891585 1079 2403036 433086 1339247


2443875 4457767 4656355 4806223 4610318 5970212
1085125 662383 3590669 5701374 4097684 408574
1191752 4672009 1503771 4193716 1039400 3819389
5516024 4061096 2290066 4929448 4632064 5588714
4147668 1656144 360880 4812767 2378855 3630207
2281888 5137835 5112966 4795435 790705 4628080
4971456 1596980 702226 857898 4197507 543976
3069947 2311744 4181743 5891292 5056790 333270
1881055 411090 3959669 5291696 5194034 5050081
3107282 5838441 2225618 3135963 3504383 2307207
2073364 5180898 4904349 812349 3852976 813256
2926388 4776216 3174409 183484 1668938 4554355
444121 3319536 364322 114451 4356792 1449666
4554427 4198182 3329685 332210 2883474 3502233
5934062 1055305 2043477 2917250 542097 3972893
297446 2923447 1575462 2499655 610646 4513901
5751430 400518 5264727 3138744 5374696 5047133
4329145 3989530 285894 5392656 1252941 1796838
1702758 1938944 210277 2104943 4764740 5584717
5907320 2871688 5164433 364886 3097899 5765027
2475939 4206031 4220936 4936520 2874929 2119231
5000644 2854476 1017490 3403684 351122 1615138
4384914 1876819 3561767 5322947 3269714 1253427
503893 2138775 2970567 2579457 5212693 3424122
3142521 97983 5273514 4712071 3811596 4474608
3940773 5498281 918500 2831699 1035986 5411297
2460038 5224818 3532019 3174372 3014369 899394
1077935 1691524 2318457 5911513 4684862 1349978
5736026 2674676 638563 963832 3369191 2323320
3490146 4156234 2514674 3922506 5476452 2537801
1537742 5212294 5957369 5612478 538127 1520051
1086350 4254012 5622663 473403 2918281 1819500
1498779 4169754 4893047 4530826 274951 3900633
4108312 4719078 830458 1514594 2064013 591869
4702356 117074 2660601 1637664 4591117 3479997
35623 4903798 600219 5679873 4669741 3108450
5974339 5781052 5629374 4726260 4345275 2843334
2648450 5069946 5076446 2787332 4539298 936370
3842478 1305117 3893184 4627717 5966381 4723904
4554673 4175047 1307566 448379 4490069 5802086
2423278 3927708 570060 4021277 3365145 5306937
1519520 868071 1970753 755937 5903822 5913761
5210707 2122032 169517 978149 3898080 2469279

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 34


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2549754 5763510 608101 796983 5643235 5638401


1613734 314603 4925263 5442978 5855307 5985239
1751090 3906130 1581644 928751 5666523 5759220
4250259 2556922 4169857 4054263 5255243 5874506
3393439 241139 5593030 2323661 4123719 1025434
4921020 3007749 3690281 2137868 5935062 1482861
236251 3323013 5022100 5150211 4703433 4164196
1983981 2532701 1307644 1676869 3487028 5120196
4365318 1806580 872113 5294921 5651699 5760267
674998 587744 243809 291084 2588429 5395330
2415703 104606 128566 936010 191374 771988
1398648 2976164 303972 1577365 2820163 5114033
4376644 4117030 5895286 3598798 1083266 2306583
5269580 53993 1056821 3220172 4589092 5841522
5713033 3133122 1528702 4066553 5391655 4870046
294029 2886669 1750960 1670518 5564332 1371126
4954924 3871776 5159802 2752378 4830911 1066119
65520 2155481 1810206 3685067 3277962 1638621
4136696 3264794 4252142 2478931 4133285 2698616
4484 4811948 5329955 4287298 1775296 5880853
4311465 5559360 1707428 3487426 5484057 4041519
5042192 618440 1156946 3269241 797533 3447008
1859834 5973965 1891882 1961609 4995640 1567769
1777098 4215843 955061 4453717 217961 575079
3433530 4546904 3580512 1929623 5948473 5445014
5828919 4790641 2308317 1186027 1982121 3991780
3940545 4600372 2945009 3345928 4474295 4558648
5319159 3804963 945162 4874796 2563700 5148075
4781853 4486755 1642169 4808773 3565969 3673836
5111738 4036740 3568006 5876467 2050774 1027144
1606466 2758998 1440837 34348 3317391 3800554
5059532 4342326 1824478 473453 1732456 4174385
2971806 4229499 3521177 3235750 1801363 5720313
2969627 2745040 4755513 5618213 1727694 5933910
5006906 3740735 1865775 1572811 4217423 4502604
5430354 738689 746160 5135906 771363 86495
359191 3491608 4452171 5436316 1299053 133293
4281413 5220627 5382307 5229472 2857741 4388548
2199566 170942 3171532 5754057 4737028 577139
3350044 2609764 971214 3206761 1513935 4064006
1231227 227634 1292093 2453893 2907100 1900309
5097139 705772 3536850 3514146 1477275 388871
1030383 4344998 2061763 5904399 4741892 3647088
1348579 327856 1043654 1505564 3451048 3161219

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 35


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4650583 1666949 2687313 4977763 2197559 4343622


760319 1848145 1184387 5309776 5115657 1504647
5717394 3583177 1135103 2815110 2094695 5082393
5000444 47055 614054 1031755 2291134 4673195
3980521 2001929 5472801 2563420 3660587 2586962
1938362 1575348 1316501 3307640 2039258 5062695
4335482 4845809 880205 4727845 2733625 2689489
1255881 972034 5319105 1265189 2067810 2886037
3335298 3339618 3560999 1748950 1460145 2336723
146262 1396298 1792123 1541640 3274956 2781234
1490526 543801 954884 1178667 3139503 578809
1249461 452136 1257579 4520918 5903222 1234603
924397 923250 3797638 479590 2046496 5778657
703665 2209848 5186845 90470 610777 2703662
3098020 4949329 767932 79171 3759632 2795002
3566928 3591336 274747 1355012 1068892 5929198
1435495 4504759 4461974 5106595 3603495 4865782
3647415 1015379 4058463 1564499 2812489 2151195
1611981 4915155 3571051 276154 387383 292848
554485 625596 1695015 4079744 3114834 4082853
5696652 1585251 1348661 1763014 5029255 4800375
3645684 925970 2963593 2060335 4696822 3696176
3698205 4800007 4973341 3930157 1650539 222133
3242610 5035704 2032581 1480506 826199 4924752
601842 2002424 5277194 1607134 5206291 2212457
5925789 5103965 3092427 4838321 4771881 3377054
2431126 5447930 4164531 4191394 1320104 3070956
4091437 1681442 4254784 3823541 990039 4143007
3176432 163421 1662470 4914521 4045245 5908407
3548309 519095 4628648 2089026 668793 2900908
3415547 2261335 5437795 1587324 4431434 1573915
3168573 1298600 4014418 420468 5726855 1145534
2776223 5305417 426345 1557729 1221891 5996683
3653718 2115551 2983052 3636361 3176637 1416273
3585590 3873537 2929613 1548830 3337328 816103
2419223 4037156 608232 168610 1568110 5577561
1879889 5836488 4669963 378063 433981 582481
1597534 164333 1401349 402892 1342555 888904
4517605 684709 3451939 2311282 5253671 5686579
3095075 1614700 4138531 4262820 469658 1670366
4829402 258886 260530 1233715 1901678 4938784
1335441 286105 3147669 91812 5473817 1872384
2405162 1539595 3803757 313025 4180247 5792207
1426745 2370912 2141912 5675079 2614183 802275

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 36


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5967965 5310651 3261278 5900210 1735873 5763131


1031114 1343613 3947226 1585636 3680218 3107661
1374835 1016182 4362134 498223 3866227 4763985
568551 1661184 3677986 575175 2700165 2996400
1282144 3578957 1571721 1301729 558581 475696
1207414 2453079 4400588 5553825 708030 2334657
5959485 974235 4383080 3222954 3872439 3010481
5431046 1746436 304790 2747833 5998514 3294382
1275603 3654475 3272771 4266826 5337626 815877
4858901 5917937 907232 1424928 3004137 3081102
5355425 5669574 1858269 1107265 1815054 4044431
832321 3279794 2357482 3320717 3156056 2861599
4522240 5393415 62227 563907 2169479 2156566
2078345 1362309 1077831 3568430 614642 4018968
2072511 4951327 5141883 4955784 3285099 711544
237876 5916184 1924596 1666471 2326824 4451408
2395363 1238752 2064984 1025640 2482977 2139505
2250998 1486377 4135521 311367 3730394 2999208
2790592 3632334 4263029 3006419 3848768 2272916
1526696 5506312 3185165 2182748 4714945 1830909
2217137 5479669 4244835 5891144 670633 228171
2257135 4714623 2090173 5303103 1442518 2725953
1412671 5733495 3693443 3119328 5723676 743019
2515232 4000505 5759385 1167705 5600466 1781347
750021 4595566 2880472 5890086 5637526 5041920
1311047 141956 871154 519779 4867546 4908480
1855496 2357314 2745917 5528836 1627875 2773207
2190352 3683231 5204191 2783279 3324755 1386692
1544161 941900 5048306 2351550 3002689 2377885
2089101 1856276 2282581 4472127 4470257 4820906
2872421 2156294 1751544 2225691 5886020 1071381
2549478 5711540 2521488 2826178 1571291 825119
3511049 5516584 1241703 3107907 1517099 4892073
1138967 5507612 505576 1689307 2230110 5333291
1531565 5514790 5939944 3453236 4857253 2617716
2669578 1250791 5152812 300905 1433752 3484423
1479156 3490284 407418 2745310 3434202 2819683
5756387 4723666 5048143 1289725 4318014 4676954
4622511 3555592 5256218 620614 4628913 5385903
5509659 5194842 1980539 499580 5494133 3049616
2923519 5046712 3553505 365270 4127058 5879733
976313 5855200 1797230 291187 4904314 4481463
5136763 950967 4309714 3459822 4598278 4294589
5049965 3959402 198280 5158748 3672837 4957032

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 37


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2456272 2943 4342550 3262644 3131767 4571136


104525 1298218 1866738 827363 377215 3945376
5693840 4730594 296105 1652717 1258377 4031288
2748755 90938 3041585 5266979 4437451 985573
2884659 2228070 1634514 3729932 5984102 5596923
680456 903347 5592179 4623807 1055639 4948215
1584130 289982 3132908 4152922 270902 4054180
4024328 3119029 622269 1100284 4614861 3637350
3898319 539995 4877303 1412844 4274274 4459792
1634532 3095519 2185779 5219248 5476105 5974611
2444329 590715 1168827 1182408 409028 5369882
2819702 2343026 3423816 3087182 3719965 5234544
5937801 5822214 1344794 413996 1240106 3243729
497026 2588016 4926941 5200855 4465178 4078535
5010084 4518983 786492 1222078 2768581 3320731
5646727 1203181 2329777 1785010 2749892 4112855
2190386 4921703 4636636 5357029 1952679 3274520
5433455 677806 1012810 3661079 2190012 4453958
2598638 417360 4077035 2362701 1749199 4528062
892034 4857875 3111760 2121516 854924 4979871
4418203 2313384 5991962 3988658 4046081 3800125
2113223 1502270 3379904 3129548 435712 1355197
2623923 4826962 2676300 2017528 4047276 1864546
5565625 3424595 5143207 2285418 1775660 5069141
4256108 1180893 5455065 1684877 5347928 4572277
5790746 2586392 2937895 561035 4276428 5600346
580778 2902724 1503965 4421114 1927351 913703
628199 1482788 2194439 5193726 1920371 1859600
3102535 511802 1025807 4487210 209608 3487738
4379546 536677 4747730 698091 2318822 3756320
4853670 3462353 5099472 2573296 2751431 834208
137638 3666871 980034 5839046 2647823 1525131
4898779 4669421 629424 455998 1053706 5306034
3330437 268491 1644740 2146030 4129804 5159981
1658183 6729 1238070 757538 173636 5425252
5953692 483279 3538223 5795874 5083934 2835667
133721 4394650 2538472 1328061 5150051 1788017
4229785 2367111 4624586 918209 1974274 4726773
5121283 3158176 3869552 5229899 1221483 3900806
1368171 4609049 1119877 5342550 434912 3604736
2499316 1425692 38618 5304623 232876 1609789
4572940 5010298 4160896 3416483 4477915 5933539
1858509 610347 2236347 2606726 3777530 1913685
2083937 2763404 2671514 5068529 1761201 1963607

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 38


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

929222 250401 4051007 2773573 4863282 37597


4760774 3902421 2289800 3800244 1819066 2803287
4235863 2612331 1260540 3474730 1705029 2434229
233840 129912 2510585 2150672 884889 1309969
1906378 3761117 1975690 2988052 2526312 447055
3916162 4110970 3078959 4508665 3282854 3400610
5240220 4942362 5077235 5456664 2036215 3324728
3795548 4100968 4463764 347852 4397541 1875819
3181766 4194294 696963 4245332 2124982 1835680
2416559 146694 2048597 3807716 107228 2030574
4658439 376441 3682702 939700 2752978 167754
1316048 464087 335866 5897435 2381525 3788307
632695 5745707 3517786 3172565 5683722 3246650
810864 4795773 1825873 1566731 5571023 278562
2668085 2425549 2509718 161031 5898953 4929653
1781000 3155981 2363384 82732 5111635 3906574
5492998 2535573 3674543 5010318 4580450 90033
1529775 2926501 1663074 1877207 192722 4922322
5251915 2301432 624772 1780607 3269821 4310359
363365 5835817 4354204 1860845 1906510 1856348
291073 4907316 2683084 4224144 1674643 1803169
4511283 4137183 4362672 863449 1905530 354189
2665732 1826695 1393827 5287338 2837931 4173207
5331332 5596183 5899406 5178906 1860051 572929
2066748 931554 2825313 5738954 2087998 1530088
2444067 1503490 1767049 946633 5781562 5707450
347589 5926548 3100846 2880569 1275182 5088706
2651667 1635050 2939794 114151 2810207 2196719
2007478 2733477 3242692 5539388 3674643 1857736
4218357 2324101 2133414 2879704 5283179 1830774
5739316 1398841 4514759 1730147 3894461 4322069
2110072 2939926 4670306 664454 3853429 3780652
528087 167728 585045 5856953 4422786 2489273
962651 5048461 2725846 4952289 3566866 2740152
249539 3668217 2261235 3360328 2453737 5836332
3251973 719050 1943244 5109599 4548051 2199804
2021047 1265937 5810604 3074707 4292870 3995035
3437462 4256212 670095 5540653 1394398 1705039
4534918 5623795 5489967 456235 3607130 1633888
1655039 1752006 4965745 1025410 3774301 5961571
2386122 1274034 2590152 2100677 3033348 5627009
2504965 638667 643122 5912547 927794 1756262
4433727 1420400 1448048 3013861 1091800 1536140
2700891 1846293 1345165 962156 4577558 4691132

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 39


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5232845 617163 988463 3918936 4861459 3463730


4042798 4277920 1714667 2859750 2870207 3541271
4199349 1553111 4227039 3635994 1895446 5488674
4729822 4883995 1004269 4780642 1636439 3769830
431646 5175138 4644127 3523136 4465364 866774
4257594 4046232 2085075 4034179 4994793 4912334
687800 1264744 1245477 675236 2620349 4793636
5740177 3251340 1911664 5671721 5864732 3525017
5104710 3042145 2130412 874661 2143916 3781220
429439 3238414 5772686 5164087 3229628 2148100
1565281 4313146 2276383 4419954 730256 944217
1802965 4087467 4072816 2553519 5309997 3218273
1113320 609247 4151382 5451581 637232 4296505
777295 4137550 4947770 933464 5020477 2131852
3840493 3409861 1063915 1511763 4487460 5837230
5480213 224771 5016381 4709338 1486576 960085
3679043 1668531 2395473 5735304 4675033 3471468
5436756 99755 1284917 1143261 3409985 4701326
2621679 4963884 5344999 2189311 3573231 965807
2968219 3281636 4210472 5367613 5910960 7091
5007366 2488898 1798725 3585995 5123127 2748612
3940267 1376470 5630478 3500604 4349570 5570307
5967950 5684061 4950579 2307213 5987370 5598893
1161619 5715860 230119 2747104 4736107 3988794
4561719 5594251 1078218 2615271 3414639 1122042
2348329 5671559 5790269 1837407 4517684 1675579
2966272 5836304 4057040 1697403 91481 1533567
5875608 3563456 5463951 65309 1987934 2518537
3950184 1462649 749958 2797274 2570244 4398431
4370272 5326996 3682410 2873633 2902809 614272
434138 3108280 5539768 2687737 4045500 5112862
4444351 113846 4867122 482984 4292405 4928616
3547737 480103 2344048 2211757 3119267 5267230
794766 1402387 2223971 4098344 5441532 4170643
5391264 5878577 3002491 2557004 1421401 1519061
445571 1883062 831560 135747 3528663 3153971
2274073 5759873 3842080 3689711 3564027 438995
1115109 3955466 4660281 5092788 2276708 952460
111537 1298987 610518 4147329 1060952 5510630
4024468 1866892 231717 498311 536892 1504836
1540275 4088086 1600169 1513589 5755427 2158663
5888974 3514681 3982739 4080363 4440497 5703438
3259204 3661575 317748 2381120 4162588 1959945
793256 13764 5415384 2191541 3995669 2778842

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 40


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3673027 3436180 4823621 2644678 5159338 246792


4311999 3053428 1722707 5959336 948656 1957785
646957 5519602 5140365 99224 897056 1208520
4015641 4702520 2611731 4123609 4703085 4258337
1084133 3069058 5421688 610751 2233866 1538283
3778874 5355461 3393111 954003 572911 3425535
3993705 1349046 2681356 1974313 5734551 4232285
2694334 1298584 1123397 3489975 5203903 2994272
2114375 925585 3348547 2218620 500605 5354739
1103664 5040022 5540776 3061863 4464298 3410706
5510737 1054347 2481047 5852519 2297582 557084
3637210 1184477 1054130 3460043 3266164 4432473
2839059 5523758 188035 4995342 5463354 5733450
172085 5274080 3339384 3323478 337341 3180398
2250688 890911 3260443 2523627 4368323 3940819
5210940 2310247 4599344 4795971 2292205 4858182
1031475 4743162 4741828 4454137 323485 504363
3536685 2872538 75205 3235689 3971985 4061244
2402378 1582994 5535887 5281499 2193234 5274854
487783 944373 5595295 2906158 4551409 4564463
1322921 4883715 640935 5648940 5395367 3614465
1142216 1157611 2812019 2483273 1334320 5734226
3620547 2386412 5998826 1444490 5341268 4102646
1900370 1748546 3980437 3207434 1859813 2266895
371311 5785423 1007176 1518392 1168502 3819672
2512375 2266143 5674757 1892668 2555815 601045
2009232 4820369 3190641 1029156 5084783 4209447
3137705 2481113 3838684 3112269 1709487 5327424
3858212 2794164 1911174 4598946 5632778 2792169
4780300 2360577 4591801 1186104 3793445 852990
734113 3051676 3341459 2322973 2785031 4368769
3717427 3970333 5586174 3766015 960603 811704
191075 4230289 4819283 619688 5059373 882356
3880380 3176354 4921639 4246714 1190909 2518500
4432945 4241767 5968816 5653768 3225796 623900
5127841 1325361 2777235 1721176 645590 4456436
5592955 1636767 2283188 1846824 4532284 5404341
4475306 4867867 921890 5215842 3200486 3535095
2248767 595745 5944293 366832 3000115 1600607
640995 3734396 4062483 3230927 2035291 512833
4301761 2942740 1545585 5807939 5583156 4559352
1003608 2520332 2736411 2146069 5830268 1532939
3505189 2866375 2938305 2234776 5466130 2493370
816264 36606 2412655 1291847 2542718 5429439

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 41


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4155475 316404 3153502 5809675 4382657 3710479


4779285 4485360 2741664 5863036 3644076 4479698
1545164 5181268 1522045 5083059 2281854 2554934
3743739 1298149 2710453 3115231 2383025 2670724
4211961 929132 5298279 2968481 1200778 4070598
975941 1282093 4876347 479816 4221944 2506392
2249576 5011100 1381462 3922751 4321068 2618046
2452063 1605117 959670 4123365 4590519 5295498
4871948 7684 610116 2469857 412472 2384826
1033126 872691

 The sorted array is shown below :-


713 1079 1187 2943 4484 6729
7091 7661 7684 7939 8579 11615
12592 13322 13764 15778 16482 20750
21799 24019 26126 26833 31414 33885
34348 35623 36521 36606 36785 37194
37597 38618 38914 41619 43141 46080
46427 46751 47055 47694 48512 48893
49903 51896 52593 53321 53993 54140
58016 61603 62227 63793 65309 65520
66542 66821 75205 77031 79171 81388
81474 82732 82844 83839 84928 86495
90033 90470 90938 91481 91812 92404
92601 95212 95996 97983 99125 99224
99755 99948 100686 102897 104525 104606
105599 105959 107228 107440 109512 109820
110183 110855 111537 112589 112836 112946
113212 113846 114151 114451 115088 116602
117074 121582 125432 126062 127647 128106
128566 129912 129975 133293 133721 135189
135747 137378 137638 137831 141956 144190
146262 146364 146694 148885 156068 156261
161031 162024 163421 163721 164333 166423
167728 167754 168610 169374 169517 170334
170942 172085 172225 172811 173636 174572
174898 175891 178991 179731 182172 182824
183484 188035 191075 191142 191374 192722
193005 193311 193329 194147 194899 197559
197910 197945 198280 200217 202766 203296
204460 208063 208437 208592 209608 210277
210685 210693 215254 216635 217961 220502
222133 222483 223314 224771 227634 228171

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 42


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

230119 230217 231717 232189 232876 233840


235062 236251 237734 237876 238239 241139
242386 242439 243809 243905 246013 246792
249539 250401 253275 254175 258815 258886
260530 263030 263394 266195 266762 267190
268491 270126 270902 272402 272520 274747
274951 276046 276154 278562 281446 285894
286105 286440 289982 290624 291073 291084
291187 291361 292848 293708 293716 293763
294029 295180 296105 297333 297446 298150
298537 300905 303960 303972 304790 306867
308625 308701 311367 311732 312254 313025
314603 315546 316404 317748 319925 320961
323282 323485 324708 326730 327066 327113
327856 329631 330764 332165 332210 332973
333270 333276 335513 335866 337341 339220
346433 347589 347852 349578 349930 351075
351122 352795 352944 353645 354189 354396
357645 359191 359887 359980 360880 363365
364322 364469 364886 365270 366832 367915
371311 376441 377215 378063 379972 383923
386278 386757 387383 388871 389922 390181
390888 391476 391952 395755 397538 398718
399184 399554 400518 401092 402892 403458
407418 407657 408561 408574 409028 411090
412472 413288 413528 413996 415707 416730
416904 417360 417887 419285 419739 420468
423577 426085 426345 428309 429439 431646
432952 433086 433981 434138 434409 434912
435666 435712 435760 438995 439999 442402
443213 444121 445571 447055 447656 448379
449566 450015 452032 452136 454576 455811
455998 456235 456336 457569 459367 464087
466412 469658 471587 471761 473403 473453
474882 475696 478326 479590 479816 480103
481643 482984 483279 483498 483577 487334
487783 488580 491698 493001 493642 497026
497194 497351 497985 498223 498311 499580
500605 500815 503893 504363 505576 506997
509641 510310 511802 512833 512972 514756
516601 516767 519095 519443 519779 520384
525004 528087 531400 535778 535976 536677
536892 538127 538645 539196 539205 539730
539995 542097 543523 543801 543976 544081

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 43


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

546171 548826 554485 556590 557084 558581


559093 559584 560592 561035 561580 563565
563907 564005 568551 568848 569507 570060
572480 572911 572929 573626 573915 574467
575079 575175 577135 577139 577861 578809
580543 580778 581917 582481 585045 587744
587960 590715 591869 593796 595587 595745
596761 599539 600219 600480 601045 601417
601842 603550 606971 608101 608232 609247
610116 610242 610347 610498 610518 610646
610751 610777 614054 614272 614642 615116
617026 617163 618440 619688 620614 622269
622445 623900 624772 625596 626789 628199
628351 628503 629424 631625 632695 634895
636928 637146 637232 637397 637552 638563
638667 639623 640935 640995 643109 643122
645590 646957 648102 648474 649700 650478
650632 651178 651279 652253 653735 653936
657641 659782 660493 662262 662383 664454
668452 668793 670095 670633 673693 674929
674998 675236 677806 679786 680456 683654
684709 685339 687178 687800 691737 693119
694184 696963 698091 700751 701731 702226
702649 703665 705772 708030 711544 711579
712461 718061 719050 722861 723853 729892
730256 730312 733046 734096 734113 734974
737508 738689 740192 743019 743614 746160
746491 749460 749958 750021 751352 751660
751997 754358 755753 755790 755937 757021
757538 759079 760161 760319 761869 763730
764274 764992 766001 766527 767932 768495
769323 770279 771363 771988 772345 775732
776421 777295 779204 785291 786492 786837
790705 791104 792076 793256 793324 794766
796983 797533 801277 801623 802275 803263
803342 806037 807022 809105 810864 810961
811704 812264 812349 813256 815016 815877
816103 816264 825119 825148 825188 826199
826994 827363 828753 829368 830458 830740
830911 831270 831560 832321 834208 836055
839068 839941 841714 844376 844721 846724
847065 852990 853162 854924 855810 857898
860290 861112 862024 863064 863287 863449
864318 864343 866774 868071 868236 869933

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 44


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

871154 871221 871289 871560 872113 872691


874661 875235 880205 882356 884889 887392
888904 889483 890911 891947 892034 892296
892410 894166 894309 897056 899264 899394
899888 901236 903347 903996 904076 904296
907232 911231 912230 913703 914145 915186
917800 918209 918500 921721 921890 923250
924397 925585 925970 926573 927794 928511
928751 929132 929222 929477 931028 931554
932861 933464 935738 936010 936256 936370
937002 937559 939682 939700 940298 941900
943319 944217 944298 944373 945162 946633
947702 948656 950895 950967 952460 954003
954884 955061 955933 956588 959282 959532
959670 960085 960302 960603 960898 961071
962156 962651 963832 964065 965775 965807
965936 966748 971214 972034 974235 974242
974296 975941 976313 976591 977091 977807
978149 978622 980034 985573 985950 988463
990039 991838 994821 996070 1001717 1003608
1004269 1006044 1006339 1007176 1010246 1011689
1011912 1012419 1012645 1012810 1015379 1016182
1017490 1017706 1023203 1024171 1025410 1025434
1025640 1025807 1026477 1027144 1029156 1030383
1030869 1031114 1031475 1031755 1033126 1035986
1038837 1039400 1043654 1049676 1050480 1051079
1053395 1053706 1054130 1054347 1055305 1055639
1056821 1060354 1060952 1061720 1063842 1063915
1066119 1067821 1068892 1071381 1072738 1072958
1073045 1074697 1076695 1077831 1077935 1078218
1083266 1084133 1084287 1085125 1086350 1086399
1087792 1087867 1088474 1091800 1092022 1092022
1096410 1100284 1101428 1103664 1103968 1104339
1104591 1104671 1107265 1110023 1113320 1115109
1115250 1116188 1117325 1119877 1120643 1122042
1123397 1123553 1126219 1128324 1128794 1130231
1134178 1135103 1138967 1141449 1142216 1143261
1145534 1146715 1149738 1150062 1153535 1154265
1155063 1155686 1156333 1156780 1156946 1157611
1157707 1159534 1161564 1161619 1163696 1164449
1167705 1168502 1168827 1170624 1173273 1173657
1174661 1178667 1178832 1179746 1180055 1180893
1182408 1183578 1184387 1184477 1186027 1186104
1186916 1187939 1189234 1190909 1190910 1191752

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 45


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1194900 1200778 1202213 1202937 1203181 1203343


1207052 1207414 1208520 1208925 1211368 1211492
1211889 1216018 1218474 1219374 1221483 1221891
1222078 1222309 1225416 1225482 1225555 1225851
1226644 1231149 1231227 1232915 1233225 1233419
1233715 1234603 1235060 1238070 1238752 1239070
1240083 1240106 1240881 1241703 1245477 1248309
1248840 1248981 1249461 1249983 1250170 1250791
1252668 1252941 1253427 1255881 1257525 1257579
1258377 1260223 1260445 1260540 1261519 1261540
1264744 1265189 1265937 1266269 1269079 1270108
1272383 1274034 1274041 1275182 1275420 1275603
1277531 1279287 1280367 1282093 1282144 1284266
1284917 1286600 1287347 1289373 1289725 1291847
1292093 1293769 1294515 1295332 1296106 1298149
1298218 1298584 1298600 1298987 1299053 1299814
1301729 1305117 1305377 1307566 1307644 1309969
1310938 1311047 1313561 1315762 1316048 1316501
1317007 1317711 1318567 1320104 1321851 1322673
1322921 1323374 1325361 1325401 1325726 1328061
1328874 1330561 1331982 1333286 1334320 1335441
1337499 1339247 1342555 1343430 1343613 1344794
1345165 1345525 1348579 1348661 1349046 1349978
1350969 1355012 1355197 1357416 1358822 1358836
1359132 1362309 1368171 1368380 1368777 1368827
1369546 1371126 1372756 1374835 1375496 1376470
1377485 1380063 1380340 1381229 1381462 1384131
1386692 1387745 1389357 1393827 1394093 1394398
1394630 1395236 1396298 1398582 1398648 1398814
1398841 1398980 1400291 1401150 1401349 1402130
1402387 1412610 1412671 1412844 1414795 1416273
1420289 1420400 1420812 1421401 1424928 1424977
1425692 1426745 1428493 1429064 1429582 1431745
1432677 1433752 1435495 1439722 1439999 1440837
1442518 1442525 1443445 1443835 1444490 1445608
1447159 1448048 1449666 1450189 1454052 1454169
1455476 1457705 1459029 1460145 1461625 1462531
1462649 1463090 1463498 1463672 1466395 1466425
1467511 1468742 1473026 1475221 1477275 1478063
1478345 1479156 1480090 1480486 1480506 1480798
1481011 1482788 1482861 1483516 1485491 1485529
1486311 1486377 1486576 1490526 1491897 1492053
1493676 1497893 1498779 1502270 1502842 1503490
1503560 1503771 1503965 1504647 1504836 1505360

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 46


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1505564 1506215 1506254 1506526 1508678 1508956


1511763 1513589 1513935 1514594 1516199 1517099
1518129 1518392 1519061 1519520 1520051 1522045
1522643 1524141 1525131 1525201 1526375 1526562
1526696 1527258 1528378 1528702 1529775 1530088
1531565 1532939 1533567 1535745 1536140 1536794
1537742 1537843 1538283 1539595 1539672 1540275
1541082 1541640 1544161 1544435 1545164 1545585
1545880 1546937 1548830 1549129 1551604 1553111
1554683 1555062 1555782 1557729 1561649 1564499
1565281 1565638 1566731 1567769 1568110 1569792
1570610 1571291 1571721 1572811 1573083 1573284
1573845 1573915 1575348 1575462 1577365 1579259
1580888 1581644 1582573 1582994 1584130 1585251
1585636 1587324 1588721 1592003 1595581 1596555
1596980 1597534 1600169 1600607 1601368 1605117
1606464 1606466 1607134 1609437 1609789 1611981
1613734 1614700 1614714 1615138 1615196 1616231
1617962 1618339 1623611 1625052 1627875 1632759
1633888 1634514 1634532 1635050 1636439 1636630
1636767 1637664 1638621 1638762 1639621 1640914
1641901 1642169 1642632 1643508 1644740 1645598
1647105 1647276 1650539 1651487 1652146 1652627
1652717 1655039 1656144 1656205 1658183 1659141
1660665 1660840 1661184 1661566 1662470 1663074
1664948 1666471 1666949 1668531 1668789 1668938
1670366 1670518 1674098 1674643 1675480 1675579
1675865 1676591 1676869 1681442 1681599 1684561
1684877 1684943 1688135 1689307 1691524 1691907
1692890 1694224 1694701 1695015 1696933 1697337
1697403 1697520 1698733 1700456 1701418 1701523
1702758 1704197 1704787 1705029 1705039 1705082
1707428 1709071 1709487 1710735 1710803 1711861
1714667 1715176 1716865 1717955 1720320 1721176
1722707 1723624 1725365 1727694 1728182 1728183
1729836 1730147 1732456 1734329 1735873 1736969
1738670 1739864 1743952 1744099 1744869 1746436
1748546 1748950 1749199 1749861 1750712 1750960
1751090 1751544 1752006 1752061 1752342 1753139
1753950 1754767 1756262 1756471 1757844 1760419
1761201 1763014 1764712 1767049 1767315 1767794
1768140 1769127 1771098 1771266 1774555 1775296
1775660 1776114 1776970 1777098 1778542 1780607
1780882 1781000 1781347 1784886 1785010 1787770

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 47


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1788017 1789714 1790503 1790835 1791340 1792123


1793558 1795756 1796838 1797230 1798049 1798725
1798923 1799164 1801363 1801877 1801938 1802340
1802965 1803169 1804698 1806166 1806580 1806700
1806780 1808680 1810206 1810419 1810521 1810762
1811018 1812772 1813749 1815054 1816197 1819066
1819500 1820517 1821237 1822744 1824170 1824478
1825133 1825873 1826695 1827652 1830774 1830909
1831282 1832480 1833667 1833715 1835680 1837407
1838533 1838965 1839835 1839840 1841839 1843514
1846293 1846561 1846824 1848145 1850841 1852857
1854227 1855496 1855654 1856276 1856348 1857736
1858269 1858509 1859600 1859813 1859834 1860051
1860845 1863277 1864546 1865775 1866738 1866790
1866892 1868241 1872384 1873415 1873713 1875819
1876819 1877105 1877207 1878785 1879889 1880387
1881055 1881985 1882791 1883062 1885775 1886546
1886837 1891882 1892668 1892905 1895446 1900159
1900309 1900370 1900904 1901678 1904207 1905530
1906378 1906510 1907377 1911174 1911664 1913685
1920169 1920371 1921436 1922526 1924308 1924596
1926407 1926910 1927351 1927372 1929623 1930309
1931020 1932189 1932927 1933225 1938030 1938362
1938944 1941309 1943244 1952679 1953487 1954632
1955462 1956703 1957785 1958669 1959214 1959945
1961609 1962539 1963607 1965286 1968630 1969629
1970753 1971065 1973236 1974274 1974313 1975281
1975690 1978615 1980539 1981240 1982121 1983981
1985370 1987934 1991274 1991736 1992505 1993064
1996108 2000913 2001130 2001324 2001929 2002424
2004174 2007182 2007478 2007642 2009232 2012343
2012881 2013987 2017528 2019877 2021047 2022229
2023424 2023508 2025608 2026346 2029506 2029855
2030574 2032581 2033188 2033386 2033871 2035291
2035318 2035819 2036215 2038103 2039258 2040943
2042378 2042558 2043477 2045862 2046496 2046820
2047981 2048597 2050321 2050774 2052345 2056258
2058218 2058588 2060335 2060447 2061629 2061763
2061873 2064013 2064984 2066748 2067810 2072511
2073364 2076802 2078345 2080183 2082484 2083937
2085075 2085482 2087998 2088729 2089026 2089101
2089798 2090173 2092594 2094695 2094803 2096200
2097003 2097371 2097742 2100677 2104943 2105339
2108035 2110022 2110072 2113223 2114154 2114360

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 48


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2114375 2115551 2115935 2117661 2118960 2119231


2120264 2121516 2121762 2122032 2124982 2127724
2129939 2130331 2130412 2131852 2131921 2133414
2133649 2136518 2137868 2137908 2138775 2139505
2141270 2141912 2143916 2144911 2146030 2146069
2147939 2148100 2148738 2149712 2149868 2150672
2151195 2151451 2154028 2154893 2155175 2155481
2155674 2156294 2156566 2156906 2157111 2157461
2158663 2163313 2163984 2165086 2166507 2167052
2169479 2171851 2174795 2175234 2179025 2179681
2182235 2182376 2182748 2185558 2185779 2186336
2187345 2189311 2190012 2190352 2190386 2191541
2193234 2194439 2196719 2197559 2198395 2199566
2199804 2199831 2207842 2207897 2209848 2210956
2211757 2212457 2212722 2214496 2217137 2218620
2221690 2222317 2222884 2223971 2224434 2224740
2225618 2225691 2226315 2227577 2228070 2230110
2232007 2233866 2234776 2235269 2236347 2239320
2240332 2240631 2241759 2243673 2248767 2249576
2250688 2250998 2251008 2257135 2258393 2258732
2260923 2261043 2261235 2261335 2262223 2262965
2263322 2264503 2266086 2266143 2266448 2266895
2267096 2268684 2272916 2274073 2276383 2276708
2277905 2278058 2278330 2281854 2281888 2282581
2283188 2285418 2286371 2288567 2289800 2290066
2291134 2292205 2297035 2297582 2301432 2302567
2302923 2305149 2305879 2306246 2306583 2306957
2307207 2307213 2307307 2308317 2310247 2311245
2311282 2311641 2311744 2313384 2313686 2315061
2317925 2318457 2318547 2318822 2321068 2321310
2322973 2323192 2323320 2323375 2323661 2323683
2323752 2324101 2326824 2328279 2328640 2329026
2329777 2331823 2333190 2334518 2334588 2334657
2336723 2338936 2343026 2344048 2347776 2348329
2348994 2350940 2351550 2352731 2354550 2357314
2357482 2359891 2360577 2362701 2363384 2364136
2365837 2367111 2368252 2370912 2373539 2373923
2373998 2374894 2375045 2377127 2377885 2378855
2381120 2381525 2383025 2384826 2386122 2386256
2386412 2389693 2392147 2395363 2395473 2397468
2398284 2399221 2402378 2402420 2403036 2403240
2404663 2405162 2410811 2412655 2413676 2415703
2416559 2418620 2419223 2419437 2423045 2423278
2425120 2425549 2428995 2431126 2431801 2432530

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 49


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2433399 2434229 2439384 2441970 2443875 2444067


2444123 2444329 2444775 2446193 2447059 2451870
2452063 2452320 2453079 2453663 2453734 2453737
2453893 2454163 2454628 2455626 2456272 2458068
2458488 2460038 2460527 2461893 2467657 2469279
2469857 2471034 2475939 2477709 2478931 2480168
2481047 2481113 2481723 2482977 2483273 2488898
2489273 2491740 2493361 2493370 2495885 2496861
2499316 2499655 2500150 2504965 2506392 2508332
2508450 2509718 2510487 2510585 2512375 2512890
2513219 2513294 2513442 2513634 2514674 2515232
2515319 2516918 2518500 2518537 2518679 2520332
2520357 2521073 2521488 2522464 2522857 2523188
2523627 2525503 2526190 2526312 2529620 2532701
2535085 2535573 2536340 2537061 2537801 2538472
2538912 2542718 2542964 2547750 2548785 2549478
2549754 2549758 2550215 2553519 2554546 2554934
2555561 2555815 2556899 2556922 2556935 2557004
2560751 2561031 2563235 2563420 2563700 2567870
2569940 2570244 2570905 2572633 2573296 2574189
2575420 2579457 2579710 2582809 2586392 2586962
2588016 2588429 2590152 2592953 2593403 2593840
2593957 2595679 2596648 2596841 2597361 2598328
2598638 2604124 2606726 2609764 2611731 2612331
2613756 2613851 2614183 2615271 2615473 2615768
2616495 2617083 2617716 2618046 2618362 2619767
2620349 2621679 2622967 2623389 2623923 2624333
2633558 2634602 2635409 2636711 2638657 2641235
2642790 2644678 2645075 2647418 2647823 2648450
2649395 2651346 2651667 2652265 2656982 2660601
2663957 2665732 2666076 2666313 2668085 2668101
2668247 2668409 2669578 2670724 2671514 2672491
2674676 2676300 2679014 2679384 2681356 2681559
2681746 2683084 2683294 2684065 2686107 2687313
2687737 2688391 2688425 2689246 2689489 2689525
2694334 2696542 2698616 2699516 2700165 2700891
2701837 2702324 2702825 2703662 2705862 2706546
2706572 2710453 2710622 2713456 2713983 2714695
2715179 2717026 2722438 2722841 2725846 2725953
2726796 2729547 2732804 2733477 2733539 2733625
2736411 2736516 2738363 2739260 2740152 2741664
2742349 2742679 2743301 2743313 2743325 2743453
2745040 2745310 2745917 2746904 2747104 2747833
2748612 2748755 2749892 2751044 2751431 2752378

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 50


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2752978 2758998 2760074 2761696 2763404 2763552


2765113 2768581 2769439 2770814 2773207 2773573
2773979 2776223 2776505 2777235 2777845 2778842
2779254 2781234 2781544 2783279 2783852 2784697
2784802 2785031 2786114 2786483 2787079 2787332
2787814 2787863 2788693 2790592 2792169 2793123
2794164 2795002 2797274 2802767 2802863 2803287
2804221 2805318 2808377 2808384 2810207 2812019
2812489 2814825 2815110 2815340 2816286 2817076
2819040 2819683 2819702 2820163 2821239 2822528
2822566 2823198 2825313 2826178 2827567 2829640
2830091 2831699 2832925 2833852 2835576 2835667
2837931 2838038 2839059 2843334 2844442 2844548
2850682 2851584 2853836 2854476 2855616 2856581
2856664 2857138 2857332 2857741 2859010 2859058
2859750 2861599 2863122 2864210 2866375 2866629
2870207 2871688 2871891 2872421 2872538 2873633
2874929 2875465 2877315 2878737 2879704 2880193
2880472 2880569 2883474 2884659 2886037 2886669
2888575 2889158 2892662 2892978 2893186 2894353
2896653 2898320 2900908 2902724 2902809 2903770
2905714 2906158 2907100 2913935 2915577 2917103
2917250 2918281 2919820 2923447 2923519 2924020
2924643 2925737 2926388 2926501 2928799 2929613
2934146 2935247 2937895 2937936 2938305 2938587
2939794 2939926 2941870 2942740 2943382 2943462
2943554 2944876 2945009 2946848 2948175 2950559
2951198 2951725 2954279 2954602 2959922 2961219
2961998 2963593 2964735 2966272 2967714 2968219
2968481 2969050 2969627 2970567 2971806 2971951
2973582 2974235 2974678 2975779 2976164 2978512
2979767 2980039 2980067 2981619 2983052 2983162
2986637 2988052 2988567 2988812 2991910 2992139
2993974 2994272 2995898 2996400 2998499 2999208
2999252 2999507 2999742 3000115 3001906 3002491
3002689 3003502 3004137 3004862 3005908 3006419
3006561 3006730 3006861 3007749 3010481 3012069
3013861 3014028 3014369 3014918 3015538 3022917
3024151 3027820 3033150 3033348 3034366 3036622
3037647 3038685 3038915 3040081 3040630 3041585
3042145 3043889 3044785 3047169 3048929 3049616
3051545 3051676 3053094 3053428 3054645 3055707
3056015 3056247 3059521 3061863 3063357 3063781
3066334 3067619 3068517 3069058 3069947 3070956

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 51


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3072024 3072384 3074707 3076780 3078959 3081102


3081580 3081940 3083021 3086337 3087182 3087659
3089749 3092023 3092427 3093076 3093536 3095075
3095519 3097582 3097899 3098020 3099980 3100846
3102535 3103336 3106845 3107282 3107661 3107907
3108280 3108450 3108680 3108949 3111230 3111760
3112269 3114337 3114818 3114834 3114987 3115231
3116853 3117415 3119029 3119267 3119328 3123249
3123305 3129548 3131016 3131767 3131842 3132908
3133122 3135769 3135963 3136508 3137705 3138487
3138744 3138947 3139503 3141667 3142521 3144962
3145384 3145488 3146327 3147669 3150936 3152455
3153502 3153971 3154971 3155893 3155981 3156056
3158176 3159021 3160773 3161219 3165979 3168573
3171532 3172565 3172921 3174131 3174372 3174409
3176354 3176432 3176637 3176880 3180398 3181766
3182475 3183467 3183622 3184163 3184569 3185165
3185274 3189542 3190641 3190835 3191244 3191350
3192985 3194317 3195647 3196596 3200377 3200486
3200494 3200501 3202406 3206761 3207434 3208098
3211092 3211542 3211715 3212782 3213317 3213837
3216272 3218273 3220172 3220178 3222325 3222954
3223258 3225796 3225863 3229628 3230738 3230927
3235482 3235689 3235750 3236438 3238414 3242610
3242692 3243729 3243730 3245405 3245799 3246365
3246650 3247452 3250069 3250847 3251340 3251973
3253610 3255751 3255764 3256405 3256854 3259204
3259602 3260443 3261278 3261815 3262644 3264794
3266164 3269241 3269714 3269756 3269821 3270397
3271327 3272258 3272771 3272798 3274520 3274956
3276036 3276764 3277805 3277962 3279668 3279794
3281500 3281636 3282854 3283988 3284886 3285099
3288001 3292837 3294382 3295925 3297184 3299055
3299072 3299087 3300774 3301549 3307442 3307539
3307640 3307881 3309672 3311455 3313303 3314373
3315449 3317391 3317518 3318079 3319536 3320101
3320443 3320717 3320731 3323013 3323478 3323977
3324728 3324755 3329685 3330437 3332576 3332590
3333327 3334787 3335298 3337328 3339384 3339618
3341459 3343005 3343017 3345884 3345928 3346858
3348291 3348547 3349012 3349373 3350044 3353021
3357741 3357825 3359398 3360328 3362950 3365145
3365957 3366132 3366535 3369191 3369638 3370916
3371134 3371356 3371783 3372770 3373802 3374917

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 52


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3376379 3377054 3377587 3379904 3381886 3385335


3390789 3391091 3392020 3393111 3393439 3393473
3393775 3394113 3399725 3399812 3400610 3403051
3403684 3404033 3404704 3409156 3409861 3409985
3410706 3414639 3415547 3416483 3416694 3416739
3419180 3421324 3421969 3423816 3424122 3424595
3425535 3433466 3433530 3433634 3434202 3435460
3436180 3437462 3439936 3446267 3446319 3447008
3448753 3451048 3451939 3453236 3453682 3454541
3457035 3457526 3459822 3460043 3462353 3463549
3463730 3470036 3471299 3471468 3472734 3474503
3474730 3476630 3479115 3479695 3479997 3480106
3481594 3482182 3483163 3484423 3485449 3485623
3487028 3487426 3487738 3487872 3489388 3489751
3489975 3490146 3490284 3490994 3491608 3496525
3497146 3500604 3502030 3502233 3502785 3504126
3504383 3505189 3506440 3506897 3507186 3508961
3511049 3512277 3514146 3514681 3516856 3517786
3518227 3519397 3519461 3521177 3521631 3522720
3523136 3525017 3528663 3528740 3532019 3532402
3533533 3534524 3534758 3534961 3535095 3535348
3536685 3536850 3538223 3538626 3540840 3541271
3544931 3545017 3546882 3547737 3547791 3548309
3549611 3550249 3551399 3553505 3553802 3555592
3556631 3557951 3560999 3561767 3563456 3564027
3564549 3565969 3566866 3566928 3568006 3568430
3568841 3571051 3573231 3578957 3580405 3580512
3580618 3582865 3583177 3585590 3585995 3588400
3590669 3591336 3598798 3599751 3600872 3602002
3602867 3602894 3603495 3604736 3607130 3607732
3610150 3610309 3610693 3610776 3611770 3612172
3613996 3614465 3615127 3619104 3620547 3620830
3622823 3622981 3624630 3630176 3630207 3630300
3630764 3632334 3632641 3635994 3636361 3637034
3637210 3637350 3638070 3641553 3643656 3644076
3644169 3644690 3645684 3647088 3647397 3647415
3649334 3649982 3651125 3653718 3654087 3654475
3654979 3656252 3657475 3659874 3660000 3660587
3660970 3661079 3661575 3663466 3665229 3666261
3666871 3667199 3668217 3672426 3672706 3672837
3673027 3673836 3674543 3674643 3677986 3678079
3679043 3680218 3682410 3682702 3683231 3683553
3683736 3685067 3685838 3687526 3688904 3689700
3689711 3690044 3690281 3691392 3692097 3693443

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 53


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3696176 3698205 3699687 3705721 3706043 3706354


3708594 3710479 3710601 3711361 3711832 3714952
3715460 3716513 3716644 3717427 3719965 3721369
3722904 3726335 3727274 3727958 3728386 3729932
3730394 3731289 3733917 3734396 3740265 3740735
3743575 3743739 3743824 3743948 3747777 3751660
3753859 3756320 3758458 3758772 3759632 3761117
3766015 3769830 3773964 3774301 3775676 3776940
3777383 3777530 3778874 3780652 3781057 3781220
3784492 3785476 3788307 3788581 3790013 3791513
3791568 3793445 3793765 3795548 3796158 3797638
3798005 3800125 3800244 3800554 3801129 3801338
3801623 3801938 3803501 3803757 3804963 3806976
3807716 3807939 3810847 3811596 3812972 3813488
3813720 3814059 3816460 3818527 3819389 3819672
3821671 3823341 3823541 3826926 3827900 3833933
3834005 3835006 3835650 3836669 3838684 3840493
3842080 3842478 3845375 3847865 3848768 3848768
3849059 3850075 3851801 3852288 3852976 3853429
3853686 3854534 3855315 3858212 3866227 3869552
3871428 3871776 3872439 3873537 3877578 3877747
3880380 3883574 3890010 3892238 3892827 3893184
3894461 3897617 3898080 3898319 3898381 3900633
3900806 3902421 3902712 3905365 3906130 3906201
3906574 3906917 3907925 3911257 3911956 3914198
3914684 3914969 3916162 3916702 3917057 3918241
3918936 3921144 3922506 3922751 3923257 3923643
3926622 3927708 3930157 3933192 3938535 3940043
3940267 3940381 3940393 3940412 3940545 3940773
3940819 3942237 3945288 3945376 3946404 3947226
3948686 3949585 3950184 3952907 3955466 3955511
3959402 3959669 3962034 3964195 3964442 3964905
3967298 3967550 3968064 3970333 3971985 3972893
3977322 3980437 3980521 3982017 3982570 3982739
3986736 3986975 3987714 3988559 3988658 3988794
3989530 3991780 3992629 3993425 3993705 3995035
3995079 3995364 3995669 3995773 4000477 4000505
4002881 4003414 4008616 4009180 4009525 4014418
4015383 4015641 4017067 4017239 4018968 4019322
4021277 4022326 4023338 4023636 4024328 4024468
4025896 4025970 4030027 4031288 4031834 4034179
4036740 4037156 4041519 4042798 4042870 4044431
4044787 4045245 4045500 4046081 4046232 4047276
4048121 4048841 4049716 4049815 4051007 4052503

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 54


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4053347 4053601 4054180 4054263 4056908 4057040


4058463 4061096 4061244 4062483 4064006 4066553
4067935 4069284 4070598 4072816 4075248 4076378
4077035 4078535 4079744 4080363 4082853 4083442
4084832 4084919 4084974 4085768 4087467 4088086
4090016 4090618 4091437 4093177 4095956 4096691
4097684 4098344 4098797 4100968 4102646 4105394
4106007 4106049 4108312 4108534 4110322 4110970
4112855 4113133 4113241 4115989 4116095 4116176
4117030 4120391 4123007 4123365 4123609 4123719
4126097 4126676 4127058 4127147 4129804 4133285
4134648 4135521 4136696 4136782 4137183 4137550
4138425 4138531 4139183 4141118 4142455 4143007
4143131 4147329 4147668 4148696 4149883 4150842
4151382 4152611 4152922 4154932 4155475 4156234
4156414 4156786 4157588 4159089 4160700 4160896
4162588 4164196 4164531 4165284 4169754 4169857
4170643 4170710 4173207 4174385 4175047 4177447
4177695 4178344 4180247 4180925 4181743 4186233
4191050 4191394 4192947 4193716 4193919 4194294
4195916 4197507 4198046 4198182 4199349 4203516
4203967 4204086 4206031 4206375 4207470 4209447
4210472 4211961 4215693 4215843 4217423 4218357
4218608 4219130 4220936 4221944 4223896 4224144
4226954 4227039 4228226 4228327 4229499 4229785
4230289 4231698 4231961 4232285 4232751 4235863
4240845 4241767 4244835 4245332 4246714 4247436
4250259 4252142 4254012 4254784 4255381 4256108
4256212 4256957 4257234 4257594 4258337 4260225
4262373 4262820 4263029 4266549 4266826 4268637
4269458 4270383 4270530 4272484 4272527 4273456
4273540 4273842 4274274 4276228 4276428 4277920
4278089 4279048 4281277 4281413 4282381 4285054
4286281 4287032 4287298 4292405 4292870 4293908
4294589 4294796 4295714 4296505 4299721 4300886
4301761 4304620 4305565 4307237 4309714 4310359
4310982 4311465 4311652 4311999 4312400 4312867
4313146 4314936 4316742 4318014 4318717 4319193
4321068 4321348 4322069 4322321 4322526 4322560
4324716 4325511 4329145 4330130 4330275 4333692
4334059 4334437 4335482 4336071 4338370 4339582
4340080 4341268 4342326 4342550 4343622 4343997
4344128 4344300 4344998 4345275 4348979 4349570
4351197 4352201 4352237 4353751 4354204 4355565

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 55


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4356792 4359000 4359068 4359259 4362134 4362421


4362672 4365318 4365969 4366137 4368323 4368769
4370272 4372237 4372324 4376223 4376644 4377440
4378801 4379356 4379546 4382657 4383065 4383080
4384872 4384914 4387720 4388290 4388548 4389862
4393487 4394650 4397341 4397541 4398151 4398431
4399124 4400037 4400390 4400588 4402030 4404368
4405445 4405731 4406175 4407201 4408886 4412083
4418203 4418782 4419954 4420770 4421114 4421227
4422786 4427165 4427822 4429378 4430242 4431434
4431824 4432473 4432945 4433727 4436859 4437451
4437804 4438671 4440461 4440497 4440525 4442335
4443651 4444017 4444351 4451408 4451859 4452171
4453717 4453958 4454137 4454587 4455908 4456436
4457767 4458413 4459355 4459792 4460443 4461922
4461974 4463764 4464298 4465008 4465178 4465364
4469681 4469742 4470257 4472127 4474295 4474608
4474688 4475306 4476626 4477915 4478134 4479698
4480020 4481463 4482312 4485360 4486496 4486755
4487210 4487460 4490069 4491703 4491955 4494241
4494691 4497084 4497342 4498917 4499070 4501889
4502151 4502604 4504759 4504923 4505706 4506947
4507307 4508610 4508665 4509376 4511283 4513901
4514759 4517605 4517684 4518510 4518983 4520918
4522116 4522240 4523825 4524688 4525109 4526015
4528062 4530826 4532284 4532973 4534628 4534918
4535247 4537476 4539298 4541569 4542532 4546197
4546904 4547672 4548051 4551012 4551409 4552934
4554355 4554427 4554673 4554949 4558648 4559352
4561137 4561460 4561719 4564463 4567254 4567951
4568244 4568707 4568947 4571051 4571136 4572277
4572940 4577558 4579966 4580352 4580450 4581140
4582661 4585554 4588029 4589092 4590519 4591117
4591406 4591801 4595566 4595722 4597274 4598036
4598278 4598946 4599344 4599457 4600372 4601327
4603690 4604985 4606618 4607224 4607541 4609049
4609783 4610318 4611656 4613145 4613397 4614861
4620541 4622511 4622745 4623667 4623807 4624012
4624586 4625851 4627717 4628080 4628648 4628913
4630819 4632064 4633942 4634183 4635377 4635786
4636005 4636636 4641381 4642884 4644127 4648972
4650583 4652041 4652422 4653618 4654105 4656355
4657219 4657835 4658439 4659182 4659233 4659573
4660281 4661005 4663578 4664364 4665659 4665996

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 56


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4666912 4669421 4669741 4669963 4670224 4670306


4672009 4672154 4673195 4673293 4675033 4676660
4676954 4677820 4679266 4679319 4681679 4683177
4683875 4684862 4685888 4691132 4696731 4696822
4697683 4698663 4701326 4702356 4702520 4703085
4703433 4708682 4709250 4709338 4711761 4712071
4712818 4712965 4714445 4714623 4714945 4715236
4716027 4717185 4719078 4720876 4723666 4723904
4726260 4726773 4727845 4729822 4730594 4731146
4731423 4736107 4737028 4737510 4738259 4739070
4739153 4739457 4739600 4741828 4741892 4742903
4743162 4745331 4747452 4747730 4751993 4755513
4757263 4760024 4760774 4762254 4763985 4764740
4771660 4771881 4772522 4776216 4777039 4778905
4778926 4779285 4780300 4780642 4781427 4781532
4781853 4788381 4788535 4789272 4790092 4790641
4790832 4792215 4792425 4793636 4794037 4795171
4795435 4795773 4795971 4796356 4800007 4800375
4803894 4805441 4806223 4808496 4808773 4811948
4812767 4814873 4815979 4817535 4819283 4820369
4820906 4822149 4823621 4825967 4826171 4826444
4826962 4827829 4829402 4830774 4830911 4831377
4833617 4833995 4837010 4838166 4838321 4838620
4838641 4843761 4845470 4845809 4848290 4853670
4857253 4857731 4857751 4857778 4857875 4858182
4858901 4859755 4861459 4863282 4864043 4864920
4865782 4867122 4867546 4867867 4869023 4870046
4870584 4871948 4872801 4874796 4876089 4876347
4877303 4879696 4880635 4883715 4883995 4885089
4885198 4886154 4886654 4887035 4890364 4892073
4893047 4898779 4898859 4902030 4902932 4903798
4904314 4904349 4904685 4904941 4907316 4908480
4909725 4911338 4912334 4914475 4914521 4915155
4915328 4916965 4919939 4921020 4921639 4921703
4922322 4924752 4925263 4926941 4927152 4928560
4928616 4928814 4929448 4929653 4932046 4934581
4935429 4936520 4937979 4938784 4941419 4942362
4945666 4946731 4947770 4947854 4948215 4948336
4948676 4949329 4950579 4951327 4952114 4952289
4954924 4955236 4955784 4957032 4961263 4963884
4965224 4965745 4966336 4967942 4971456 4971715
4973341 4973819 4974540 4974674 4975533 4977763
4979871 4985886 4986737 4988892 4989305 4994793
4995342 4995640 4996492 4997780 4998213 5000444

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 57


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5000644 5002891 5003007 5004132 5006906 5007366


5010084 5010298 5010318 5011100 5012053 5014924
5016381 5018550 5019006 5020154 5020477 5021368
5022100 5025640 5029255 5035704 5036208 5040022
5040486 5040814 5041258 5041920 5042192 5042558
5046712 5047133 5048143 5048306 5048461 5049965
5050081 5053462 5056790 5058660 5059373 5059532
5059558 5062695 5063041 5063122 5064071 5068529
5069141 5069946 5070836 5074651 5075129 5076446
5077235 5079536 5082393 5082698 5083059 5083310
5083475 5083934 5084783 5085345 5085731 5088706
5090957 5092788 5093141 5094935 5094987 5095988
5096395 5097139 5099472 5099708 5099953 5101364
5102749 5103965 5104710 5106595 5107811 5109393
5109527 5109599 5111635 5111653 5111738 5112633
5112862 5112966 5113114 5114033 5115657 5117260
5120061 5120196 5120539 5120601 5120644 5121283
5123097 5123127 5127329 5127841 5128654 5130953
5131267 5132143 5134444 5135906 5136763 5137835
5138632 5140001 5140365 5141883 5142506 5142708
5143207 5147090 5148075 5149389 5150051 5150211
5150247 5152812 5153205 5158185 5158748 5159338
5159802 5159981 5160364 5161327 5164087 5164433
5165232 5170672 5170691 5171315 5175138 5175665
5178767 5178906 5179010 5180898 5181268 5186845
5187453 5189955 5191929 5192256 5193726 5194034
5194842 5199345 5199717 5200855 5203774 5203903
5204052 5204191 5206068 5206268 5206291 5206542
5207682 5210707 5210924 5210940 5210969 5211280
5212294 5212693 5214721 5215563 5215842 5218048
5218679 5219248 5220116 5220627 5221836 5222757
5223149 5224818 5226565 5227908 5228323 5229472
5229899 5232477 5232845 5234544 5234679 5235107
5235221 5235618 5236759 5237109 5239125 5240220
5240732 5242511 5244411 5245545 5249999 5250931
5251915 5253671 5255243 5256218 5256784 5260518
5262668 5264110 5264727 5266979 5267230 5269580
5270283 5273514 5274080 5274854 5276648 5277194
5277563 5281499 5281994 5282894 5283179 5287047
5287338 5288293 5289473 5291231 5291696 5292861
5294921 5295498 5297194 5298279 5300288 5301129
5302306 5302818 5303103 5303103 5304623 5305417
5305468 5306034 5306937 5309776 5309997 5310651
5319105 5319159 5320455 5320462 5322947 5323439

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 58


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5324142 5324845 5325762 5326996 5327262 5327387


5327424 5329955 5331332 5331622 5331909 5332742
5333291 5334728 5335691 5336367 5337446 5337626
5338225 5339164 5340293 5341268 5342550 5344999
5346724 5347928 5348616 5348764 5352165 5354739
5355425 5355461 5357029 5357651 5359368 5363310
5363509 5363527 5363781 5365275 5365299 5367613
5367622 5369882 5372251 5374696 5375332 5375844
5379763 5381403 5381784 5381855 5382307 5383122
5384773 5385903 5388936 5389552 5391058 5391207
5391264 5391655 5392656 5392860 5393415 5395330
5395367 5396436 5399171 5399901 5404341 5408133
5409077 5410098 5410745 5411297 5415384 5416106
5419633 5419645 5421688 5423002 5425252 5425793
5427552 5429439 5430342 5430354 5431046 5433455
5434217 5436316 5436756 5437319 5437680 5437694
5437795 5441532 5442437 5442978 5445014 5446497
5447930 5448153 5448559 5450270 5450495 5450981
5451407 5451581 5454944 5455065 5456664 5457973
5458338 5458870 5459025 5462236 5463354 5463553
5463951 5465205 5466130 5467742 5468734 5470497
5472117 5472801 5473817 5476105 5476452 5479485
5479669 5480213 5481836 5482049 5482267 5482559
5484057 5485619 5487946 5488674 5489967 5492998
5493156 5493964 5494133 5496116 5496532 5496961
5498281 5499637 5499981 5502484 5503405 5504196
5505599 5505728 5506312 5507612 5509659 5510578
5510630 5510737 5513239 5514790 5516024 5516544
5516584 5517618 5518166 5518285 5519602 5523758
5528836 5529477 5529890 5530245 5530299 5530777
5532065 5534470 5535665 5535827 5535887 5536452
5539388 5539429 5539485 5539768 5540653 5540776
5544525 5545436 5545964 5549690 5549915 5550488
5551772 5552154 5553792 5553825 5554562 5555229
5559360 5559723 5560223 5560709 5561274 5563182
5564332 5565311 5565625 5567301 5569326 5570307
5570397 5571023 5571120 5572767 5574436 5577026
5577561 5579527 5582556 5583156 5584717 5584784
5585531 5586169 5586174 5588433 5588714 5590807
5592179 5592717 5592955 5593030 5593581 5594251
5594736 5595295 5596183 5596923 5598893 5599781
5600346 5600466 5601327 5601506 5604039 5609052
5609665 5612478 5613318 5613820 5615810 5618213
5619580 5621743 5622663 5623795 5627009 5627206

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 59


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5627238 5627979 5629374 5629484 5630478 5632277


5632778 5634219 5635631 5637526 5638401 5643235
5643506 5643915 5646727 5647699 5648279 5648940
5650702 5650768 5651699 5653768 5654379 5654767
5656928 5664600 5665207 5665362 5666523 5667449
5667526 5668436 5669574 5670869 5671559 5671721
5674757 5675079 5679537 5679873 5683712 5683722
5684061 5685389 5685706 5686579 5688622 5688890
5691580 5691694 5692540 5692837 5693840 5694239
5696652 5700859 5701374 5702951 5703438 5707450
5708976 5710202 5711540 5712087 5713033 5715497
5715860 5716196 5717394 5717957 5720313 5722922
5723676 5726855 5726879 5733450 5733495 5734226
5734551 5734558 5735072 5735304 5736026 5736321
5737200 5738670 5738954 5739316 5740177 5744202
5745707 5747399 5747466 5749137 5750046 5751430
5753163 5754057 5755427 5756387 5757764 5759220
5759220 5759385 5759873 5759903 5760267 5760593
5762139 5763077 5763131 5763510 5764044 5764687
5765027 5769373 5771390 5772686 5776388 5777576
5778657 5778769 5778790 5779127 5779418 5780539
5780704 5781052 5781155 5781396 5781562 5783791
5784166 5785423 5785475 5788180 5790269 5790746
5792084 5792207 5795011 5795874 5796275 5797673
5797941 5799377 5800624 5802086 5806115 5807939
5808576 5809675 5809760 5810151 5810604 5810792
5813546 5818621 5819174 5820300 5822214 5822784
5827411 5827992 5828919 5830268 5831626 5832361
5835817 5836304 5836332 5836488 5837230 5837494
5838441 5839046 5839857 5840944 5841522 5842920
5844293 5844542 5852519 5855200 5855276 5855307
5856953 5858367 5859408 5859986 5861768 5863036
5863392 5864070 5864732 5864967 5868976 5874506
5875608 5875790 5876467 5876513 5878462 5878531
5878577 5879733 5880853 5883127 5884002 5884301
5886020 5886213 5886249 5888974 5890086 5890203
5890838 5891144 5891292 5891585 5891802 5892092
5893379 5895049 5895286 5897435 5898953 5899368
5899406 5899660 5900210 5900677 5900888 5900961
5902277 5903222 5903822 5904399 5906357 5906811
5907320 5908407 5908911 5909476 5910960 5911513
5911708 5912547 5913761 5914695 5916184 5917937
5918830 5918990 5919347 5920758 5923000 5923108
5925789 5925831 5926548 5929198 5933539 5933910

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 60


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5934062 5935062 5936029 5936415 5937801 5939944


5944293 5944702 5945149 5947772 5948473 5951198
5951548 5951830 5952846 5953615 5953692 5954600
5956015 5957369 5958194 5959261 5959336 5959485
5959819 5961571 5962614 5965457 5966381 5967950
5967965 5968816 5969932 5970212 5971502 5973030
5973256 5973965 5974339 5974611 5978130 5979097
5979736 5982584 5984102 5984592 5985239 5985468
5987203 5987370 5987985 5988128 5989017 5991962
5996683 5997244 5997859 5998514 5998826 5999021
5999110 5999137

Time = 25516.0

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 61


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5. Sort a given set of n integer elements using Merge Sort method


and compute its time complexity. Run the program for varied values
of n> 5000, and record the time taken to sort. Plot a graph of the time
taken versus non graph sheet. The elements can be read from a file or
can be generated using the random number generator. Demonstrate
using Java how the divide and-conquer method works along with its
time complexity analysis: worst case, average case and best case :-

import java.util.Random;
import java.util.Scanner;
public class Pgm5
{
public static void main(String args[])
{
int i;
int n;
int a[];
int min=0,max=6000;
Scanner input=new Scanner(System.in);
System.out.println("Enter the no. of elements :-");
n=input.nextInt();
a=new int[n];
Random random=new Random();
for(i=0;i<=n-1;i++)
{
int number=random.nextInt((max-min)+1)+min;
a[i]=number;
}
System.out.println("Enter the elements :-");
for(i=0;i<=n-1;i++)
{
System.out.print(a[i]+"\t");
}
System.out.println();
long start=System.currentTimeMillis();
mergesort(a,0,n-1);
long end=System.currentTimeMillis();
float time=(end-start);
System.out.println();
System.out.print("The sorted array is :-");
System.out.println();
for(i=0;i<=n-1;i++)

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 62


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

{
System.out.print(a[i]+"\t");
}
System.out.println();
System.out.print("Time = "+time);
}
public static void mergesort(int a[], int low, int high)
{
int mid;
if(low<high)
{
mid=(low+high)/2;
mergesort(a,low,mid);
mergesort(a,mid+1,high);
merge(a,low,mid,high);
}
}
public static void merge(int a[], int low,int mid, int high)
{
int c[]=new int[200000];
int i=low;
int j=mid+1;
int k=low;
while(i<=mid &&j<=high)
{
if(a[i]<a[j])
{
c[k++]=a[i++];
}
else
{
c[k++]=a[j++];
}
}
while(i<=mid)
{
c[k++]=a[i++];
}
while(j<=high)
{
c[k++]=a[j++];
}
for(i=low;i<=high;i++)
{

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 63


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

a[i]=c[i];
}
}
}

-:OUTPUT:-

Enter the no. of elements :-


5000
Enter the elements :-
4373 26 121 5897 5019 2650 2241 2397 5648 358 3720
230 494 4921 1492 3111 5623 3169 768 42 5252 5176
2812 481 5475 4631 1553 2170 4887 3956 737 1632 5360
5060 2103 2367 71 3028 1537 606 5516 1847 5644 4452
572 3519 4941 3933 1974 1340 3815 1451 5336 5737 4382
111 5538 4784 4397 518 5144 3513 2595 5005 3299 5569
1911 4323 2303 2801 4095 5751 3707 1629 2796 1449 5177
2349 3154 4214 4611 1077 4512 3846 220 824 3912 5989
1916 1661 2134 5975 2077 4671 5466 5054 712 1929 3882
1533 5356 3949 5560 5353 5373 5885 1570 710 4327 4534
2417 5623 4376 1032 3882 4205 699 696 2801 1190 1890
2006 1160 5549 5536 3315 87 4925 3035 5539 495 3547
2123 3311 4932 1725 5192 5117 4193 339 4411 5375 3094
4247 4713 289 433 1152 5135 2622 1724 5071 2728 4479
4738 3787 131 532 3475 3174 2103 5548 2278 5859 5897
3628 4806 2502 96 1309 4178 4703 4472 5265 5622 2821
3028 5247 3798 4256 5743 5099 5925 4410 5245 1693 2092
3650 302 2603 4793 5291 5782 2952 5761 82 237 2950
4805 1959 4307 670 3790 2907 2710 2430 26 5509 60
2389 1317 5651 232 1517 704 3638 3792 1708 2151 784
4498 4890 2614 121 4824 5669 596 5559 421 1229 518
3636 1495 580 2153 2564 3347 5394 1654 277 5783 1020
827 2968 5705 476 3757 4015 3179 396 4749 1830 3713
753 3706 1268 2688 963 1697 4048 435 4517 873 3190
4220 1504 2353 4044 873 1339 2688 46 3657 5280 5291
1914 3551 5690 4871 1032 5350 1417 4541 2189 118 3757
2150 5393 4184 1637 2326 2633 5692 3656 4182 4131 4978
492 5991 2353 3078 2395 2235 658 184 874 3065 5999
485 1504 2270 2644 3254 5001 5561 930 4441 1853 1586
2245 4659 4174 2682 2673 2391 2242 2830 3384 2041 3709
325 5720 836 5761 5020 5354 5278 1920 1677 2684 2703

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 64


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1321 3767 2068 271 2464 1247 2199 2682 2925 2201 5470
4632 5676 4349 5232 1707 513 3671 1935 2148 2480 1290
1446 3711 2427 849 901 3674 1532 5173 5720 5903 1355
911 2021 2007 1832 2352 4583 1741 5637 5047 4857 5174
5947 3472 2290 5040 3206 4389 3307 4962 3206 4464 203
1903 516 5053 2078 1775 2868 2553 2709 1058 2677 3937
3137 5427 5239 5143 3329 5387 5897 3312 55 4118 2910
3245 1471 356 5001 4851 4146 985 989 2130 4829
5400 1139 1738 3338 1390 1931 4263 5573 2046 4032 5363
5443 1813 1853 5630 3971 4943 633 4092 1258 3020 1442
1617 1155 4922 3576 2582 4372 3517 1127 1321 5357 2285
2792 4994 5444 223 2880 1497 1540 2001 4747 5574 5146
2234 1908 911 2588 1699 96 1744 4586 1145 1137 2019
1467 2348 5776 1031 5301 2712 3505 4092 2975 258 219
3121 4529 3886 4834 4184 5801 815 615 1184 5161
4216 4727 5376 4453 2103 3998 1518 1054 213 2241
5875 3508 453 5599 766 2699 2412 4286 2020 1375 5877
4569 4600 4471 2918 2003 4808 2682 2633 11 2484 2314
5542 1845 4157 4545 1987 2885 3193 5779 995 4930 1093
1837 5580 4533 5264 2647 2468 648 2521 3038 1250 485
3089 724 4447 3324 3471 2283 3579 5460 432 5626 3677
2285 4891 5833 4813 381 1964 4464 2807 2828 5586 5350
196 5504 3633 476 2537 272 5802 4151 5459 1271 2771
1265 3684 1832 5002 46 5893 4605 1076 2002 5694 2363
2729 1223 3794 4868 2149 4627 2093 2151 4141 2280 5520
4764 894 3540 5487 2068 1628 1627 5547 769 5918 4572
2879 1317 4741 198 4233 3406 4205 5705 1609 4059 3449
5883 4573 3623 3181 1762 530 3974 1571 2168 999 2976
3672 4506 2631 211 3701 3530 5956 1723 1412 1550 1913
4117 4523 3860 5012 2177 186 1234 1070 2482 4168 1035
399 3631 3743 2846 1951 5513 3355 2153 2685 443 2962
2011 512 4463 4884 2478 1484 3285 4868 1674 2135 2187
5948 4730 4724 1219 5807 3643 1018 2103 5244 3714 3460
1968 1626 1350 3878 5289 5785 1404 1985 1398 2938 661
5016 957 23 3985 2599 1337 4335 1470 394 4335 5099
2773 3709 4548 3175 5016 2292 3321 3722 2400 4758 3744
976 1796 5402 3991 5415 5325 3361 2922 3655 2038 203
5549 1016 3985 4833 2033 3804 4815 3003 3146 470 5060
4032 4528 2746 5419 5842 3991 3560 2408 4440 1416 1395
1264 88 3707 2968 5895 1591 1400 3377 165 3189 4744
88 5148 5639 1319 2846 4811 4656 4982 1795 872 2713
4876 2853 1952 1450 3 3865 1367 1358 1593 3469 2997
262 1133 5037 1510 3357 442 4600 460 4680 7 895
323 707 4650 3302 3620 450 2766 3469 737 184 2357

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 65


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2592 1157 2699 2738 2613 4869 3892 657 918 3170 3688
1351 5751 1447 4042 819 5489 4115 5838 902 1432 2002
5605 751 4303 2906 5486 5836 859 3513 2922 5617 5302
1465 2994 324 4858 4543 2304 1875 3023 4365 4257 2137
2247 782 5208 3378 5837 3338 2056 2146 2210 2296 456
3709 3932 2851 2594 5904 666 3401 4133 2561 3517 3205
4301 5929 211 4172 2060 1738 435 5188 2600 4292 997
4766 4106 4117 4996 5062 2498 1373 1621 4725 3747 5937
4806 550 1999 2561 5075 1222 5377 188 3077 103 2277
3141 4756 3403 627 2149 2649 4034 1994 5052 831
3800 3451 2854 2386 125 3657 122 4497 1554 3719
1881 496 1796 5731 270 218 445 5485 4075 2845
1858 3334 3511 901 1908 4265 856 5122 1752 1174
2550 3455 3922 2266 2267 749 4655 2329 4766 2967 738
1573 5376 2507 5218 5402 4281 1888 3818 344 4229 5304
480 5342 1793 4035 118 3880 5399 2204 1078 2990 1369
89 664 5134 4875 4738 161 1647 4737 5886 2547 4617
2749 3038 1661 3446 1274 1009 4411 2870 826 1252 1298
2969 5610 5524 5427 5843 1781 5927 4359 4994 4515 2380
2414 2370 1067 3126 5898 47 972 277 4282 2800
1592 1140 4072 4814 660 2489 29 1784 1540 3433 4279
569 1738 1121 1386 2759 2519 171 2644 2922 3512 3216
4393 1575 5434 2108 1180 3353 3937 3434 3849 3263 248
5495 3237 1508 3699 3979 3817 572 1099 5657 1457 4619
458 86 2105 1490 1483 4572 5706 4235 5284 5259 4889
1904 3723 1445 2311 2975 2060 5017 1975 3794 4399 5671
3260 1929 3208 829 2098 4910 5690 5818 4490 5149 3905
942 2528 3802 1978 2960 3358 1171 171 3949 321 3565
1543 4245 4435 610 2925 5190 381 1538 3966 2291 224
4494 4065 4137 3171 4402 4750 3701 3056 1544 5105 3184
4254 1655 310 5490 1960 5519 3363 1592 3948 743 462
5055 3507 909 2263 4569 875 621 5462 299 1058
496 1809 5188 2714 1202 232 1951 2081 452 1015 528
3252 702 4170 1779 2390 1385 837 4816 3858 5050 2675
3780 2720 163 1139 2592 2882 5223 4918 1063 1176 2196
1755 1613 2355 609 4848 1739 1126 4746 1420 4179 3315
2019 4099 5719 2204 3612 3490 3251 5738 2535 22
1444 3588 3651 4941 5924 4316 1357 3645 816 470 3529
2777 2912 714 5842 592 358 995 4583 2040 255 4029
1279 2591 3872 4111 5293 447 4130 2365 1235 1247 5694
45 525 4496 2667 4400 3290 3544 1734 338 3908 3100
3539 1535 3072 617 1455 2392 1471 4525 4963 5454 4369
4628 2152 4773 2176 1881 4396 5659 1517 2155 4224 5271
2803 1469 5422 3896 1682 2065 2940 38 2442 1876 2469

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 66


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4507 3404 618 1521 5294 1458 1835 5372 545 1553 5915
3672 113 4586 2047 712 3054 5926 5999 2633 1107 5274
4448 4919 662 376 3349 2961 4077 2971 2431 4814 2406
5513 5972 5101 2864 556 1484 2763 2863 5597 4279 4534
422 4368 91 5344 5875 5828 15 4961 3597 4753 1506
1535 627 4084 1355 3707 1334 3987 4652 1492 1696 1434
4747 5492 21 5854 5252 5730 4419 4577 3449 1133 3733
3830 3927 3374 3349 3970 4952 4651 4895 2603 2498 2004
1878 3534 825 3692 2612 4154 239 5303 5650 3789 4529
5622 4944 862 3255 456 4253 3262 3940 989 5363 2062
815 4563 3302 1843 5770 3435 1922 601 4372 5727 2579
3326 1204 2366 2525 2903 5168 5115 4164 419 1255 1922
901 3586 3734 2206 1309 786 4312 1369 2966 5451 2766
1777 5468 119 3892 2798 4024 5927 430 4349 5 417
400 3342 2793 5868 3129 5848 458 4186 4692 1831 4324
956 5249 2888 1053 1077 5186 3153 3528 3980 433 1847
2639 1145 2288 2994 732 1842 3238 2121 4374 2956 4730
4662 3731 2508 3031 2149 40 2047 4341 3128 1270 67
3296 3540 1363 3386 1990 1538 4920 3541 1463 1982 3896
2301 1057 2798 4480 4332 4069 2131 3655 2725 2850 5414
1280 3880 5069 4833 4275 3427 944 2609 133 1972 5403
428 5412 394 1487 3567 2705 1803 3088 3210 4631 375
3864 1495 3139 3391 578 3673 5515 2906 1117 3590 3277
3904 3446 5903 3266 5321 5456 4464 5291 5189 2012 2056
8 3179 4210 1519 2186 3335 4819 2419 1479 1232 5480
913 1848 2896 604 5760 4458 5499 4933 3607 837 4430
5074 4068 2239 2067 5204 3375 3212 2041 5854 3434 2885
4176 1084 4319 5295 3403 961 1569 816 1510 3973 1352
5222 2156 1265 4328 5750 1871 5094 1409 4573 5809 5122
4846 5842 2472 3103 2692 3364 2350 1515 1407 5295 4231
5008 1342 4454 2734 5446 2739 1383 799 5394 2929 4919
4602 4701 5792 257 276 5522 3719 2407 1807 2534 3215
4652 989 4258 4985 2121 4257 4879 5109 1545 1590 5918
5345 4166 4064 5446 4132 491 2611 1508 2618 1178 2359
4347 4288 5740 5598 3850 5704 3671 1895 615 5559 1318
1213 655 2223 862 2657 968 985 2622 2424 1086 142
2130 678 139 1097 701 916 3068 1537 2676 580 4867
1684 5600 1849 3733 436 4925 217 1991 4839 5256 4319
1599 1927 4107 4771 73 1831 3561 4667 5950 4579 4096
5574 5495 3767 4143 1001 4059 3095 974 5051 1809 1485
1527 2015 439 2496 2421 4352 577 1061 356 1134 1052
5005 2238 5881 4076 555 3326 2220 3816 488 4851 1158
1302 2664 2483 1276 2728 1594 4941 3949 302 3438 5001
3548 2358 1995 81 613 396 4906 5453 4190 1549 5702

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 67


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5041 4678 4021 1946 3612 819 2238 4532 2326 405 2104
4315 1923 497 2210 109 5840 4684 3669 1538 4660 2773
3596 5973 2932 2462 4369 5684 5875 21 2543 3861 437
306 3752 4194 155 5705 1243 2854 3645 1510 5596 1657
3070 3663 692 2615 1904 3099 5149 5446 4547 5518 891
1807 4826 2484 5961 5903 5274 2002 4618 1499 2454 1422
5752 3190 3375 5373 2770 3756 5514 4266 5419 4864 194
4718 4964 556 3366 3532 448 4737 1609 1884 1208 138
4857 2095 590 4505 2538 3635 5665 1486 5147 3219 230
1810 5936 861 1616 4222 5523 299 3908 3931 3224 2187
2960 5126 3879 5464 1050 1595 1082 5043 1653 5252 3648
1792 2310 5889 5668 646 924 1922 1198 3380 2890 5354
4827 5388 777 109 3387 5789 1634 2507 487 2391 1694
3150 2110 2595 4136 2488 5354 4370 269 2620 3717 4978
4038 5880 1220 1063 1464 4064 1866 1643 2838 5774 2145
687 1111 4897 121 921 5463 5076 4151 2761 1895 679
2282 731 5888 282 3469 1781 2541 1025 1149 1449 3061
3476 1612 5681 5430 3325 968 1121 1250 3634 1632 1710
1537 5946 1569 2393 2026 1581 521 5972 1494 5785 1234
4298 177 1197 4318 4416 2424 1834 5916 4108 4304 246
553 1189 2206 2183 1467 341 4589 3341 4890 1813 3633
149 4219 5414 3091 4382 5738 2174 3672 4282 5523 1860
3242 3169 5708 2163 5227 767 3082 2362 2451 395 3292
2253 1289 3252 3475 4548 1677 2809 5759 1690 343 1860
3365 1845 3579 4702 4129 50 4447 59 2567 1879 1954
2225 1668 4091 1640 1889 3340 1105 4245 3291 4709 3010
5312 1361 5609 1252 3469 3209 4171 3479 5650 3579 4662
336 3068 5976 1056 1905 2273 5709 877 2633 1258 3098
678 1517 5827 1164 1958 388 1434 3792 3694 5173 4181
3884 4454 5461 536 1842 3752 5715 4205 4367 3893 864
503 2481 1527 662 2212 4157 2726 4026 3054 258 1709
808 2650 5627 1882 1900 3693 2468 2047 3551 5726 3236
5532 173 1935 2006 752 3673 4891 5442 4396 1271 247
1891 2531 3680 663 3452 5075 5157 3772 2777 2776 197
3383 4674 2221 3519 596 4445 4275 5554 5319 377 5942
1738 4418 2394 460 5031 4154 4394 5121 2556 3339 4500
541 3420 2468 3089 2548 2944 842 780 3932 1566 5112
1652 5357 1452 5784 4710 4825 5704 2755 5187 585 3099
1505 3545 948 5826 484 2298 490 1810 442 1752 3133
1979 2434 729 3684 2310 2269 972 4346 3984 5849 3501
3170 905 5551 2231 5102 752 4329 4376 3798 4041 5798
5150 1384 5792 5023 4005 747 3706 4616 1092 2397 475
3363 3438 4258 5273 54 3133 1070 477 5562 482 4098
2486 5216 3585 5302 3037 2566 5256 1574 418 737 1857

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 68


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2180 3788 4351 3681 4658 3980 3019 1086 1027 5109 5122
1916 4385 2559 4950 4296 5213 5727 5869 3629 3374 1348
5165 3181 2587 3144 1162 4484 261 5706 3398 2959 942
1369 2233 4410 1728 5936 24 37 3226 998 848 4506
1997 497 5465 880 462 5348 4062 2060 3000 2897 2652
3345 2547 2323 131 868 3346 4560 311 1896 2456 5688
856 3190 588 5300 3201 4735 84 399 4746 474 3058
3092 5580 4705 4218 5815 839 4927 759 5023 3648 864
326 135 4630 3299 782 5323 4537 3914 2895 5706 1703
403 5845 2096 2973 3041 3780 2833 654 4772 3336 4143
3547 5981 3820 4665 4082 2175 5579 3447 4080 4973 891
2071 2971 1208 419 472 3758 2300 5441 1186 4689 2889
4952 108 3149 2060 39 3202 4990 5669 4355 4147 3801
1779 1443 1960 826 844 2694 1473 3883 4969 551 4042
651 2718 5889 1523 5628 1391 3509 2524 5339 1073 122
3915 3690 3112 5215 1246 1897 2767 1461 53 3492 4454
665 1688 1420 2946 4553 830 4316 4722 2798 3956 5644
4692 1296 370 3580 780 2625 1821 3409 2119 4661 547
5576 3873 5072 5546 2292 1397 3099 4019 5565 5735 2090
4561 2695 3208 3577 4657 204 4961 5040 4030 5484 5925
498 5693 803 4024 1491 3574 4791 2926 2131 1694 261
975 4119 2309 3392 4362 5994 3157 2935 3040 36 1574
2367 2689 2801 4057 3471 2090 2219 1209 596 1410 3605
2903 324 2403 1501 4393 636 1761 2563 5754 5924 4123
1692 5057 5508 5031 5136 5931 1095 4799 5736 2762 3753
5083 3619 179 5239 176 3323 61 41 4773 4892 3444
5315 18 3645 2951 3919 1901 881 4234 2427 314 1191
4336 4926 2399 4079 790 3459 177 1367 3125 3380 5506
1196 3245 1560 4635 1186 2391 2106 1921 2692 2038 1597
5458 5044 2765 5701 2360 4779 4561 677 1517 2423 4310
2659 1912 4251 1319 5196 2096 351 1130 4357 2191 3541
1094 5176 5149 2633 153 5675 1288 1332 4791 3257 2442
2109 2029 1997 5194 816 670 5927 5903 751 2576 2463
463 3543 158 1897 5966 741 3013 3525 2456 2517 1311
1447 2641 1028 4476 4089 377 5450 4714 3005 4641 5952
3798 5729 5693 727 3803 847 4726 5345 1056 3761 5708
4533 5188 4993 1362 1078 2815 4457 4124 862 242 4327
858 1425 3008 2558 152 3938 577 687 3671 1321 3707
5690 2165 4429 3086 3189 5950 1763 3347 4174 2996 5021
3025 5439 5016 2878 2846 14 669 5563 4627 764 1862
3103 3104 5495 624 5046 1587 5509 4851 4267 3422 4191
3588 1164 5495 4560 3308 322 2881 5443 2213 4746 2500
1073 312 3075 5125 5932 2650 2260 3499 4673 1516 2281
2784 2160 4074 5991 3339 1223 4130 5748 3416 5366 4087

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 69


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3154 2627 1197 4724 1207 5613 679 1616 4631 5387 1681
747 632 1110 5197 4792 2163 2846 5962 4469 288 4977
3837 2439 1034 5442 2640 26 4307 1061 4088 5009 5859
651 4883 4997 5655 3302 458 401 619 1870 2340 1253
2078 1578 5810 588 2818 4049 3323 4919 1850 841 1356
4197 5117 1603 4877 671 1531 2261 5969 922 2261 4042
2461 3994 4004 2848 3005 273 4241 717 5250 2523 5325
4098 2784 783 2198 1838 5332 5506 819 1215 5899 313
4357 1797 1171 2880 148 5428 1197 1146 2388 2543 4073
2133 3757 3940 2035 1122 3152 5618 3278 1762 911 3622
3100 5698 1633 3351 2401 1359 5894 575 1789 2784 5496
468 757 3589 3947 3752 2436 793 5470 1867 3976 2961
308 4481 1729 1910 2412 944 5927 3048 3748 4959 4711
5509 880 207 1334 5920 5708 1061 5334 4798 206 2628
811 4831 5312 41 4764 5405 2510 644 3125 260 1529
543 274 3459 349 4353 3085 5574 323 1515 3113 3964
583 3075 1340 3444 2737 880 2680 3903 138 5010 3980
2517 3946 3839 3049 5657 4738 5107 1919 4603 3926 5680
1623 3893 3155 5152 575 4807 4368 2140 5906 2806 4116
2772 3757 321 5821 1309 5097 1975 2484 289 4392 1806
3697 3934 1029 832 2813 4998 710 2843 5967 4824 4785
1914 1045 4959 47 5188 3422 2587 4216 46 3441 1164
3518 721 2594 2097 1288 5212 4000 5960 84 1164 4504
2337 4580 3048 1153 5279 2274 292 4706 3699 2726 1774
4184 1099 1551 3747 4821 3337 3634 5977 4480 4534 4111
5944 3443 3523 3731 2730 4386 1710 5081 115 28 1436
4270 3767 1021 3407 5832 5987 4396 198 5009 4485 1749
5667 5569 3247 1414 1437 2437 1041 5336 4533 3454 598
4123 2164 2823 364 2943 1806 5673 2663 5863 1650 4534
3896 5276 4405 69 3450 1230 3943 2855 3071 2979 3794
2965 3439 1266 5241 4138 3164 851 5679 2098 3855 4867
567 695 4300 1963 5425 4017 2937 4031 812 1976 783
3752 4345 473 204 1599 4726 3542 4338 5562 926 5226
240 5348 3440 4910 1416 4771 163 3308 2492 4643 3454
3806 4669 2782 3368 2277 5618 1390 1710 2990 951 3682
4988 4072 1476 5150 1822 4193 5445 2146 936 1368 5654
5350 1351 2727 2736 3495 2440 4911 49 5614 5554 376
2643 3188 1285 3871 3287 4388 4534 2583 4819 3506 3462
3515 300 4537 4930 749 4779 1920 5 4939 4779 2125
5490 5992 1323 5975 2910 4003 2400 3 243 2875 3209
108 2789 2717 1792 3305 2017 1327 4473 3997 4068 4929
3472 958 546 4696 3641 2581 4386 4921 800 2240 3455
290 5362 3624 1200 3002 5360 743 1407 5694 5299 826
5977 960 795 646 2809 2024 3849 1117 356 1923 3001

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 70


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

985 2861 204 853 2623 2133 4312 2402 3355 608 5813
4979 21 4731 418 2776 5906 237 3665 1398 1061 48
4490 20 1643 2849 195 5200 5993 2100 1372 1482 413
4636 1991 2165 76 5479 3381 4434 5726 2948 2899 5317
4555 4875 4491 1432 5186 151 5010 3275 405 3621 1911
392 3245 5378 3470 525 2261 1976 3559 5736 5774 2404
3801 2187 262 2203 2860 5167 1085 4558 2876 4497 494
3589 3408 4822 4667 5758 1889 2211 5048 432 5988 800
3496 406 5145 4316 4892 2115 5261 557 235 3230 1266
285 5857 1036 5756 589 328 1002 3216 4837 576 5081
2799 3752 735 5998 5039 5771 595 2608 4676 597 1548
4134 2845 3684 3001 5533 448 5988 673 3244 2497 3480
5761 4054 115 4526 722 1962 2127 1374 3297 3941 4715
3610 1023 3137 3526 3628 405 2909 4022 1916 4875 3333
4459 5528 540 2113 4473 1240 3214 5324 2687 839 5670
2341 5812 2564 2118 173 2580 3707 5415 39 1186 3896
1690 488 4864 5168 1043 5301 2293 282 1334 998 3455
2946 4582 2791 5101 4152 1385 686 5291 1688 2881 5414
5716 5042 493 2021 2448 5631 1008 3969 2855 5334 2207
5422 1422 147 4826 2154 736 5108 3814 2964 4504 5714
2847 5320 3049 4736 1986 523 5975 3938 1570 3284 5031
1980 3519 3665 4144 157 3174 5643 5910 5303 2754 4901
366 1888 2891 1554 805 1648 4548 3853 4755 3121 2282
4646 1503 5017 3705 3895 4516 2794 1689 5528 5022 3349
3051 5944 795 5365 615 3592 3753 4089 5057 5489 1547
2775 723 1815 4993 1621 780 4540 1289 525 4054 4455
5402 5943 479 1249 4718 2253 180 1614 1782 2253 2607
3072 5851 1145 2939 452 0 2986 3558 4492 1685 1455
3094 1734 5916 2918 2716 4337 4147 2674 4138 1339 5095
4076 5205 1236 2679 1477 4168 583 110 5997 5422 1149
2248 5824 2155 5148 1938 4233 5199 402 1114 4200 2361
4822 37 3777 59 135 1679 5927 47 3707 5143 72
4589 734 265 230 4329 2192 2619 343 5844 4338 4053
703 1991 5466 351 4614 4848 413 3790 664 1838 4716
2828 412 775 5855 432 3851 5656 2349 5076 5554 1531
998 3275 1396 5750 2442 3254 3861 4952 5181 4626 3445
5340 3126 631 5294 4233 674 3727 4502 1700 5336 5168
4387 5058 3813 53 2284 762 2721 1982 2998 1893 1156
519 695 2213 3755 4550 158 67 3152 16 4972 1720
2420 3014 1528 1557 2037 3039 3539 160 4216 2572 5528
555 2269 4857 4039 5233 5295 4926 1207 5954 660 3133
3552 238 2549 3285 1716 5118 864 2197 1818 3505 4368
4105 3577 4834 3306 2610 3017 1037 3404 1671 2655 2587
824 1039 3626 4385 237 4697 1796 3649 2530 4168 2133

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 71


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5593 30 5381 578 1710 2841 2629 3037 1739 658 4560
4517 1472 4174 4030 5983 2267 4513 1148 1497 1567 5633
5320 3207 3209 2515 5752 4834 351 3895 2692 4704 5071
590 113 779 787 3268 5461 4074 1345 4279 5639 3830
2631 3117 3269 4535 1758 4982 2633 498 1680 5865 3071
217 1421 3593 3889 2958 4986 5330 2726 1221 1363 1057
5563 1344 3889 5693 4569 4858 4689 1925 4686 4348 2376
705 5884 3669 4469 2434 3365 4503 2767 5360 5898 2161
1354 1287 325 790 4895 318 4685 3389 510 5302 4408
1523 2923 5963 2518 1469 3755 1931 5950 714 2008 2136
3963 1912 2486 1477 1356 2316 3190 1177 4010 1129 5653
5666 2266 4252 3243 5100 2282 5981 298 5748 1988 1627
3761 4089 390 2790 1667 5155 2064 1820 234 2914 1575
1587 3150 2804 3300 3338 3004 3480 1544 52 1034 1296
5946 2786 553 5042 1310 1035 2011 2789 2241 5744 3153
316 1954 322 254 3583 3902 3370 1691 5616 1334 1106
3703 5504 3653 1437 5848 525 1812 5295 4481 5486 2711
2439 2234 1971 3678 2645 4558 1338 2731 3788 3273 5766
3727 832 3722 928 2671 5813 266 3594 3531 623 253
1324 5999 3968 3740 1674 1748 773 613 3756 5372 3914
1400 286 3193 524 933 3878 1814 2884 1166 42 5315
119 3345 2678 1421 2807 3043 5907 1148 5924 2028 697
2401 583 819 5578 1052 10 368 5248 2834 5625 5073
2176 5911 3295 1464 4651 1396 838 3826 4251 2685 3453
5971 4192 2731 4230 3198 4072 3644 3178 4354 5126 1659
154 3776 2658 1297 5359 4667 4185 377 339 3877 5830
5871 1579 4768 3125 3269 588 2591 3179 5296 2103 3837
4053 2273 959 4339 5784 4412 2568 1124 575 2317 4595
2049 4771 1855 2476 5317 4851 1390 5870 774 3218 1620
1010 2733 26 4691 3925 746 2609 3187 5522 5022 5812
5123 3162 2204 867 393 2497 1595 959 2018 2087 4664
4121 1251 2455 141 4838 5786 2850 607 549 471 2024
3985 2450 3066 4749 2875 5531 5322 4486 5273 3045 2911
2979 4573 3218 5840 4047 2662 4072 792 3441 5089 5013
4978 4574 2175 4015 282 852 2945 2966 1807 5222 3770
4301 2904 4275 5815 984 2022 1838 1783 3782 1432 2307
4945 2162 3548 4781 4490 1816 5851 5494 331 383 3986
3060 4252 5348 128 202 711 947 477 4273 4748 3455
2495 4125 2887 790 1193 5375 1800 5831 561 5178 5256
3595 656 4446 3775 2472 4595 608 2194 5645 2809 4538
633 4270 4697 4000 1908 4280 4625 174 1587 3229 1418
5779 5459 2618 4114 4371 2960 88 688 1440 3750 1569
3356 4376 5188 2847 2660 4401 213 60 915 4862 2506
462 370 391 161 1583 4690 1893 5072 773 4597 5296

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 72


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3284 3842 2241 1856 4467 1574 3522 2633 1876 8 1961
4435 1473 4257 5604 1206 1991 5244 5140 2432 1837 1831
833 5799 2487 4584 4169 2765 4791 5977 2216 4046 391
5946 3649 1086 1994 2809 1493 3151 2146 2734 4417 2015
1114 664 2047 2530 5362 2203 784 283 1154 5241 2085
2133 2371 5939 2731 3209 3807 2881 122 2028 3000 3779
4217 3402 810 1108 3593 234 3423 166 2844 2438 1208
5754 4404 4081 2913 2282 4096 300 4870 2482 1286 1654
4619 838 375 1485 5017 4027 3325 1881 694 3095 1063
1678 5457 5880 627 2206 3379 1172 2320 3125 1968 578
5328 1158 59 1679 907 4754 1490 3825 4663 3386 280
722 1888 133 2938 1720 184 5065 1139 3755 2937 119
1845 3976 3475 4981 1357 1579 4846 1248 3624 1237 712
4617 2378 1029 182 5776 2262 316 5112 5132 2446 3390
2147 811 3399 775 464 3647 2145 5847 3066 1505 2271
2294 339 2975 5424 186 5801 328 4103 5003 5794 1819
2688 5188 3178 1997 5193 150 5207 1929 5631 5629 3507
1082 2438 3434 1521 1003 1739 3044 2337 2787 5520 1394
5067 1924 3213 3161 152 1883 2569 4328 5871 1534 3477
489 4117 3688 4194 132 4522 1062 2450 5836 4503 5392
5111 3748 3523 5229 3791 65 939 4827 1205 4976 1023
1901 1787 5597 540 862 5536 547 3236 4655 583 4564
5387 4436 5737 2447 3608 4845 3122 1154 3760 5531 483
1310 5015 2845 5795 4815 1362 3029 2657 3013 1204 183
668 5931 3985 5099 5790 4984 2994 3002 2285 4852 176
1393 2492 3698 4614 498 610 394 5836 2365 3554 2881
5517 1292 5027 3173 837 5227 2231 5080 4585 5822 856
4142 5187 395 3497 4978 2682 4216 4213 2100 4949 1
4835 4634 371 1729 5825 1466 5707 1204 596 1961 4674
5499 3686 1506 1125 2873 3111 574 2027 3170 2869 2130
5888 4964 3204 4363 5947 4332 2068 702 5968 104 3524
4212 5778 3754 5642 2047 5751 1061 969 5644 1820 1380
618 4446 4778 3133 5465 1551 5663 3951 2983 2347 5438
3540 130 4796 2852 3744 3967 5105 2497 1987 2330 1100
795 302 22 4701 4192 5537 753 1017 2292 665 5335
3290 1722 5196 5362 389 3620 5090 3604 3788 2402 863
3535 4567 1213 2783 245 3759 4809 4497 2116 495 945
3436 289 3630 1019 2984 5529 3036 786 5044 3303 3
1694 2781 2667 4126 4858 4485 4520 1611 3778 981 1497
2469 1794 4627 2399 5971 513 3991 4572 3821 4654 2936
3940 3135 598 160 3278 5389 3263 1041 2911 339 3674
2801 1977 4040 2097 5916 4077 945 3255 5762 5272 1152
2328 3188 4116 1594 5842 2731 2730 1944 3870 1751 4429
871 1135 1642 75 4987 1256 827 1910 4208 2084 2430

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 73


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

872 811 1476 302 2212 739 1288 5238 846 3531 2993
5996 122 5840 5464 4876 787 2244 4727 2329 860 394
638 5062 5964 5647 954 3888 1882 1782 5636 3352 1764
4021 2727 3343 223 145 2574 5716 2957 814 5878 4820
167 3677 3106 3365 4490 1611 5882 95 3056 5349 4135
5016 3700 3048 3511 1121 2242 3965 5345 1188 3956 5577
5858 4055 548 3777 5041 4750 2458 1118 5763 4106 1363
3915 5677 1782 4770 2887 2551 2173 4747 4513 3596 794
5748 4618 1081 1163 5655 100 5558 1337 677 717 5538
3284 995 935 324 1458 5323 996 5450 4332 4217 5415
4751 3104 5246 676 303 2840 3724 283 4082 3876 556
129 3895 671 1743 399 5376 952 5439 3911 4810 2764
3256 1238 3626 2333 4643 1764 1431 3 3164 3471 3203
1017 3322 2742 2463 2281 3914 4652 4043 5322 3289 3229
2700 2754 2484 775 4679 3350 3074 4331 920 1330 1539
3463 5042 5977 1643 4817 1293 3941 3473 4258 3213 5369
1914 5809 4250 5403 813 1773 4401 4795 3569 1060 1216
880 1828 51 5577 2749 2670 2643 3037 2841 4096 1601
3658 3126 3499 3041 3037 2221 1212 265 999 5346 5456
943 2458 1589 5891 2862 4187 97 5742 4819 4923 4943
2044 755 2405 3302 2553 1779 5929 4914 1209 4492 4573
5400 2358 2264 1991 4430 5785 637 4713 3971 3852 1146
557 3143 3866 1067 4614 4126 3941 3014 3709 5827 280
2278 1966 2949 5572 2193 1478 546 1531 5075 3783 2974
4964 4035 3998 1130 2153 828 2658 5978 770 2511 2301
395 2403 3078 1448 1867 5266 1876 5635 5511 1031 4035
4170 1421 5278 5111 3810 1312 3433 4658 1506 4310 4525
2780 5012 3467 5980 6 940 2584 3474 1182 1927 3152
336 2705 2011 2116 5758

 The sorted array is :-


0 1 3 3 3 3 5 5 6 7 8 8
10 11 14 15 16 18 20 21 21 21 22 22
23 24 26 26 26 26 28 29 30 36 37 37
38 39 39 40 41 41 42 42 45 46 46 46
47 47 47 48 49 50 51 52 53 53 54 55
59 59 59 60 60 61 65 67 67 69 71 72
73 75 76 81 82 84 84 86 87 88 88 88
89 91 95 96 96 97 100 103 104 108 108 109
109 110 111 113 113 115 115 118 118 119 119 119
121 121 121 122 122 122 122 125 128 129 130 131
131 132 133 133 135 135 138 138 139 141 142 145
147 148 149 150 151 152 152 153 154 155 157 158

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 74


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

158 160 160 161 161 163 163 165 166 167 171 171
173 173 174 176 176 177 177 179 180 182 183 184
184 184 186 186 188 194 195 196 197 198 198 202
203 203 204 204 204 206 207 211 211 213 213 217
217 218 219 220 223 223 224 230 230 230 232 232
234 234 235 237 237 237 238 239 240 242 243 245
246 247 248 253 254 255 257 258 258 260 261 261
262 262 265 265 266 269 270 271 272 273 274 276
277 277 280 280 282 282 282 283 283 285 286 288
289 289 289 290 292 298 299 299 300 300 302 302
302 302 303 306 308 310 311 312 313 314 316 316
318 321 321 322 322 323 323 324 324 324 325 325
326 328 328 331 336 336 338 339 339 339 339 341
343 343 344 349 351 351 351 356 356 356 358 358
364 366 368 370 370 371 375 375 376 376 377 377
377 381 381 383 388 389 390 391 391 392 393 394
394 394 394 395 395 395 396 396 399 399 399 400
401 402 403 405 405 405 406 412 413 413 417 418
418 419 419 421 422 428 430 432 432 432 433 433
435 435 436 437 439 442 442 443 445 447 448 448
450 452 452 453 456 456 458 458 458 460 460 462
462 462 463 464 468 470 470 471 472 473 474 475
476 476 477 477 479 480 481 482 483 484 485 485
487 488 488 489 490 491 492 493 494 494 495 495
496 496 497 497 498 498 498 503 510 512 513 513
516 518 518 519 521 523 524 525 525 525 525 528
530 532 536 540 540 541 543 545 546 546 547 547
548 549 550 551 553 553 555 555 556 556 556 557
557 561 567 569 572 572 574 575 575 575 576 577
577 578 578 578 580 580 583 583 583 583 585 588
588 588 589 590 590 592 595 596 596 596 596 597
598 598 601 604 606 607 608 608 609 610 610 613
613 615 615 615 617 618 618 619 621 623 624 627
627 627 631 632 633 633 636 637 638 644 646 646
648 651 651 654 655 656 657 658 658 660 660 661
662 662 663 664 664 664 665 665 666 668 669 670
670 671 671 673 674 676 677 677 678 678 679 679
686 687 687 688 692 694 695 695 696 697 699 701
702 702 703 704 705 707 710 710 711 712 712 712
714 714 717 717 721 722 722 723 724 727 729 731
732 734 735 736 737 737 737 738 739 741 743 743
746 747 747 749 749 751 751 752 752 753 753 755
757 759 762 764 766 767 768 769 770 773 773 774
775 775 775 777 779 780 780 780 782 782 783 783

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 75


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

784 784 786 786 787 787 790 790 790 792 793 794
795 795 795 799 800 800 803 805 808 810 811 811
811 812 813 814 815 815 816 816 816 819 819 819
819 824 824 825 826 826 826 827 827 828 829 830
831 832 832 833 836 837 837 837 838 838 839 839
841 842 844 846 847 848 849 851 852 853 856 856
856 858 859 860 861 862 862 862 862 863 864 864
864 867 868 871 872 872 873 873 874 875 877 880
880 880 880 881 891 891 894 895 901 901 901 902
905 907 909 911 911 911 913 915 916 918 920 921
922 924 926 928 930 933 935 936 939 940 942 942
943 944 944 945 945 947 948 951 952 954 956 957
958 959 959 960 961 963 968 968 969 972 972 974
975 976 981 984 985 985 985 989 989 989 995 995
995 996 997 998 998 998 999 999 1001 1002 1003
1008 1009 1010 1015 1016 1017 1017 1018 1019 1020 1021
1023 1023 1025 1027 1028 1029 1029 1031 1031 1032 1032
1034 1034 1035 1035 1036 1037 1039 1041 1041 1043 1045
1050 1052 1052 1053 1054 1056 1056 1057 1057 1058 1058
1060 1061 1061 1061 1061 1061 1062 1063 1063 1063 1067
1067 1070 1070 1073 1073 1076 1077 1077 1078 1078 1081
1082 1082 1084 1085 1086 1086 1086 1092 1093 1094 1095
1097 1099 1099 1100 1105 1106 1107 1108 1110 1111 1114
1114 1117 1117 1118 1121 1121 1121 1122 1124 1125 1126
1127 1129 1130 1130 1133 1133 1134 1135 1137 1139 1139
1139 1140 1145 1145 1145 1146 1146 1148 1148 1149 1149
1152 1152 1153 1154 1154 1155 1156 1157 1158 1158 1160
1162 1163 1164 1164 1164 1164 1166 1171 1171 1172 1174
1176 1177 1178 1180 1182 1184 1186 1186 1186 1188 1189
1190 1191 1193 1196 1197 1197 1197 1198 1200 1202 1204
1204 1204 1205 1206 1207 1207 1208 1208 1208 1209 1209
1212 1213 1213 1215 1216 1219 1220 1221 1222 1223 1223
1229 1230 1232 1234 1234 1235 1236 1237 1238 1240 1243
1246 1247 1247 1248 1249 1250 1250 1251 1252 1252 1253
1255 1256 1258 1258 1264 1265 1265 1266 1266 1268 1270
1271 1271 1274 1276 1279 1280 1285 1286 1287 1288 1288
1288 1289 1289 1290 1292 1293 1296 1296 1297 1298 1302
1309 1309 1309 1310 1310 1311 1312 1317 1317 1318 1319
1319 1321 1321 1321 1323 1324 1327 1330 1332 1334 1334
1334 1334 1337 1337 1338 1339 1339 1340 1340 1342 1344
1345 1348 1350 1351 1351 1352 1354 1355 1355 1356 1356
1357 1357 1358 1359 1361 1362 1362 1363 1363 1363 1367
1367 1368 1369 1369 1369 1372 1373 1374 1375 1380 1383
1384 1385 1385 1386 1390 1390 1390 1391 1393 1394 1395

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 76


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1396 1396 1397 1398 1398 1400 1400 1404 1407 1407 1409
1410 1412 1414 1416 1416 1417 1418 1420 1420 1421 1421
1421 1422 1422 1425 1431 1432 1432 1432 1434 1434 1436
1437 1437 1440 1442 1443 1444 1445 1446 1447 1447 1448
1449 1449 1450 1451 1452 1455 1455 1457 1458 1458 1461
1463 1464 1464 1465 1466 1467 1467 1469 1469 1470 1471
1471 1472 1473 1473 1476 1476 1477 1477 1478 1479 1482
1483 1484 1484 1485 1485 1486 1487 1490 1490 1491 1492
1492 1493 1494 1495 1495 1497 1497 1497 1499 1501 1503
1504 1504 1505 1505 1506 1506 1506 1508 1508 1510 1510
1510 1515 1515 1516 1517 1517 1517 1517 1518 1519 1521
1521 1523 1523 1527 1527 1528 1529 1531 1531 1531 1532
1533 1534 1535 1535 1537 1537 1537 1538 1538 1538 1539
1540 1540 1543 1544 1544 1545 1547 1548 1549 1550 1551
1551 1553 1553 1554 1554 1557 1560 1566 1567 1569 1569
1569 1570 1570 1571 1573 1574 1574 1574 1575 1575 1578
1579 1579 1581 1583 1586 1587 1587 1587 1589 1590 1591
1592 1592 1593 1594 1594 1595 1595 1597 1599 1599 1601
1603 1609 1609 1611 1611 1612 1613 1614 1616 1616 1617
1620 1621 1621 1623 1626 1627 1627 1628 1629 1632 1632
1633 1634 1637 1640 1642 1643 1643 1643 1647 1648 1650
1652 1653 1654 1654 1655 1657 1659 1661 1661 1667 1668
1671 1674 1674 1677 1677 1678 1679 1679 1680 1681 1682
1684 1685 1688 1688 1689 1690 1690 1691 1692 1693 1694
1694 1694 1696 1697 1699 1700 1703 1707 1708 1709 1710
1710 1710 1710 1716 1720 1720 1722 1723 1724 1725 1728
1729 1729 1734 1734 1738 1738 1738 1738 1739 1739 1739
1741 1743 1744 1748 1749 1751 1752 1752 1755 1758 1761
1762 1762 1763 1764 1764 1773 1774 1775 1777 1779 1779
1779 1781 1781 1782 1782 1782 1783 1784 1787 1789 1792
1792 1793 1794 1795 1796 1796 1796 1797 1800 1803 1806
1806 1807 1807 1807 1809 1809 1810 1810 1812 1813 1813
1814 1815 1816 1818 1819 1820 1820 1821 1822 1828 1830
1831 1831 1831 1832 1832 1834 1835 1837 1837 1838 1838
1838 1842 1842 1843 1845 1845 1845 1847 1847 1848 1849
1850 1853 1853 1855 1856 1857 1858 1860 1860 1862 1866
1867 1867 1870 1871 1875 1876 1876 1876 1878 1879 1881
1881 1881 1882 1882 1883 1884 1888 1888 1888 1889 1889
1890 1891 1893 1893 1895 1895 1896 1897 1897 1900 1901
1901 1903 1904 1904 1905 1908 1908 1908 1910 1910 1911
1911 1912 1912 1913 1914 1914 1914 1916 1916 1916 1919
1920 1920 1921 1922 1922 1922 1923 1923 1924 1925 1927
1927 1929 1929 1929 1931 1931 1935 1935 1938 1944 1946
1951 1951 1952 1954 1954 1958 1959 1960 1960 1961 1961

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 77


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

1962 1963 1964 1966 1968 1968 1971 1972 1974 1975 1975
1976 1976 1977 1978 1979 1980 1982 1982 1985 1986 1987
1987 1988 1990 1991 1991 1991 1991 1991 1994 1994 1995
1997 1997 1997 1999 2001 2002 2002 2002 2003 2004 2006
2006 2007 2008 2011 2011 2011 2012 2015 2015 2017 2018
2019 2019 2020 2021 2021 2022 2024 2024 2026 2027 2028
2028 2029 2033 2035 2037 2038 2038 2040 2041 2041 2044
2046 2047 2047 2047 2047 2047 2049 2056 2056 2060 2060
2060 2060 2062 2064 2065 2067 2068 2068 2068 2071 2077
2078 2078 2081 2084 2085 2087 2090 2090 2092 2093 2095
2096 2096 2097 2097 2098 2098 2100 2100 2103 2103 2103
2103 2103 2104 2105 2106 2108 2109 2110 2113 2115 2116
2116 2118 2119 2121 2121 2123 2125 2127 2130 2130 2130
2131 2131 2133 2133 2133 2133 2134 2135 2136 2137 2140
2145 2145 2146 2146 2146 2147 2148 2149 2149 2149 2150
2151 2151 2152 2153 2153 2153 2154 2155 2155 2156 2160
2161 2162 2163 2163 2164 2165 2165 2168 2170 2173 2174
2175 2175 2176 2176 2177 2180 2183 2186 2187 2187 2187
2189 2191 2192 2193 2194 2196 2197 2198 2199 2201 2203
2203 2204 2204 2204 2206 2206 2206 2207 2210 2210 2211
2212 2212 2213 2213 2216 2219 2220 2221 2221 2223 2225
2231 2231 2233 2234 2234 2235 2238 2238 2239 2240 2241
2241 2241 2241 2242 2242 2244 2245 2247 2248 2253 2253
2253 2260 2261 2261 2261 2262 2263 2264 2266 2266 2267
2267 2269 2269 2270 2271 2273 2273 2274 2277 2277 2278
2278 2280 2281 2281 2282 2282 2282 2282 2283 2284 2285
2285 2285 2288 2290 2291 2292 2292 2292 2293 2294 2296
2298 2300 2301 2301 2303 2304 2307 2309 2310 2310 2311
2314 2316 2317 2320 2323 2326 2326 2328 2329 2329 2330
2333 2337 2337 2340 2341 2347 2348 2349 2349 2350 2352
2353 2353 2355 2357 2358 2358 2359 2360 2361 2362 2363
2365 2365 2366 2367 2367 2370 2371 2376 2378 2380 2386
2388 2389 2390 2391 2391 2391 2392 2393 2394 2395 2397
2397 2399 2399 2400 2400 2401 2401 2402 2402 2403 2403
2404 2405 2406 2407 2408 2412 2412 2414 2417 2419 2420
2421 2423 2424 2424 2427 2427 2430 2430 2431 2432 2434
2434 2436 2437 2438 2438 2439 2439 2440 2442 2442 2442
2446 2447 2448 2450 2450 2451 2454 2455 2456 2456 2458
2458 2461 2462 2463 2463 2464 2468 2468 2468 2469 2469
2472 2472 2476 2478 2480 2481 2482 2482 2483 2484 2484
2484 2484 2486 2486 2487 2488 2489 2492 2492 2495 2496
2497 2497 2497 2498 2498 2500 2502 2506 2507 2507 2508
2510 2511 2515 2517 2517 2518 2519 2521 2523 2524 2525
2528 2530 2530 2531 2534 2535 2537 2538 2541 2543 2543

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 78


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

2547 2547 2548 2549 2550 2551 2553 2553 2556 2558 2559
2561 2561 2563 2564 2564 2566 2567 2568 2569 2572 2574
2576 2579 2580 2581 2582 2583 2584 2587 2587 2587 2588
2591 2591 2592 2592 2594 2594 2595 2595 2599 2600 2603
2603 2607 2608 2609 2609 2610 2611 2612 2613 2614 2615
2618 2618 2619 2620 2622 2622 2623 2625 2627 2628 2629
2631 2631 2633 2633 2633 2633 2633 2633 2633 2639 2640
2641 2643 2643 2644 2644 2645 2647 2649 2650 2650 2650
2652 2655 2657 2657 2658 2658 2659 2660 2662 2663 2664
2667 2667 2670 2671 2673 2674 2675 2676 2677 2678 2679
2680 2682 2682 2682 2682 2684 2685 2685 2687 2688 2688
2688 2689 2692 2692 2692 2694 2695 2699 2699 2700 2703
2705 2705 2709 2710 2711 2712 2713 2714 2716 2717 2718
2720 2721 2725 2726 2726 2726 2727 2727 2728 2728 2729
2730 2730 2731 2731 2731 2731 2733 2734 2734 2736 2737
2738 2739 2742 2746 2749 2749 2754 2754 2755 2759 2761
2762 2763 2764 2765 2765 2766 2766 2767 2767 2770 2771
2772 2773 2773 2775 2776 2776 2777 2777 2780 2781 2782
2783 2784 2784 2784 2786 2787 2789 2789 2790 2791 2792
2793 2794 2796 2798 2798 2798 2799 2800 2801 2801 2801
2801 2803 2804 2806 2807 2807 2809 2809 2809 2809 2812
2813 2815 2818 2821 2823 2828 2828 2830 2833 2834 2838
2840 2841 2841 2843 2844 2845 2845 2845 2846 2846 2846
2846 2847 2847 2848 2849 2850 2850 2851 2852 2853 2854
2854 2855 2855 2860 2861 2862 2863 2864 2868 2869 2870
2873 2875 2875 2876 2878 2879 2880 2880 2881 2881 2881
2881 2882 2884 2885 2885 2887 2887 2888 2889 2890 2891
2895 2896 2897 2899 2903 2903 2904 2906 2906 2907 2909
2910 2910 2911 2911 2912 2913 2914 2918 2918 2922 2922
2922 2923 2925 2925 2926 2929 2932 2935 2936 2937 2937
2938 2938 2939 2940 2943 2944 2945 2946 2946 2948 2949
2950 2951 2952 2956 2957 2958 2959 2960 2960 2960 2961
2961 2962 2964 2965 2966 2966 2967 2968 2968 2969 2971
2971 2973 2974 2975 2975 2975 2976 2979 2979 2983 2984
2986 2990 2990 2993 2994 2994 2994 2996 2997 2998 3000
3000 3001 3001 3002 3002 3003 3004 3005 3005 3008 3010
3013 3013 3014 3014 3017 3019 3020 3023 3025 3028 3028
3029 3031 3035 3036 3037 3037 3037 3037 3038 3038 3039
3040 3041 3041 3043 3044 3045 3048 3048 3048 3049 3049
3051 3054 3054 3056 3056 3058 3060 3061 3065 3066 3066
3068 3068 3070 3071 3071 3072 3072 3074 3075 3075 3077
3078 3078 3082 3085 3086 3088 3089 3089 3091 3092 3094
3094 3095 3095 3098 3099 3099 3099 3100 3100 3103 3103
3104 3104 3106 3111 3111 3112 3113 3117 3121 3121 3122

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 79


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3125 3125 3125 3125 3126 3126 3126 3128 3129 3133 3133
3133 3133 3135 3137 3137 3139 3141 3143 3144 3146 3149
3150 3150 3151 3152 3152 3152 3153 3153 3154 3154 3155
3157 3161 3162 3164 3164 3169 3169 3170 3170 3170 3171
3173 3174 3174 3175 3178 3178 3179 3179 3179 3181 3181
3184 3187 3188 3188 3189 3189 3190 3190 3190 3190 3193
3193 3198 3201 3202 3203 3204 3205 3206 3206 3207 3208
3208 3209 3209 3209 3209 3210 3212 3213 3213 3214 3215
3216 3216 3218 3218 3219 3224 3226 3229 3229 3230 3236
3236 3237 3238 3242 3243 3244 3245 3245 3245 3247 3251
3252 3252 3254 3254 3255 3255 3256 3257 3260 3262 3263
3263 3266 3268 3269 3269 3273 3275 3275 3277 3278 3278
3284 3284 3284 3285 3285 3287 3289 3290 3290 3291 3292
3295 3296 3297 3299 3299 3300 3302 3302 3302 3302 3303
3305 3306 3307 3308 3308 3311 3312 3315 3315 3321 3322
3323 3323 3324 3325 3325 3326 3326 3329 3333 3334 3335
3336 3337 3338 3338 3338 3339 3339 3340 3341 3342 3343
3345 3345 3346 3347 3347 3349 3349 3349 3350 3351 3352
3353 3355 3355 3356 3357 3358 3361 3363 3363 3364 3365
3365 3365 3366 3368 3370 3374 3374 3375 3375 3377 3378
3379 3380 3380 3381 3383 3384 3386 3386 3387 3389 3390
3391 3392 3398 3399 3401 3402 3403 3403 3404 3404 3406
3407 3408 3409 3416 3420 3422 3422 3423 3427 3433 3433
3434 3434 3434 3435 3436 3438 3438 3439 3440 3441 3441
3443 3444 3444 3445 3446 3446 3447 3449 3449 3450 3451
3452 3453 3454 3454 3455 3455 3455 3455 3459 3459 3460
3462 3463 3467 3469 3469 3469 3469 3470 3471 3471 3471
3472 3472 3473 3474 3475 3475 3475 3476 3477 3479 3480
3480 3490 3492 3495 3496 3497 3499 3499 3501 3505 3505
3506 3507 3507 3508 3509 3511 3511 3512 3513 3513 3515
3517 3517 3518 3519 3519 3519 3522 3523 3523 3524 3525
3526 3528 3529 3530 3531 3531 3532 3534 3535 3539 3539
3540 3540 3540 3541 3541 3542 3543 3544 3545 3547 3547
3548 3548 3551 3551 3552 3554 3558 3559 3560 3561 3565
3567 3569 3574 3576 3577 3577 3579 3579 3579 3580 3583
3585 3586 3588 3588 3589 3589 3590 3592 3593 3593 3594
3595 3596 3596 3597 3604 3605 3607 3608 3610 3612 3612
3619 3620 3620 3621 3622 3623 3624 3624 3626 3626 3628
3628 3629 3630 3631 3633 3633 3634 3634 3635 3636 3638
3641 3643 3644 3645 3645 3645 3647 3648 3648 3649 3649
3650 3651 3653 3655 3655 3656 3657 3657 3658 3663 3665
3665 3669 3669 3671 3671 3671 3672 3672 3672 3673 3673
3674 3674 3677 3677 3678 3680 3681 3682 3684 3684 3684
3686 3688 3688 3690 3692 3693 3694 3697 3698 3699 3699

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 80


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

3700 3701 3701 3703 3705 3706 3706 3707 3707 3707 3707
3707 3707 3709 3709 3709 3709 3711 3713 3714 3717 3719
3719 3720 3722 3722 3723 3724 3727 3727 3731 3731 3733
3733 3734 3740 3743 3744 3744 3747 3747 3748 3748 3750
3752 3752 3752 3752 3752 3753 3753 3754 3755 3755 3755
3756 3756 3757 3757 3757 3757 3758 3759 3760 3761 3761
3767 3767 3767 3770 3772 3775 3776 3777 3777 3778 3779
3780 3780 3782 3783 3787 3788 3788 3788 3789 3790 3790
3791 3792 3792 3794 3794 3794 3798 3798 3798 3800 3801
3801 3802 3803 3804 3806 3807 3810 3813 3814 3815 3816
3817 3818 3820 3821 3825 3826 3830 3830 3837 3837 3839
3842 3846 3849 3849 3850 3851 3852 3853 3855 3858 3860
3861 3861 3864 3865 3866 3870 3871 3872 3873 3876 3877
3878 3878 3879 3880 3880 3882 3882 3883 3884 3886 3888
3889 3889 3892 3892 3893 3893 3895 3895 3895 3896 3896
3896 3896 3902 3903 3904 3905 3908 3908 3911 3912 3914
3914 3914 3915 3915 3919 3922 3925 3926 3927 3931 3932
3932 3933 3934 3937 3937 3938 3938 3940 3940 3940 3941
3941 3941 3943 3946 3947 3948 3949 3949 3949 3951 3956
3956 3956 3963 3964 3965 3966 3967 3968 3969 3970 3971
3971 3973 3974 3976 3976 3979 3980 3980 3980 3984 3985
3985 3985 3985 3986 3987 3991 3991 3991 3994 3997 3998
3998 4000 4000 4003 4004 4005 4010 4015 4015 4017 4019
4021 4021 4022 4024 4024 4026 4027 4029 4030 4030 4031
4032 4032 4034 4035 4035 4035 4038 4039 4040 4041 4042
4042 4042 4043 4044 4046 4047 4048 4049 4053 4053 4054
4054 4055 4057 4059 4059 4062 4064 4064 4065 4068 4068
4069 4072 4072 4072 4072 4073 4074 4074 4075 4076 4076
4077 4077 4079 4080 4081 4082 4082 4084 4087 4088 4089
4089 4089 4091 4092 4092 4095 4096 4096 4096 4098 4098
4099 4103 4105 4106 4106 4107 4108 4111 4111 4114 4115
4116 4116 4117 4117 4117 4118 4119 4121 4123 4123 4124
4125 4126 4126 4129 4130 4130 4131 4132 4133 4134 4135
4136 4137 4138 4138 4141 4142 4143 4143 4144 4146 4147
4147 4151 4151 4152 4154 4154 4157 4157 4164 4166 4168
4168 4168 4169 4170 4170 4171 4172 4174 4174 4174 4176
4178 4179 4181 4182 4184 4184 4184 4185 4186 4187 4190
4191 4192 4192 4193 4193 4194 4194 4197 4200 4205 4205
4205 4208 4210 4212 4213 4214 4216 4216 4216 4216 4217
4217 4218 4219 4220 4222 4224 4229 4230 4231 4233 4233
4233 4234 4235 4241 4245 4245 4247 4250 4251 4251 4252
4252 4253 4254 4256 4257 4257 4257 4258 4258 4258 4263
4265 4266 4267 4270 4270 4273 4275 4275 4275 4279 4279
4279 4280 4281 4282 4282 4286 4288 4292 4296 4298 4300

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 81


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4301 4301 4303 4304 4307 4307 4310 4310 4312 4312 4315
4316 4316 4316 4318 4319 4319 4323 4324 4327 4327 4328
4328 4329 4329 4331 4332 4332 4332 4335 4335 4336 4337
4338 4338 4339 4341 4345 4346 4347 4348 4349 4349 4351
4352 4353 4354 4355 4357 4357 4359 4362 4363 4365 4367
4368 4368 4368 4369 4369 4370 4371 4372 4372 4373 4374
4376 4376 4376 4382 4382 4385 4385 4386 4386 4387 4388
4389 4392 4393 4393 4394 4396 4396 4396 4397 4399 4400
4401 4401 4402 4404 4405 4408 4410 4410 4411 4411 4412
4416 4417 4418 4419 4429 4429 4430 4430 4434 4435 4435
4436 4440 4441 4445 4446 4446 4447 4447 4448 4452 4453
4454 4454 4454 4455 4457 4458 4459 4463 4464 4464 4464
4467 4469 4469 4471 4472 4473 4473 4476 4479 4480 4480
4481 4481 4484 4485 4485 4486 4490 4490 4490 4490 4491
4492 4492 4494 4496 4497 4497 4497 4498 4500 4502 4503
4503 4504 4504 4505 4506 4506 4507 4512 4513 4513 4515
4516 4517 4517 4520 4522 4523 4525 4525 4526 4528 4529
4529 4532 4533 4533 4533 4534 4534 4534 4534 4534 4535
4537 4537 4538 4540 4541 4543 4545 4547 4548 4548 4548
4550 4553 4555 4558 4558 4560 4560 4560 4561 4561 4563
4564 4567 4569 4569 4569 4572 4572 4572 4573 4573 4573
4573 4574 4577 4579 4580 4582 4583 4583 4584 4585 4586
4586 4589 4589 4595 4595 4597 4600 4600 4602 4603 4605
4611 4614 4614 4614 4616 4617 4617 4618 4618 4619 4619
4625 4626 4627 4627 4627 4628 4630 4631 4631 4631 4632
4634 4635 4636 4641 4643 4643 4646 4650 4651 4651 4652
4652 4652 4654 4655 4655 4656 4657 4658 4658 4659 4660
4661 4662 4662 4663 4664 4665 4667 4667 4667 4669 4671
4673 4674 4674 4676 4678 4679 4680 4684 4685 4686 4689
4689 4690 4691 4692 4692 4696 4697 4697 4701 4701 4702
4703 4704 4705 4706 4709 4710 4711 4713 4713 4714 4715
4716 4718 4718 4722 4724 4724 4725 4726 4726 4727 4727
4730 4730 4731 4735 4736 4737 4737 4738 4738 4738 4741
4744 4746 4746 4746 4747 4747 4747 4748 4749 4749 4750
4750 4751 4753 4754 4755 4756 4758 4764 4764 4766 4766
4768 4770 4771 4771 4771 4772 4773 4773 4778 4779 4779
4779 4781 4784 4785 4791 4791 4791 4792 4793 4795 4796
4798 4799 4805 4806 4806 4807 4808 4809 4810 4811 4813
4814 4814 4815 4815 4816 4817 4819 4819 4819 4820 4821
4822 4822 4824 4824 4825 4826 4826 4827 4827 4829 4831
4833 4833 4834 4834 4834 4835 4837 4838 4839 4845 4846
4846 4848 4848 4851 4851 4851 4851 4852 4857 4857 4857
4858 4858 4858 4862 4864 4864 4867 4867 4868 4868 4869
4870 4871 4875 4875 4875 4876 4876 4877 4879 4883 4884

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 82


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

4887 4889 4890 4890 4891 4891 4892 4892 4895 4895 4897
4901 4906 4910 4910 4911 4914 4918 4919 4919 4919 4920
4921 4921 4922 4923 4925 4925 4926 4926 4927 4929 4930
4930 4932 4933 4939 4941 4941 4941 4943 4943 4944 4945
4949 4950 4952 4952 4952 4959 4959 4961 4961 4962 4963
4964 4964 4964 4969 4972 4973 4976 4977 4978 4978 4978
4978 4979 4981 4982 4982 4984 4985 4986 4987 4988 4990
4993 4993 4994 4994 4996 4997 4998 5001 5001 5001 5002
5003 5005 5005 5008 5009 5009 5010 5010 5012 5012 5013
5015 5016 5016 5016 5016 5017 5017 5017 5019 5020 5021
5022 5022 5023 5023 5027 5031 5031 5031 5037 5039 5040
5040 5041 5041 5042 5042 5042 5043 5044 5044 5046 5047
5048 5050 5051 5052 5053 5054 5055 5057 5057 5058 5060
5060 5062 5062 5065 5067 5069 5071 5071 5072 5072 5073
5074 5075 5075 5075 5076 5076 5080 5081 5081 5083 5089
5090 5094 5095 5097 5099 5099 5099 5100 5101 5101 5102
5105 5105 5107 5108 5109 5109 5111 5111 5112 5112 5115
5117 5117 5118 5121 5122 5122 5122 5123 5125 5126 5126
5132 5134 5135 5136 5140 5143 5143 5144 5145 5146 5147
5148 5148 5149 5149 5149 5150 5150 5152 5155 5157 5161
5165 5167 5168 5168 5168 5173 5173 5174 5176 5176 5177
5178 5181 5186 5186 5187 5187 5188 5188 5188 5188 5188
5188 5189 5190 5192 5193 5194 5196 5196 5197 5199 5200
5204 5205 5207 5208 5212 5213 5215 5216 5218 5222 5222
5223 5226 5227 5227 5229 5232 5233 5238 5239 5239 5241
5241 5244 5244 5245 5246 5247 5248 5249 5250 5252 5252
5252 5256 5256 5256 5259 5261 5264 5265 5266 5271 5272
5273 5273 5274 5274 5276 5278 5278 5279 5280 5284 5289
5291 5291 5291 5291 5293 5294 5294 5295 5295 5295 5295
5296 5296 5299 5300 5301 5301 5302 5302 5302 5303 5303
5304 5312 5312 5315 5315 5317 5317 5319 5320 5320 5321
5322 5322 5323 5323 5324 5325 5325 5328 5330 5332 5334
5334 5335 5336 5336 5336 5339 5340 5342 5344 5345 5345
5345 5346 5348 5348 5348 5349 5350 5350 5350 5353 5354
5354 5354 5356 5357 5357 5359 5360 5360 5360 5362 5362
5362 5363 5363 5365 5366 5369 5372 5372 5373 5373 5375
5375 5376 5376 5376 5377 5378 5381 5387 5387 5387 5388
5389 5392 5393 5394 5394 5399 5400 5400 5402 5402 5402
5403 5403 5405 5412 5414 5414 5414 5415 5415 5415 5419
5419 5422 5422 5422 5424 5425 5427 5427 5428 5430 5434
5438 5439 5439 5441 5442 5442 5443 5443 5444 5445 5446
5446 5446 5450 5450 5451 5453 5454 5456 5456 5457 5458
5459 5459 5460 5461 5461 5462 5463 5464 5464 5465 5465
5466 5466 5468 5470 5470 5475 5479 5480 5484 5485 5486

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 83


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

5486 5487 5489 5489 5490 5490 5492 5494 5495 5495 5495
5495 5496 5499 5499 5504 5504 5506 5506 5508 5509 5509
5509 5511 5513 5513 5514 5515 5516 5517 5518 5519 5520
5520 5522 5522 5523 5523 5524 5528 5528 5528 5529 5531
5531 5532 5533 5536 5536 5537 5538 5538 5539 5542 5546
5547 5548 5549 5549 5551 5554 5554 5554 5558 5559 5559
5560 5561 5562 5562 5563 5563 5565 5569 5569 5572 5573
5574 5574 5574 5576 5577 5577 5578 5579 5580 5580 5586
5593 5596 5597 5597 5598 5599 5600 5604 5605 5609 5610
5613 5614 5616 5617 5618 5618 5622 5622 5623 5623 5625
5626 5627 5628 5629 5630 5631 5631 5633 5635 5636 5637
5639 5639 5642 5643 5644 5644 5644 5645 5647 5648 5650
5650 5651 5653 5654 5655 5655 5656 5657 5657 5659 5663
5665 5666 5667 5668 5669 5669 5670 5671 5673 5675 5676
5677 5679 5680 5681 5684 5688 5690 5690 5690 5692 5693
5693 5693 5694 5694 5694 5698 5701 5702 5704 5704 5705
5705 5705 5706 5706 5706 5707 5708 5708 5708 5709 5714
5715 5716 5716 5719 5720 5720 5726 5726 5727 5727 5729
5730 5731 5735 5736 5736 5737 5737 5738 5738 5740 5742
5743 5744 5748 5748 5748 5750 5750 5751 5751 5751 5752
5752 5754 5754 5756 5758 5758 5759 5760 5761 5761 5761
5762 5763 5766 5770 5771 5774 5774 5776 5776 5778 5779
5779 5782 5783 5784 5784 5785 5785 5785 5786 5789 5790
5792 5792 5794 5795 5798 5799 5801 5801 5802 5807 5809
5809 5810 5812 5812 5813 5813 5815 5815 5818 5821 5822
5824 5825 5826 5827 5827 5828 5830 5831 5832 5833 5836
5836 5836 5837 5838 5840 5840 5840 5842 5842 5842 5842
5843 5844 5845 5847 5848 5848 5849 5851 5851 5854 5854
5855 5857 5858 5859 5859 5863 5865 5868 5869 5870 5871
5871 5875 5875 5875 5877 5878 5880 5880 5881 5882 5883
5884 5885 5886 5888 5888 5889 5889 5891 5893 5894 5895
5897 5897 5897 5898 5898 5899 5903 5903 5903 5903 5904
5906 5906 5907 5910 5911 5915 5916 5916 5916 5918 5918
5920 5924 5924 5924 5925 5925 5926 5927 5927 5927 5927
5927 5929 5929 5931 5931 5932 5936 5936 5937 5939 5942
5943 5944 5944 5946 5946 5946 5947 5947 5948 5950 5950
5950 5952 5954 5956 5960 5961 5962 5963 5964 5966 5967
5968 5969 5971 5971 5972 5972 5973 5975 5975 5975 5976
5977 5977 5977 5977 5978 5980 5981 5981 5983 5987 5988
5988 5989 5991 5991 5992 5993 5994 5996 5997 5998 5999
5999 5999

Time = 2110.0

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 84


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

6. Implement in Java, the 0/1 Knapsack problem using :-


a) Dynamic Programming method :-

import java.util.Scanner;
import java.util.*;
public class Pgm6a
{
public static void main(String[] args)
{
int n;
int []w;
int []p;
int i,M;
System.out.println("Enter the number of elemens :-");
Scanner input=new Scanner(System.in);
n=input.nextInt();
System.out.println("Enter weight of each items :-");
w=new int[10];
for(i=1;i<=n;i++)
w[i]=input.nextInt();
System.out.println("Enter the Profits of each items :-");
p=new int[10];
for(i=1;i<=n;i++)
p[i]=input.nextInt();
System.out.println("Enter Knapsack Capacity :- ");
M=input.nextInt();
Knapsack(n,w,p,M);
}
public static void Knapsack(int n,int w[],int p[],int M)
{
int i,j;
int v[][]=new int[20][20];
for(i=0;i<=n;i++)
{
for(j=0;j<=M;j++)
{
if(i==0||j==0)
{
v[i][j]=0;
}
else if(j-w[i]<0)
{
v[i][j]=v[i-1][j];

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 85


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
else
v[i][j]=max(v[i-1][j],v[i-1][j-w[i]]+p[i]);
}
}
System.out.println("Profit matrix is :- ");
for(i=0;i<=n;i++)
{
for(j=0;j<=M;j++)
{
System.out.print(v[i][j]+"\t");
}
System.out.println(" ");
}
System.out.println("Max. Profit is :-"+v[n][M]);
}
public static int max(int x,int y)
{
return (x>y)?x:y;
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 86


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

ITEM WEIGHT PROFIT


1 2 $12
2 1 $10
3 3 $20
4 2 $15

Enter the number of elemens :-


4
Enter weight of each items :-
2132
Enter the Profits of each items :-
12 10 20 15
Enter Knapsack Capacity :-
5
Profit matrix is :-
0 0 0 0 0 0
0 0 12 12 12 12
0 10 12 22 22 22
0 10 12 22 30 32
0 10 15 25 30 37
Max. Profit is :- 37

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 87


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

b) Greedy method :-

import java.util.*;
public class Pgm6b
{
public static void main(String[] args)
{
int i,j,n;
float p[]=new float [10],w[]=new float[10],temp,M;
float r[]=new float [10];
System.out.println("Enter the number of items :-");
Scanner input=new Scanner(System.in);
n=input.nextInt();
System.out.println("Enter the capacity of knapsack :-");
M=input.nextInt();
for(i=1;i<=n;i++)
{

System.out.println("Enter the profit and weight of item no :-


"+i);

p[i]=input.nextFloat();
w[i]=input.nextFloat();
r[i]=(p[i]/w[i]);
System.out.print(r[i]);
System.out.println();
}
for(i=1;i<=n;i++)
{
for(j=1;j<=n-1;j++)
{
if(r[j]<r[j+1])
{
temp=r[j];
r[j]=r[j+1];
r[j+1]=temp;

temp=w[j];
w[j]=w[j+1];
w[j+1]=temp;

temp=p[j];
p[j]=p[j+1];
p[j+1]=temp;

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 88


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
}
}
System.out.println("The Sorted Profits are :- ");
for(i=1;i<=n;i++)
{
System.out.print(p[i]+"\t");
}
System.out.println();
System.out.println("The Sorted Weights are :- ");
for(i=1;i<=n;i++)
{
System.out.print(w[i]+"\t");
}
System.out.println();
System.out.println("The Sorted p/w Ratio is :- ");
for(i=1;i<=n;i++)
{
System.out.print(r[i]+"\t");
}
greedy(M,w,n,p);
}
public static void greedy(float M, float w[],int n,float p[])
{
float x[]=new float [10],tp=0,u;
int i;
u=M;
for(i=1;i<=n;i++)
{
x[i]=0;
}
for(i=1;i<=n;i++)
{
if(w[i]>u)
{
break;
}
else
{
x[i]=1;
tp=tp+p[i];
u=u-w[i];
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 89


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

x[i]=(u/w[i]);
tp=tp+(x[i]*p[i]);
System.out.println();
System.out.println("The Resultant Vector is :- ");
for(i=1;i<=n;i++)
{
System.out.print(x[i] +"\t");
}
System.out.println();
System.out.println("The Maximum Profit is :- "+tp);
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 90


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

M=40
N=3
ITEM WEIGHT PROFIT
3.5 10 35
1.6 25 40
1.5 20 30

Enter the number of items :-


3
Enter the capacity of knapsack :-
40
Enter the profit and weight of item no :- 1
30 20
1.5

Enter the profit and weight of item no :- 2


40 25
1.6

Enter the profit and weight of item no :- 3


35 10
3.5

The Sorted Profits are :-


35.0 40.0 30.0

The Sorted Weights are :-


10.0 25.0 20.0

The Sorted p/w Ratio is :-


3.5 1.6 1.5

The Resultant Vector is :-


1.0 1.0 0.25

The Maximum Profit is :- 82.5

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 91


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

7. From a given vertex in a weighted connected graph, find shortest paths


to other vertices using Dijkstra's algorithm. Write the program in Java :

import java.util.Scanner;
public class Pgm7
{
public static void main(String args[])
{
int i,j,n,src;
int c[][]=new int [10][10];
int dist[]=new int[10];
System.out.println("Enter the number of vertices:-");
Scanner input =new Scanner(System.in);
n=input.nextInt();
System.out.println("Enter cost adjacency matrix:-");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
c[i][j]=input.nextInt();
}
}
System.out.println("Enter source vertex:-");
src = input.nextInt();
dijkstras(n,c,src,dist);
System.out.println("Shortest path is:-");
for(i=1;i<=5;i++)
{
System.out.print(+src);
System.out.print("----------->");
System.out.print(+i);
System.out.print("=");
System.out.println(+dist[i]);
}
}
public static void dijkstras(int n,int c[][],int src,int[] dist)
{
int i,j,count,min,u = 0;
int vis[]=new int[10];
for(i=1;i<=n,i++)
{
vis[i]=0;
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 92


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

for (i=1;i<=n;i++)
{
dist[i]=c[src][i];
}
count=0;
vis[src]=1;
dist[src]=0;
count=count+1;
while(count!=n)
{
min=999;
for(i=1;i<=n;i++)
{
if(vis[i]==0)
{
if(dist[i]<min)
{
min=dist[i];
u=i;
}
}
}
vis[u]=1;
count=count+1;
for(j=1;j<=n;j++)
{
if(vis[j]==0)
{
if(min+c[u][j]<dist[j])
{
dist[j]=min+c[u][j];
}
}
}
}
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 93


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter the number of vertices:-


6

Enter cost adjacency matrix:-


0 15 10 999 45 999
999 0 15 999 20 999
30 999 0 20 999 999
999 10 999 0 35 999
999 999 999 30 0 999
999 999 999 4 999 0

Enter source vertex:-


6

Shortest path is:-


6----------->1=59
6----------->2=14
6----------->3=29
6----------->4=4
6----------->5=34

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 94


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

8. Find Minimum Cost Spanning Tree of a given connected undirected


graph using Kruskal's algorithm. Use Union-Find algorithms in your
program :-

import java.util.Scanner;
public class Pgm8
{
public static void main(String args[])
{
int i,j,n;
int c[][]=new int[10][10];
System.out.println("Enter Number of vertices:-");
Scanner input = new Scanner(System.in);
n=input.nextInt();
System.out.println("Enter the cost adsjacecy matrix:-");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
c[i][j]=input.nextInt();
}
}
kruskal(n,c);
}
public static void kruskal(int n,int c[][])
{
int ne,min,mincost;
int parent[]=new int [10];
int i,j,u=0,v=0,a=0,b=0;
mincost=0;
ne=0;
for(i=1;i<=n;i++)
{
parent[i]=0;
}
while(ne!=n-1)
{
min=999;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(c[i][j]<min)

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 95


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

{
min=c[i][j];
u=a=i;
v=b=j;
}
}
}
while(parent[u]!=0)
{
u=parent[v];
}
if(u!=v)
{
parent[v]=u;
ne=ne+1;
mincost=mincost+min;
System.out.print(+a);
System.out.print("------->");
System.out.print(+b);
System.out.print("------->");
System.out.println(+min);
}
c[a][b]=c[b][a]=999;
}
System.out.println("Mincost = "+mincost);
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 96


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter Number of vertices:-


6

Enter the cost adjacency matrix:-


999 3 999 999 5 6
3 999 1 999 999 999
999 999 999 6 5 999
999 999 6 999 5 8
5 4 5 5 999 2
6 999 999 8 2 999

2-------> 3 ------->1
5-------> 6 ------->2
1-------> 2 ------->3
5-------> 2 ------->4
1-------> 5 ------->5

Mincost = 15

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 97


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

9. Find Minimum Cost Spanning Tree of a given connected undirected graph using
Prim's algorithm :-

import java.util.Scanner;
public class Pgm9
{
public static void main(String args[])
{
int i,j,n;
int c[][]=new int[10][10];
System.out.println("Enter the number of vetices :-");
Scanner input=new Scanner(System.in);
n=input.nextInt();
System.out.println("Enter the cost adjacency matrix :-");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
c[i][j]=input.nextInt();

prims(n,c);
}
public static void prims(int n,int c[][])
{
int ne,min,mincost;
int elec[]=new int[10];
int u=0,v=0,i,j;
mincost=0;
ne=0;
for(i=1;i<=n;i++)
{
elec[i]=0;
}
elec[1]=1;
while(ne!=n-1)
{
min=999;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 98


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

if(elec[i]==1)
{
if(c[i][j]<min)
{
min=c[i][j];
u=i;
v=j;
}
}
}
}
if(elec[v]==0)
{
elec[v]=1;
ne=ne+1;
mincost=mincost+min;
System.out.print(u+"------> "+v);
System.out.println(" ------> "+min);
}
c[u][v]=c[v][u];
c[v][u]=999;
}
System.out.println("Mincost = "+mincost);
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 99


Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter the number of vetices :-


6

Enter the cost adjacency matrix :-


999 3 999 999 5 6
3 999 1 999 4 999
999 1 999 6 5 999
999 999 6 999 5 8
5 4 5 5 999 2
6 999 999 8 2 999

1------> 2 ------> 3
2------> 3 ------> 1
2------> 5 ------> 4
5------> 6 ------> 2
5------> 4 ------> 5
Mincost = 15

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 100
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

10. Write Java programs to :-


a) Implement All-Pairs Shortest Paths problem using Floyd's algorithm :-

import java.util.Scanner;
public class Pgm10
{
public static void main(String[] args)
{
int c[][]=new int [10][10];
int i,j,n;
System.out.println("Enter the number of vertices :-");
Scanner input=new Scanner(System.in);
n=input.nextInt();
System.out.println("Enter the adjacency matrix are :-");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
c[i][j]=input.nextInt();
}
}
System.out.println("All pairs shortest path distance matrix :-");
floyd(c,n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
System.out.print(c[i][j]+"\t");
}
System.out.println();
}
}
public static void floyd(int D[][],int n)
{
int i,j,k;
for(k=1;k<=n;k++)
{
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
D[i][j]=min(D[i][j],D[i][k]+D[k][j]);
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 101
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
}
}
public static int min(int x,int y)
{
if(x<y)
return x;
else
return y;
}
}

-:OUTPUT:-

Enter the number of vertices :-


4

Enter the adjacency matrix are :-


0 999 3 999
2 0 999 999
3701
6 999 999 0

All pairs shortest path distance matrix :-


0 10 3 4
2 0 5 6
3 7 0 1
6 16 9 0

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 102
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

b) Implement Travelling Sales Person problem using Dynamic programming :-

import java.util.*;
class TSP
{
int weight[][],n,tour[],finalCost;
final int INF=999;
public TSP()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter number of nodes:=>");
n = s.nextInt();
weight=new int[n][n];
tour=new int[n-1];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
if(i!=j)
{
System.out.print("Enter weight of "+(i+1)+" to
"+(j+1)+":=>");
weight[i][j]=s.nextInt();
}
}
}
System.out.println();
System.out.println("Starting node assumed to be node 1.");
eval();
}
public int COST(int currentNode,int inputSet[],int setSize)
{
if(setSize==0)
return weight[currentNode][0];
int min=INF,minindex=0;
int setToBePassedOnToNextCallOfCOST[] = new int[n-1];
for(int i=0;i<setSize;i++){
int k=0;//initialise new set
for(int j=0;j<setSize;j++){
if(inputSet[i]!=inputSet[j])

setToBePassedOnToNextCallOfCOST[k++]=inputSet[j];
}
int temp=COST(inputSet[i],setToBePassedOnToNextCallOfCOST,setSize-1);

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 103
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

if((weight[currentNode][inputSet[i]]+temp) < min)


{
min=weight[currentNode][inputSet[i]]+temp;
minindex=inputSet[i];
}
}
return min;
}
public int MIN(int currentNode,int inputSet[],int setSize)
{
if(setSize==0)
return weight[currentNode][0];
int min=INF,minindex=0;
int setToBePassedOnToNextCallOfCOST[]=new int[n-1];
for(int i=0;i<setSize;i++)
{ //considers each node of inputSet
int k=0;
for(int j=0;j<setSize;j++){
if(inputSet[i]!=inputSet[j])

setToBePassedOnToNextCallOfCOST[k++]=inputSet[j];
}
int temp=COST(inputSet[i],setToBePassedOnToNextCallOfCOST,setSize-1);
if((weight[currentNode][inputSet[i]]+temp) < min)
{
min=weight[currentNode][inputSet[i]]+temp;
minindex=inputSet[i];
}
}
return minindex;
}
public void eval()
{
int dummySet[]=new int[n-1];
for(int i=1;i<n;i++)
dummySet[i-1]=i;
finalCost = COST(0,dummySet,n-1);
constructTour();
}
public void constructTour()
{
int previousSet[]=new int[n-1];
int nextSet[]=new int[n-2];
for(int i=1;i<n;i++)

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 104
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

previousSet[i-1]=i;
int setSize=n-1;
tour[0]=MIN(0,previousSet,setSize);
for(int i=1;i<n-1;i++)
{
int k=0;
for(int j=0;j<setSize;j++)
{
if(tour[i-1]!=previousSet[j])
nextSet[k++]=previousSet[j];
}
--setSize;
tour[i]=MIN(tour[i-1],nextSet,setSize);
for(int j=0;j<setSize;j++)
previousSet[j]=nextSet[j];
}
display();
}
public void display()
{
System.out.println();
System.out.print("The Tour is 1-");
for(int i=0;i<n-1;i++)
System.out.print((tour[i]+1)+"-");
System.out.print("1");
System.out.println();
System.out.println("The Final Cost is "+finalCost);
}
}
class Pgm10b
{
public static void main(String args[])
{
TSP obj=new TSP();
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 105
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter number of nodes:=>


3

Enter weight of 1 to 2:=> 5


Enter weight of 1 to 3:=> 15
Enter weight of 2 to 1:=> 5
Enter weight of 2 to 3:=> 10
Enter weight of 3 to 1:=> 15
Enter weight of 3 to 2:=> 10

Starting node assumed to be node 1.

The Tour is 1-2-3-1


The Final Cost is 30

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 106
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

11. Design and implement in Java to find a subset of a given set S = {Sl,
S2,.....,Sn} of n positive integers whose SUM is equal to a given positive
integer d. For example, if S ={1, 2, 5, 6, 8} and d= 9, there are two
solutions {1,2,6}and {1,8}. Display a suitable message, if the given
problem instance doesn't have a solution :-

import java.util.*;
public class Pgm_11
{
static int n,x[]=new int[10],w[]=new int[10];
static int d,i,count=0;
public static void main(String[] args)
{
int sum=0;
System.out.println("Enter the value of n :-");
Scanner sc=new Scanner(System.in);
n=sc.nextInt();
System.out.println("Enter the Elements :-");
for(i=1;i<=n;i++)
{
w[i]=sc.nextInt();
}
System.out.println("Enter the value of d:- ");
d=sc.nextInt();
for(i=1;i<=n;i++)
{
x[i]=0;
}
for(i=1;i<=n;i++)
{
sum=sum+w[i];
}
if(d>sum)
{
System.out.println("No solution");
}
else
{
subset(0,1,sum);
if(count==0)
{
System.out.println("No solution");
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 107
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

}
}
public static void subset(int s,int k,int u)
{
int i;
x[k]=1;
if(s+w[k]==d)
{
count++;
System.out.println("subset"+count);
for(i=1;i<=k;i++)
{
if(x[i]==1)
{
System.out.println(w[i]);
}
}
System.out.println();
}
else if(s+w[k]+w[k+1]<=d)
{
subset(s+w[k],k+1,u-w[k]);
}
if(s+u-w[k]>=d)
{
x[k]=0;
subset(s,k+1,u-w[k]);
}
}
}

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 108
Design & Analysis of Algorithm Lab Manual (15CSL47) 2017

-:OUTPUT:-

Enter the value of n :-


5

Enter the Elements :-


12568

Enter the value of d:-


9

subset1
1
2
6

subset2
1
8

Assistant Professor Dept of Cs, Govt Engineering Clg, KR Pete Page 109

Potrebbero piacerti anche