Top Banner
Dhanalakshmi College of Engineering Manimangalam, Tambaram, Chennai601301 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS6311PROGRAMMING AND DATA STRUCTURES II LABORATORY III SEMESTER -R 2013 LABORATORY MANUAL Name : Register No. : Section :
83

Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

Jul 26, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

Dhanalakshmi College of Engineering Manimangalam, Tambaram, Chennai–601301

DEPARTMENT OF

COMPUTER SCIENCE AND ENGINEERING

CS6311–PROGRAMMING AND DATA STRUCTURES II LABORATORY

III SEMESTER -R 2013

LABORATORY MANUAL

Name :

Register No. :

Section :

Page 2: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

1Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

DHANALAKSHMI COLLEGE OF ENGINEERING

VISION

Dhanalakshmi College of Engineering is committed to provide highly disciplined, conscientious and

enterprising professionals conforming to global standards through value based quality education and training.

MISSION

● To provide competent technical manpower capable of meeting requirements of the industry

● To contribute to the promotion of Academic Excellence in pursuit of Technical Education at different levels

● To train the students to sell his brawn and brain to the highest bidder butto never put a price tag on heart and

soul

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

VISION

To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering through

quality education and to provide enthusiastic professionals with commitment

MISSION

● To educate the students with the state-of-art technologies to meet the growing challenges of the electronics

industry

● To carry out research through continuous interaction with research institutes and industry, on advances in

communication systems

● To provide the students with strong ground rules to facilitate them for systematic learning, innovation and

ethical practices

Page 3: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

2Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)

1. Fundamentals

To impart students with fundamental knowledge in Mathematics, Science and fundamentals of engineering

that will would them to be successful professionals

2. Core Competence

To provide students with sound knowledge in engineering and experimental skills to identify complex

software problems in industry and to develop practical solution for them

3. Breadth

To provide relevant training and experience to bridge the gap between theory and practice this enables to find

solutions for real-time problem in industry and organization and to design products requiring interdisciplinary skills

4. ProfessionalismSkills

To best of students with adequate training and provide opportunities to work as team that will buildup their

communication skills, individual leadership and supportive qualities and to develop them to adapt and work in

ever changing technologies

5. Lifelong Learning

To develop the ability of students to establish themselves as professionals in Computer Science and

Engineering and to create awareness about the need for lifelong learning and pursuing advanced degrees

Page 4: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

3Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

PROGRAMME OUTCOMES (POs)

a) To apply basic knowledge of Mathematics, Science and engineering fundamentals in Computer Science and

Engineering field

b) To design and conduct experiments as well as to analyze and interpret and apply the same in the career

c) To design and develop innovative and creative software applications

d) To understand a complex real world problems and develop an efficient practical solutions

e) To create, select and apply appropriate technique, resources, modern engineering and IT tools

f) To understand their roles as professionals and give the best to the society

g) To develop a system that will meet expected need with realistic constraints such as economical,

environmental, social, political, ethical, safe and sustainable

h) To communicate effectively and make others understand exactly what they are trying to convey in both verbal

and written forms

i) To engage lifelong learning and exhibit their technical skills

j) To develop and manage projects in multidisciplinary environments

Page 5: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

4Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

CS6311– PROGRAMMING AND DATA STRUCTURES II LABORATORY

SYLLABUS

COURSE OBJECTIVES

● Be familiarized with good programming design methods, particularly Top-Down design

● Getting exposure in implementing the different data structures using C++

● Appreciate recursive algorithms LISTOF EXPERIMENTS:

1. Constructors & destructors, copy constructor

2. Friend function & friend class

3. Inheritance

4. Polymorphism & function overloading

5. Virtual functions

6. Overload unary & binary operators both as member function & non member function

7. Class templates & function templates

8. Exception handling mechanism

9. Standard template library concept

10. File stream classes

11. Applications of stack and queue

12. Binary search tree

13. Tree traversal techniques

14. Minimum spanning trees

15. Shortest path algorithms

Page 6: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

5Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

COURSE OUTCOMES

Apply good programming design methods for program development

● Apply the concepts of constructors and destructors

● Get an overview of this pointer

● Understand the concept of polymorphism

● Understand the basics of Overloading

● Study about exception handling

● Design abstract class

● Understand the basics of Overloading

● Design and implement C++ programs for manipulating stacks, queues, linked lists, trees and graphs

● Apply the different data structures for implementing solutions to practical problems

Page 7: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

6Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

CS6311–PROGRAMMING AND DATASTRUCTURES IILABORATORY

CONTENTS

Sl. No. Name of the Experiment Page No.

CYCLE1–EXPERIMENTS

I Implementation of constructors and destructors

1. Constructors, Destructors & Copy Constructor 7

2. Friend Function & Friend Class 10

3. Inheritance 13

II Overloading concepts

4. Implementation of function overloading and polymorphism 15

5. Virtual Functions 20

III Operator overloading

6. Implementation of unary and binary operator overloading 23

IV Templates

7. Implementation of class and function templates 27

V Exception handling

8. Implementation of stack and queue 32

CYCLE 2 – EXPERIMENTS

9. Standard Template Library 38

10. File Stream classes 40

VI Applications of Stack and Queue

11. Implementation ofInfix to postfix expression 42

12. Binary Search Tree 48

13. Tree traversal Techniques 50

14. Prim’s Algorithm 53

15. Dijikstra’s Algorithm 57

Page 8: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

7Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

ADDITIONAL EXPERIMENTS BEYOND THE SYLLABUS

16. Kruskal’s Algorithm 60

17. Bellman Ford Algorithm 62

Page 9: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

8Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 1 IMPLEMENTATION OF CONSTRUCTOR

DESTRUCTOR AND COPY CONSTRUCTOR

Aim:

To write a C++ program to implement the concept of constructor, destructor and copy constructor

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Define a class named as matrix & declare m, row, and col as a private data members

2. Declare getmatrix, showmatrix as a public member functions. Define default constructor in

the public section of the class matrix.

3. Declare constructor with two arguments, destructor and assignment operator overloading

function in the class matrix.

4. Declare r and c as a integer variables.

5. Get the number of rows and columns of the matrix. Declare m1 as an object of type class

matrix and pass r and c as arguments.

6. Invoke the member function get matrix to read the elements of the matrix.

7. Invoke the member function show matrix to display the elements of the matrix.

8. Declare m2 as an object of type class matrix and initialize the object m1 to m2. When

initializing, copy constructor is invoked. Use copy constructor to copy the content of one matrix

which is pointed to by m data member of the object m1 to another matrix which is pointed to by

m1 data member of object m2.

9. Invoke member function showmatrix to display the elements of the matrix pointed to by m data

member of the object m1.

10. Invoke member function showmatrix to display the elements of the matrix pointed to by m data

member of the object m2.

11. Declare m3 as an object of type class matrix.

12. Assign m1 to m3. when assigning, assignment operator overloading function is invoked. Use

assignment operator overloading function to copy the content of one matrix which is pointed to

by m data member of the object m1 to another matrix pointed to by m data member of object m3.

Page 10: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

9Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

1 2 3

2 1 4

8 4 5

1 2 3

2 1 4

8 4 5

Sample Output:

Enter no of rows and cols of the matrix:3

3 Enter the matrix elements one by one...

1 2 3

2 1 4

8 4 5

Entered matrix is

1 2 3

2 1 4

8 4 5

copy constructor invoked...

Result of copy constructor is..

copy constructor invoked...

Assignment operator overloading function invoked...

Result of assignment operator overloading..

Result:

Thus a C++ program to implement the concept of implementation of constructor, destructor, and

copy constructor is successfully done

Outcome:

Thus the outcome of implementing the concept of implementation of constructor, destructor, and copy

constructorhas been met

Page 11: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

10Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What is OOPS?

2. Write basic concepts of OOPS?

3. What is a class?

4. What is an object?

5. What is Encapsulation?

6. What is Polymorphism?

7. What is Inheritance?

8. What are manipulators?

9. Define -Constructor

10. Define -Destructor

11. What is Inline function?

12. What is avirtual function?

13. What isfriend function?

14. What is function overloading?

15. What is operator overloading?

16. What is an abstract class?

17. What is a ternary operator?

18. What is the use of finalize method?

19. What are different types of arguments?

20. What is super keyword?

Page 12: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

11Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 2 FRIEND FUNCTION & FRIEND CLASS

Aim:

To write a C++ program to perform matrix manipulation using friend class and friend function

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Declare the class as Matrix.

2. Declare the data member as r, c and **x.

3. Declare the member function as

Matrix(int r1=2,int c1=2);

void get();

void put();

friend Matrix add(Matrix,Matrix);

friend Matrix mul(Matrix,Matrix);

4. Member function with default argument is used to initialize the value of the matrix.

5. get() function is used toget the values of two matrices.

6. add() and mul() function are used to perform addition and multiplication of the matrices.

7. In the main, create objects A and B for the Matrix class.

8. Call the get() method to get the value of matrix A and B

9. Call the add() and mul() method to perform the particular operation and finally display the result

Page 13: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

12Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output

The matrix A:

2 3

2 3

The matrix B:

4 5

4 5

The resultant matrix (A+B):

6 8

6 8

Result:

Thus the program for friend function and friend class has been executed

Outcome:

Thus the outcome of applying the friend function and friendclass has been met

Viva-voce

1. What is method overriding?

2. What is an interface?

3. What is exception handling?

4. What are tokens?

5. Difference between overloading and overriding

6. Difference between class and an object

7. What is an abstraction?

8. What are access modifiers?

9. What is sealed modifiers?

10. How can we call the base method without creating an instance?

11. What is the difference between new and override?

12. What are the various types of constructors?

13. What is early and late binding?

Page 14: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

13Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 3 INHERITANCE

Aim:

To write a C++ program to display student details using single inheritance

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm: 1. Create a base class as student

1.1 Declare the data members as rollno and name[25].

1.2 Declare the member functions as

void get()

void put()

1.3 get() function is used to get the rollno and name.

1.4 put() function is used to display the rollno and name.

2. Create a derived class as person

2.1 Declare the data members as dept[10] and college[10].

2.2 Declare the member functions as

void get1()

void put1()

2.3 get1() function is used to get the dept and college. 2.4 put1() function is used to display the dept and college.

3. In the main, create the object for the derived class person.

4. Call the functions.

5. Display the results.

Sample Output:

STUDENT DETAILS:

Roll:101

Mark1:97

Mark2:99

Page 15: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

14Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Result:

Thus the program for inheritance has been executed

Outcome:

Thus the outcome of inheritancehas been met

Via-voce

1. What is copy constructor?

2. What does the keyword virtual represented in the method definition?

3. Whether static method can use non static members?

4. What arebase class, sub class and super class?

5. What is static and dynamic binding?

6. How many instances can be created for an abstract class?

7. Which keyword can be used for overloading?

8. What is the default access specifier in a class definition?

9. Which OOPS concept is used as reuse mechanism?

10. Which OOPS concept exposes only necessary information to the calling functions?

11. What are the basic concepts of OOP?

12. What is dynamic or run time polymorphism?

13. What is Encapsulation?

14. Differentiate between abstraction and encapsulation.

15. What is Inheritance?

16. Explain method overriding.

17. Can you give some examples of tokens?

18. What is friend function?

19. Define - Modularity

20. What is the full form of OOPS?

Page 16: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

15Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 4(a) FUNCTION OVERLOADING

Aim:

To write a C++ program to find the volume of cube, rectangle and cylinder using function overloading

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Create a class as shape.

2. Declare the data members as a, l, b, h, and r.

3. Declare the member function as volume with different arguments.

4. Volume function calculates the volume of cube, cylinder and rectangle based on the parameter

passed to it.

5. In the main, create the object for the shape class.

6. Call the function using objectname.functionname ();

Page 17: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

16Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

RECTANGLE:

~~~~~~~~~~~~~~~~~~~~ Enter the value of length, breadth and height: 6 4 5

Volume of the rectangle is :120

CYLINDER

~~~~~~~~~~~~~~~~~~~~

Enter the radius and height:5.4 3

Volume of the cylinder is:90.646779

Result:

Thus the program for function overloading has been executed

Outcome:

Thus the outcome of designing the function overloading has been attained

Page 18: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

17Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What is class?

2. What is an object?

3. List the types of inheritance supported in C++

4. What is the role of protected access specifier?

5. What is encapsulation?

6. What is abstraction?

7. What is inheritance?

8. What is the purpose of the keyword volatile?

9. What is an inline function?

10. What is a storage class?

11. Mention the storage classes names in C++

12. What is the roleof mutable storage class specifier?

13. Distinguish between shallow copy and deep copy

14. What is a pure virtual function?

15. What is an abstract class in C++?

16. What is a reference variable in C++?

17. What is role of static keyword on class member variable?

18. What is static member function?

19. Name the data type which can be used to store wide characters in C++

20. What is the operator used to access the class members?

Page 19: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

18Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 4(b) POLYMORPHISM

Aim:

To write C++ program to define complex number class and to do arithmetic operations on itusing operator

overloading

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm: 1. Define complex Class

2. Define default constructor

3. Define conversion constructors

4. Declare friend function to overload >> and << operators.

5. Declare other operator overloading functions.

6. Define all the functions

a. Addition:

(a+bi) + (x + yi) = ((a+x)+(b+y)i)

b. Subtraction:

(a+bi) - (x + yi) = ((a-x)+(b-y)i)

c. Multiplication:

(a+bi) * (x + yi) = (((a*x)-(b*y)) + ((a*y) + (x*b))i)

d. Division :

i.d=(x*x) + (y*y)

ii.(a+bi) / (x + yi) = (((a*x)+(b*y))/d) + (((b*x)-(a*y))/d)i

7. Create objects for complex class in main() function.

8. The arithmetic operators will invoke the overloaded operator automatically and returns

the result.

9. Display the result using overloaded operators.

Page 20: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

19Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter complex number 1:

Real Part:20

Imag Part:10

Enter complex number 2:

Real Part:10

Imag Part:5

Enter complex numbers are:

Complex 1: 20+10i

Complex 2: 10+5i

Result of addition is:30+15i

Result of subtraction is:10+5i

Result of multiplication is:150+200i

Result of division is:2+0i

Integer-->complex:4+9i

Double--

>complex:3.23004+4.666305i

Converted to double3.23004

Result:

Thus a C++ program to add and subtract two numbers using polymorphism is implemented successfully

Outcome:

Thus the outcome of using different types of polymorphismhas been met

Page 21: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

20Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. How can we initialize a class/structure member variableas soon as the same is defined?

2. What is the data type to store the Boolean value?

3. What is function overloading?

4. What is operator overloading?

5. Do we have a String primitive data type in C++?

6. Name the default standard streams in C++

7. Which access specifiercan help to achieve data hiding in C++?

8. When a class member is defined outside the class, which operator can be used to associate the

function definition to a particular class?

9. What is a copy constructor?

10. Does C++ support exception handling? If sowhat are the keywords involved in achieving the same.

11. Explain the pointer –this

12. What is the difference between the keywords struct and class in C++?

Page 22: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

21Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 5 HIERARCHICAL INHERITANCE WITH VIRTUAL

FUNCTION

Aim: To write a C++ program to draw rectangle, square and circle using multiple inheritance with virtual function

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Create a class Point.

1.1 Declare the data members x and y.

1.2 Declare the member functions as

Point(int tempx,int tempy)

int getx()

int gety()

1.3 getx() function isused to return the value of x.

1.4 gety() function is used to return the value of y.

2. Create a base class shape

2.1 Declare the necessary data members.

2.2 Declare the member function as

virtual void draw()

3. Create a derived class square. (Base class –shape)

3.1 Create an abstract class.

3.2 Get the sides of square.

3.3 Draw the square using draw() function.

4. Create a derived class rectangle. (Base class –shape)

4.1 Create an abstract class

4.2 Get the length and breadth of rectangle

Page 23: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

22Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

4.3 Draw the rectangle using draw() function

5. Create a derived class circle. (Base class –shape)

5.1 Create an abstract class

6. Get the radius of circle

7. Draw the circle using draw() function

8. In the main

8.1 Create the objects for point class

8.2 Create a base pointer object for shape class

8.3 Call the draw() function to draw the square, rectangle and circle

Page 24: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

23Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Square is drawn at (100,200) and with length as 50

Rectangle is drawnat ((100,200), (100,200) ) and ( (50,50), (50,50) ) Circle

is drawn at (100,300) and the radius is 50

Result:

Thus a C++ program to implement the concept of implementation of virtual function is successfully done

Outcome:

Thus the outcome of using different virtual function has been attained

Page 25: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

24Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What is the block scope variable in C++?

2. What is the role of the file opening mode ios::trunk?

3. What is the scope resolution operator?

4. What is a namespace?

5. What are command line arguments?

6. What is a class template?

7. How can we catch all kind of exceptions ina single catch block?

8. What is keyword auto for?

9. What is a static variable?

10. What is the purpose of extern storage specifier.

11. What is the meaning of base address of the array?

12. When should we use the register storage specifier?

13. Can a program be compiled without main () function?

14. Where an automatic variable is stored?

15. What is a container class?

16. What is a token?

17. What is a preprocessor?

18. What are command line arguments?

19. What are the different ways of passing parameters to the functions?

Page 26: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

25Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No.6(a) UNARY OPERATOR OVERLOADING

Aim:

To write a C++ program for unary operator overloading

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Declare the class as count.

2. Declare the data member as c.

3. Declare the member function as

count( )

void operator ++( )

int getcount( )

4. count() function is used to initialize the“c” value to zero.

5. getcount() function returns the value of c.

6.operator ++() functionis used to increment the value.

7. In the main, create the object for the class count.

8. Unary operator function is called by usingthe syntax operator object name.

9. Display the value of c using getcount() function.

Page 27: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

26Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

The value of c in c1=0

The value of c in c2=0

The value of c in c1=1

The value of c in c2

Result:

Thus a C++ program to implement the concept of implementation of unary operator is successfully done

Outcome:

Thus the outcome of using unary operator has been attained

Page 28: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

27Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What is reminder for 5.0 % 2?

2. Which compiler switches to be used for compiling the programs using math library with g++ compiler?

3. Can we resize the allocated memory which was allocated using ‘new’ operator?

4. Who designed C++ programming language?

5. Which operator can be used to determine the size of a data type/class or variable/object?

6. How can we refer to the global variable if the local and the global variable names are same?

7. What are valid operations on pointers?

8. What is recursion?

9. What is the first string in the argument vector command line arguments?

10. What is the maximum length of an identifier?

11. What is the default function call method?

12. What is available mode of inheritance to inherit one class from another?

13. What is the difference between delete and delete []?

14. Does an abstract class in C++ need to hold all pure virtual functions?

15. Is it legal to assign a base class object to a derived class pointer?

16. What happens if an exception is thrown outside a try block?

17. Are the exceptions and error same?

18. What is function overriding?

19. Which function is used to move the stream pointer for the purpose of reading data from stream?

20. Which function is used to move the stream pointer for the purpose of writing data from stream?

Page 29: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

28Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt. No. 6(b) BINARY OPERATOR OVERLOADING

Aim:

To write a C++ program to add two complex numbers using binary operator overloading.

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm: 1. Create a class as complex.

2. Declare the data members as real and img

2.2 Declare the member

2.3 functions as complex()

complex operator +(complex c2)

void read()

void print()

3. Constructor is used to initialize the data members to zero.

4. read() method is used to get the complex numbers.

5. print() method is used to display the complex number.

6. operator overloading function is used to perform add operation on complex numbers.

7. In main, create the object for class complex.

8. Call the binary operator overloading function using the syntax

objectname operator objectname

9. Add the two complex numbers and display the result.

Page 30: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

29Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

ENTER THE REAL AND THE IMAGINARY PART: 6 8

ENTER THE REAL AND THE IMAGINARY PART: 3 4

THE COMPLEX NUMBER OF C1: 6+8i

THE COMPLEX NUMBER OF C2: 3+4i

THE ADDITION IS: 9+12i

Result:

Thus a C++ program to implement the concept of implementation of binary operator is successfully done

Outcome:

Thus the outcome of demonstrating binary operator has been attained

Page 31: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

30Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

1. What is ‘std’?

2. What is the full form of STL?

3. What is ‘cout’?

4. What is ‘cin’?

Viva-voce

5. What is the use of the keyword ‘using’?

6. If a pointer declared for a class, which operator can be used to access its class members?

7. What is difference between including the header file with-in angular braces <> and double quotes “ “

8. S++ or S=S+1, which can be recommended to increment the value by 1 and why?

9. What is the difference between actual and formal parameters?

10. What is the difference between variable declaration and variable definition?

11. Which key word is used to perform unconditional branching?

12. Is 068 a valid octal number?

13. What is the purpose of #undef preprocessor?

14. Can we nest multi line comments in a C++ code?

15. What is a virtual destructor?

16. What is the order of objects destroyed in the memory?

17. What is a friend class?

18. What are pointers?

Page 32: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

31Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No:7(a) BUBBLE SORT USING CLASS TEMPLATE

Aim:

To write a C++ programfor bubble sort using template

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Specify the template declaration and create a class as bubble.

2. Declare the data members as size and *v as template variable.

3. Allocate the memory space using default constructor.

4. Destroy the memory space using destructor.

5. Declare the member functions as

void read()

void sort()

void display()

6. read() function is used to get the elements.

7. sort() function is used to sort the elements.

7.1 Use the for loop to continue the iteration.

7.2 if statement is used to compare the element,if it is true, swap the elements.

8. display() function is used to display the element.

9.:In the main, create the object using the following syntax:

classname<datatype>object

10. Call the read() function, to get the elements.

11. Call the sort() function, to sort the elements.

12. Call the display() function, to display the sorted elements.

Page 33: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

32Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter the size: 5

Enter the Integer Elements: 23 12 11 45 1

12 23 11 45 1

11 12 23 45 1

11 12 23 45 1

1 11 12 23 45

Enter the Float Elements: 2.3 1.2 1.1 4.5 1.0

1.2 2.3 1.1 4.5 1

1.1 1.2 2.3 4.5 1

1.1 1.2 2.3 4.5 1

1 1.1 1.2 2.3 4.5

Enter the Character Elements: rw a t b

r

a

w

r

a

w

t

t

b

b

a

a

r

b

t

r

w

t

b

w

Result:

Thus a C++ program to implement the concept of implementation of bubble sort usingclass template is

successfully done

Outcome:

Thus the outcome of using different bubble sort using template has been attained

Page 34: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

33Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What are the languages supported by OOP?

2. What are the characteristics of object oriented programming language?

3. Explain about object oriented databases?

4. Define -OOPS What are its benefits?

5. What are the core OOP’s concepts?

6. What isclass?

7. What is an Object?

8. Difference between a class and an object

9. What is an Instance?

10. What is Polymorphisms?

11. What are advantages of polymorphism and dynamic binding?

12. What is Information Hiding in OOP?

13. What is Association?

14. What is meant by abstraction?

15. What is meant by Encapsulation?

16. What is meant by Inheritance?

17. Explain about multiple inheritance?

18. What is multiple inheritance and does java support?

Page 35: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

34Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No:7(b) FUNCTION TEMPLATE

Aim:

To write a C++ program to swap two variables using function template

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Declare the template to perform swap operation.

2. In the main, get the values for integer data type

2.1 Call the swap function.

2.2 Display the swapped values.

3. Get the values for float data type

3.1 Call the swap function.

3.2 Display the swapped values.

4. Get the values for character data type

4.1 Call the swap function.

4.2 Display the swapped values.

Page 36: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

35Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

ENTER THE INTEGER VALUES: 67 12

THE SWAPPED VALUES ARE: 12 67

ENTER THE FLOAT VALUES: 8.9 1.2

THE SWAPPED VALUES ARE: 1.28.9

ENTER THE CHARACTER VALUES: r a

THE SWAPPED VALUES ARE: ar

Result:

Thus a C++ program to implement the concept of implementation of function template is successfully

done

Outcome:

Thus the outcome of using function template has been attained

Page 37: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

36Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. How method overriding different from overloading?

2. What does the keyword virtual mean in the method definition?

3. Can you declare the override method static while theoriginal method is non-static?

4. Can you override private virtual methods?

5. Can you prevent your classfrom being inherited and becoming a base class for some other classes?

6. Can you allow class to be inherited, but prevent the method from being over-ridden?

7. Why can't you specify the accessibility modifier for methods inside the interface?

8. A constructor can be private. True or False

9. What is the work of a constructor?

10. Name the operators that cannot be overloaded.

11. What is "this" pointer?

12. Can we have an Abstract class without having any abstract method?

13. How does composition mechanism works?

19. What is an Instance?

20. What is Polymorphisms?

21. Explain about overriding polymorphism?

22. Explain about parametric polymorphism?

23. What are advantages of polymorphism and dynamic binding?

Page 38: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

37Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No:8(a) IMPLEMENTATION OF STACK USING EXCEPTION

HANDLING

Aim:

To write a C++ program to implementstack using exception handling

Page 39: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

34 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Software Requirements:

Server with C++ compiler

Hardware Requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start the program.

2. Define a class named as stack with s, top as a private data memberdeclare exception classes named as

FULL and EMPTY in the public section of the class stack.

3. Declare push, pop and displayas a public member function of the class stack.

4. Declare choice and item as integer variables and assign the value o to choice.

5. Let s1 be an object of type class stack.

6. If choice!=4 then do the following

(i) Print the menu

“Stack

operation

1. Push operation

2. Pop operation

3. Display

4. Exit

(ii) Read the value of choice

(iii) If choice =1 then perform the following

a) Read the element to be inserted.

b) Invoke the member function push through the object s1 to insert the element into the

stack.Bring the function callingstatement inside the try block.

c) Define a catch block that catches the exception thrownout by the try block and print

the statement “stack overflow”.

iv) If choice=2 the perform the following

a) Invoke the member function pop through the object s1 to remove the element from the stack. Bring the

function calling statement inside the try block.

b) Define a catch block that catches the exception thrownout by the try block and print the statement “stack

underflow”

(v) If choice=3 the perform the following

Page 40: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

35 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

a) Invoke the member function display though the object s1 to display all the elements of the stack. Bring the

function calling statement inside the try block.

b) Define a catch block that catches the exception thrownout by the try block and print the statement “stack is

empty”.

(vi) If choice=4 the use break statement to come out from the switch block.

Page 41: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

36 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

1.Push 2.Pop

Enter your choice: 1

Enter the item

13

Item pushed

Do you want to continue?

Yes

1.Push 2.Pop

Enter your choice: 1

Enter the item: 12

Item pushed

Do you want to continue:

Yes

1.Push 2.Pop

Enter your choice:

2

Item popes is 12

Do you want to

continue? No

Result:

Thus the C++ program to implement Stack using ExceptionHandling is successfully completed

Outcome:

Thus the outcome of stack using exception handling has been attained

Page 42: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

37 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

1. What is Aggregation?

2. What is an Abstract Class?

3. What is an Interface?

4. What is a base class?

Viva-voce

5. Explain the mechanism of composition?

6. Explain the rationale behind Object Oriented concepts?

7. Explain about instance in object oriented programming?

8. Explain about encapsulation?

9. What is a constructor?

10. What are the various types of Constructors

11. What is a destructor?

12. What is meant by Binding?

13. What is meant by static binding?

14. What is meant by Dynamic binding?

15. What is pure virtual function?

16. Can we specify the access modifier for explicitly implemented interface method?

17. What is protected access modifier in C++?

Page 43: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

38 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No:8(b) IMPLEMENTATION OF QUEUE USING EXCEPTION

HANDLING

Aim:

To write a C++ program to implement queue using exception handling

Page 44: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

39 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Define exception classes named as QFULL and QEMPTY in thepublic section of the class

queue

2. Declare queue, front and rear as private data members andinsert, deletion, display as public

member functions of the class queue

3. Declare choice and item as integer variables and assign the value o to choice

4. Let q bean object of type class queue.

5. Print the menu

“Queue operation

Insertion

Deletion

Display

Exit “ 6. Read the value of choice

If choice=1 then do the following

(i) Get the element to be inserted

(ii) To insert element into the queue,invoke the member function insert through the

object q1 and pass the element to be inserted as an argument. Bring the function

callingstatement inside the try block

(iii) Define a catch block that catches the exception thrownout by the try block and print

the statement “Queue overflow”.

Page 45: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

40 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

If choice=2 then do the following

(i) Invoke the member function deletion through the object q1 to remove the element

from the queue. The element which is inserted is deleted first. Bring the function

callingstatement inside the try block

(ii) Define a catch block that catches the exception thrownout by the try block and print

the statement “Queueunderflow”

If choice=3 then perform the following

(i) Invoke the member function display through the object q1 to display the elements of

the queue.Bring the function callingstatement inside the try block

(ii) Define a catch block that catches the exception thrown out by the try block and print

the statement “queue is empty”;

If choice=4 then invoke exit function to terminate the program

Page 46: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

41 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

1.Insert

2.Delete

Enter your choice:

1

Enter the item to be inserted:

13

Rear 13

Item is inserted

Do you want continue(y/n):

Y

1.Insert

2.Delete

Enter your choice:

1

Enter the item to be inserted:

12

Rear 12

Item is inserted

Do you want continue(y/n);

Y

Enter your choice

2

The deleted item from the list is 13

Do you want continue(y/n):

n

Result:

Thus theC++ program to implement Queue using Exception Handling is successfully completed

Outcome:

Thus the outcome of queue using exception handling has been attained

Page 47: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

42 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What does the keyword virtual mean in the method definition?

2. Can you declare the override method static while theoriginal method is non-static?

3. Can you override private virtual methods?

4. Can you prevent your class from being inherited and becominga base class for some other classes?

5. Can you allow class to be inherited, but prevent the method from being over-ridden?

6. Why can't you specify the accessibility modifier for methods inside the interface?

7. A constructor can be private. True or False

8. What is the work of a constructor?

9. Name the operators that cannot be overloaded.

10. What is "this" pointer?

11. Can we have an Abstract class without having any abstract method?

12. How does composition mechanism works?

13. What is Private access modifier in C++?

14. What is Public access modifier in C++?

Page 48: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

43 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No:9 STANDARD TEMPLATE LIBRARY

Aim:

To implement a C++ program to illustrate the concept of standard template library

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Include the header files.

2. Create a vector to store int.

3. Display the original size to store int.

4. Push 5 values into the vector using for loop.

5. Display extended size of vec.

6. Access 5 valuesfrom the vector.

7. Use iterator to access the values.

Page 49: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

44 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

vector size = 0 extended

vector size = 5 value of

vec [0] = 0 value of vec

[1] = 1 value of vec [2] =

2 value of vec [3] = 3

value of vec [4] = 4

value of v = 0 value

of v = 1 value of v =

2 value of v = 3

value of v = 4

Result:

Thus a C++ program to illustrate the concept of standard templatelibrary is implemented successfully

Outcome:

Thus the outcome of standard template library concept has been attained

Page 50: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

45 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. What is protected access modifier in C++?

2. What is Private access modifier in C++?

3. What is Public access modifier in C++?

4. How method overriding different from overloading?

5. What does the keyword virtual mean in the method definition?

6. Can you declare the override method static while theoriginal method is non-static?

7. Can you override private virtual methods?

8. Can you prevent your class from being inherited and becominga base class for some other classes?

9. Can you allow class to be inherited, but prevent the method from being over-ridden?

10. Why can't you specify the accessibility modifier for methods inside the interface?

11. A constructor can be private. True or False

12. What is the work of a constructor?

13. Name the operators that cannot be overloaded

14. What is "this" pointer?

15. Can we have an Abstract class without having any abstract method?

16. How does composition mechanism works?

Page 51: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

46 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No:10 FILE STREAM CLASSES

Aim:

To implement a C++ program to read the content of a file

Page 52: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

47 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Include the header files.

2. Declare the variables.

3. Get the file name to read.

4. Using ifstream in(filename) check whether the file exist.

5. If the file exists then checks for the end of file condition.

6. Read the contents of the file.

7. Print the contents of the file.

8. Stop the program.

Page 53: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

48 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter File name: one.txt

Master of Computer Applications

Result:

Thus a C++ program to read the content of a file is implemented successfully

Outcome:

Thus the outcome of file stream classes has been attained

Page 54: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

49 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. Explain the mechanism of composition?

2. Explain the rationale behind Object Oriented concepts?

3. Explain about instance in object oriented programming?

4. Explain about encapsulation?

5. What is a constructor?

6. What are the various types of Constructors

7. What is a destructor?

8. What is meant by Binding?

9. What is meant by static binding?

10. What is meant by Dynamic binding?

11. What is pure virtual function?

12. Can we specify the access modifier for explicitly implemented interface method?

13. What is protected access modifier in C++?

14. What is Private access modifier in C++?

15. What is Public access modifier in C++?

16. How's method overriding different from overloading?

17. What does the keyword virtual mean in the method definition?

18. Can you declare the override method static while theoriginal method is non-static?

Page 55: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

50 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No11(a) IMPLEMENTS STACKAND USE IT TO CONVERT

INFIX TO POSTFIX EXPRESSION

Aim:

To write a program to implement stack and use it to convert infix to postfix expression

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start.

2. Create a stack to store operand and operator.

3. In Postfix notation the operator follows the two operands and in the infix notation

the operator is in between the two operands.

4. Consider the sum of A and B. Apply the operator “+” to the operands A and B

and write the sum as A+B is INFIX. + AB is PREFIX. AB+ is POSTFIX.

5. Get an Infix Expression as input and evaluate it by first converting it to postfix and

then evaluating the postfix expression.

6. The expressions within inner most parentheses must first be converted to postfix so that

they can be treated as single operands. In this way Parentheses can be successively

eliminated until the entire expression is converted.

7. The last pair of parentheses to be opened with in a group of parentheses encloses the

first expression with in that group to be transformed. This last-in first-out immediately

suggests the use of Stack. Precedence plays an important role in the transforming infix

to postfix.

8. Stop.

Page 56: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

51 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

A*( B + C / ( D –A ) )

The equivalent postfix expression is: A B C DA -/ + *

Result:

Thus the C++program forconvertinfix expressionto postfix expression waswritten,executed and theoutput was

verified successfully

Outcome:

Thus the outcome of conversion of infix expression has been attained

Page 57: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

52 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. Define -Stack

2. List out the basic operations that can be performed on a stack and a queue.

3. Define -Output Restricted Queue

4. What are the applications of priority queue?

5. List the different kinds of arrays with which you can manipulate and represent data

6. Distinguish between arrays and structures

7. Compare Infix, postfix and prefix.

8. What do you think about stack?

9. Give some applications of stack

10. What is a circular queue? How do you check the queue full condition?

11. Define -Dequeue

12. Distinguish between array,stack and queue.

13. List the notations used to represent the arithmetic expression

14. List thecomparison between arrays and structures

15. What do you think about queue , giveits applications?

16. Show howyou identify the first and last node in the doubly circular linked list

17. What are applications of stack?

18. Give few examples for data structures?

19. Write down the operations that can be done with queue data structure?

20. What are the two operations of Stack?

21. Define -Priority queue

22. Define- Abstract Data Type(ADT)

23. Mention some ofthe application of linked list

Page 58: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

53 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No11(b) IMPLEMENTS A DOUBLE-ENDED QUEUE

(DEQUEUE)

Aim:

To write a program to implement a double ended queue (DEQUEUE) where insertion and deletion operations

are possible at both the ends

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start.

2. The operations that can be performed on a dequeue are as follows

a. Insert at front

b. Insert at rear

c. Delete from front

d. Delete from rear

3. After inserting the element B at front end, the dequeue will look like this

a. B C D E

b. front rear

4. After inserting the element F at rear end, the dequeue will look like this

a. B C D E F

b. front rear

5. We delete an element from front which has to be B.

a. C D E F

b. front rear

6. We delete an element from rear which has to be F.

a. C D E

b. front rear

Page 59: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

46 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

1. Input

restricted dequeue

2.Output restricted

dequeue Enter your

choice : 1 1.Insert at

right

2. Del

ete from left

3.Delete

from right

4.Display

5.Quit

Enter your choice : 1

Input the element for adding in queue :

10 1.Insert at right

2.Delete

from left

3.Delete

from right

4.Display

5.Quit

Enter your choice : 1

Input the element for adding in queue :

20 1.Insert at right

2.Delete

from left

3.Delete

from right

4.Display

5.Quit

Enter your choice : 1

Input the element for adding in queue :

30 1.Insert at right

2.Delete

Page 60: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

47 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

from left

3.Delete

from right

4.Display

5.Quit

Enter your

choice : 4

Queue

elements : 10

20 30

1. Insert at right

2. Delete

from left 29

3. Delete from

right 4.Display

5.Quit

Enter your choice : 2

Element deleted from queue is : 10

1.Insert at right

2.Delete from left

3.Delete from right

4.Display

5.Quit

Enter your choice : 4

Queue elements :

20 30

1. Insert at

right 2.Delete from

left 3.Delete from

right 4.Display

5.Quit

Enter your choice : 3

Element deleted from queue is : 30

1.Insert at right

2.Delete from left

3. Delete from

Page 61: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

48 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

right 4.Display

5.Quit

Enter your choice : 4

Queue elements :

20

1. Insert at

right 2.Delete from

left 3.Delete from

right 4.Display

5.Quit

Result:

Thus the C++ program for implementation of double ended queue was written, executed and the output

was verified successfully

Outcome:

Thus the outcome of double ended queue has been attained

Page 62: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

49 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. Distinguish between array,stack and queue

2. List the notations used to represent the arithmetic expression

3. List thecomparison between arrays and structures

4. .What do you think about queue, giveits applications?

5. Show howyou identify the first and last node in the doubly circular linked list

6. What are applications of stack?

7. Give few examples for data structures?

8. Write down the operations that can be done with queue data structure?

9. What are the two operations of Stack?

10. Define- Priority queue

11. Define -Abstract Data Type(ADT)

12. Mention some of the application of linked list.

13. Mention some of the application of linked list.

Page 63: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

50 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No12 IMPLEMENT BINARY SEARCH TREE

Aim:

To write a program to create binary search tree and perform insertion and search operations on it

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start.

2. Create a binary tree using linked representation with nodes having the structure LEFT DATA

RIGHT. Build the tree in such a way that values at each left is less and values ateach right is

greater

3. Insert: Get the value to be inserted. Create a new node and set the data field to X

then set the left and right links to NULL

4. Compare X with root node data in X <root continue search in left subtree. If

X=root, then display “Duplicate data”, if X>root then search in right subtree

Then insertthe node in its right position

5. Display: Display all the data in the tree

6. Stop

Page 64: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

51 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter an element to insert:89 63

89

Enter your choice:3

Enter an element to insert:52 52

63 89

Enter your choice:3

Enter an element to insert:95

52 63 89 95

Enter your

choice1 Minimum

:52 Enter your

choice2

Maximum:95

Enter your

choice4

Enter an element to delete:52

63 89 95

Enter your choice:5

Result:

Thus the C++program for implementation ofdouble endedqueue waswritten, executed andtheoutputwas

verified successfully

Outcome: Thus the outcome of binary search tree has been attained

Page 65: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

52 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. Define-Tree

2. Define-Binary Tree

3. Distinguish between a tree and a binary tree.

4. Define -expression Tree

5. Explain the different representations of nodes in a tree

6. Describe the properties of binary tree.

7. What do you mean by sibling?

8. Explain ancestors and descendants

9. Select and write down the algorithm for in order traversal of binary tree

10. Construct the complete binary tree

11. List the applications of trees

12. Define - Binary Search Tree

13. What do you think about Heterogeneous binary tree?

14. List the applications of binary tree.

15. Illustrate with example what do you mean by External nodes and internal nodes.

16. Classify the use of Threaded binary tree

17. What do you think about Heterogeneous binary tree?

18. List the application areas of Huffman Algorithm.

19. Describe -Huffman Algorithm

Page 66: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

53 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No13 IMPLEMENT AN EXPRESSION TREE & PRODUCE ITS

PREORDER, IN-ORDER, AND POST- ORDER

TRAVERSALS

Aim:

To develop a program to implement an expression tree, that produces its preorder, in-order and post-order

traversals

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start the program

2. Create a binary tree with the nodes partitioned into three disjoint subsets.

3. A common operation in the binary tree is to traverse that is to pass through the tree enumerating

each nodes once.The traversal of the binary tree can be done in three ways they are

preorder,inorder,postorder traversal.

4. To traverse a nonempty binary tree preorder we perform the following three operations(as

depth-first order)

Visit the root

Traverse the left subtree in preorder

Traverse the right subtree in preorder

5. To traverse a nonempty binary tree inorder we perform the following three

operations(as symmetric order)

Traverse the left subtree in

inorder Visit the root

Traverse the right subtree in inorder

6. To traverse a nonempty binary tree postorder we perform the following three

operations Traverse the left subtree in postorder.

Traverse the right subtree in postorder

Visit the root

Page 67: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

54 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter the postfix expression: ab+cd-

*

The tree is created.....

Inorder traversal:

a+b*c-d

Preorder traversal:

*+ab-cd

Postorder

traversal:

ab+cd-*

Result:

Thus the C++program for implementation an expression tree of preorder ,postorder and inorder are

produced and the code was written, executed and the output was verified successfully.

Page 68: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

55 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Outcome:

Thus the outcome tree traversal techniques has been attained.

Viva-voce

1. What are the postfix and prefix forms of the expression?

2. Define - Non-linear data structure

3. What are the different types of tree traversal technique?

4. Define - Pre-order Traversal

5. Define - Post-order Traversal

6. Define- In-order Traversal

7. What are advantages in the array implementation of list?

8. What are the disadvantages in array implementation of stacks?

9. State the different ways of representing expressions.

10. State the advantages of using postfix notations.

11. State the rules to be followed during infix to postfix conversions.

12. State the difference between stacks and linked lists.

13. What are the different binary tree traversal techniques?

14. What are the tasks performed during preorder traversal?

15. What are the tasks performed during inorder traversal.

Page 69: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

55 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No14 IMPLEMENT PRIM'S ALGORITHM USING

PRIORITY QUEUES TO FIND MST OF AN

UNDIRECTED GRAPH

Aim:

To develop a program to implement the Prim’s Algorithm using priority queues to find MST of an undirected

graph

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Input: A connected weighted graph with vertices V and edges E.

2. Initialize: Vnew = {x}, where x is an arbitrary node (starting point) from V,

Enew = {}

3. Repeat until Vnew = V:

Choose edge (u,v) with minimal weight such that u is in Vnew and v is not (if there are

multiple edges with the same weight, choose arbitrarily but consistently)

Add v to Vnew, add (u, v) to Enew

Output: Vnew and Enew describe a minimal spanning tree

Page 70: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

56 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Minimum Cost Spanning Tree Using Prim's

Algorithm MENU:

1. Create Graph

2. Find Minimum Cost

Spanning Tree 3.Exit

Enter Your Choice: 1

Enter Number of nodes: 6 Enter the Source vertex: 0

Enter The Destination Vertex:

1 Enter The Weight Of Edge: 6

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 0

Enter The Destination Vertex:

2 Enter The Weight Of Edge: 1

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 0

Enter The Destination Vertex:

3 Enter The Weight Of Edge: 5

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 1

Enter The Destination Vertex:

4 Enter The Weight Of Edge: 3

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 1

Enter The Destination Vertex:

2 Enter The Weight Of Edge: 5

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 2

Enter The Destination Vertex:

Page 71: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

57 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

0 0 1 0 0 0

0 0 5 0 3 0

1 5 0 0 0 4

0 0 0 0 0 2

0 3 0 0 0 0

0 0 4 2 0 0

4 Enter The Weight Of Edge: 6

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 2

Enter The Destination Vertex:

5 Enter The Weight Of Edge: 4

Do You Want To Continue?(Y/N): y

Enter The Destination Vertex:

2 Enter The Weight Of Edge: 5

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 4

Enter The Destination Vertex:

5 Enter The Weight Of Edge: 6

Do You Want To Continue?(Y/N): y

Enter the Source vertex: 3

Enter The Destination Vertex:

5 Enter The Weight Of Edge: 2

Do You Want To Continue?(Y/N): n

Do You Want To Continue To main Program?(Y/N): y

MENU:

1. Create Graph

2. Find Minimum Cost

Spanning Tree 3.Exit

Enter Your Choice: 2

Enter Your Starting vertex: 0

Minimum Spanning Tree is:

Page 72: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

58 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Minimum cost of Spanning tree is: 15

Do You Want To Continue To main Program?(Y/N): n

Result:

Thus the C++ program for implementation of Prim’s algorithm was written, executed and the output

was verified successfully

Outcome:

Thus the outcome prims algorithm techniques has been attained

Page 73: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

59 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. Define - Graph

2. What do you think about directed and undirected graph?

3. What is the use of Dijkstra’s algorithm?

4. Define - Spanning Tree

5. Define-Minimum Spanning Tree

6. How can you create minimum spanning tree using prim’s algorithm?

7. How can you create minimum spanning tree using Kruskal’s algorithm?

8. Classify degree of a graph Identify and define Complete graph.

9. Define -Topological Sort

10. What do you think about Prim’s Algorithms?

11. Compare Prim’s and Kruskal’s Algorithms?

12. Identify what is biconnected graph?

13. Define -Biconnected Graph

14. List what are the representations of graph?

15. Distinguish Euler Path and Euler Circuit?

16. Explain Adjacency matrix and Adjacency list

17. Define -Path Matrix

18. Define-Graph Traversal

19. Classify what is Depth first search and Breadthfirst search

20. Explain various applications of graph.

21. Compare various shortest path algorithms

Page 74: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

60 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No15 IMPLEMENTATION OF DIJIKSTRA’S ALGORITHM

Aim:

To write a program to implement Dijikstra’s algorithm to find the shortest path algorithm

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start

2. Read the value of n

3. Read small dist, newdist, maxnode

4. Set for loop of i< 1 to n-2

5. Set for loop ofi< 1 to n

6. Check whether dist[i] =newdist then if n-1 then calculate smalldist=dist[i]

7. Assign the value of i<j

8. print current

9. Check whether dist[i] <small dist if it is true print current value otherwise print newdist[i]

Page 75: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

61 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

enter no of vertices6

enter no of edges11

enter

EDGE Cost

1 2 50

1 3 45

1 4 10

2 3 10

2 4 15

3 5 30

4 1 10

4 5 15

5 2 20

5 3 35

6 5 3

enter initial vertex1

1

14

145

1452

13

Result:

Thus the C++ program for implementation of Dijikstra’s algorithm was written, executed and the output was

verified successfully

Outcome:

Thus the outcome dijikstra’s algorithm techniques has been attained

Page 76: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

62 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

VIVA - VOCE

1. Can you write about Minimum Spanning Tree?

2. Where is topological sort used? Give the expansion of PERT

3. What are the advantages of using lists for representing graphs?

4. Define-Depth First Search f

5. Name the different ways of representing a graph.

6. When is a graph said to be weakly connected?

7. When is a graph said to be maximal?

8. What is meant by the length of the path?

9. Define - Adjacency Matrix

10. Define -Incidence Matrix

11. What is meant by traversing a graph? State thedifferent ways of traversing a graph.

12. How can you minimum spanning trees from graphs?

13. What is a Sink node?

14. What is the Source node?

15. What is Acyclic graph?

16. List the 2 important representations of graph.

17. Give any three examples for shortest path problem.

18. List the applications of MST.

19. Define -Prim’s Algorithm

Page 77: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

63 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

ADDITIONAL EXPERIMENTS

Expt.No16 IMPLEMENTATION OF KRUSKAL’S ALGORITHM

Aim:

To write a program to implement Kruskal’s algorithm to find theminimum cost spanning tree

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start.

2. Read the value of n.

3. Read small dist, newdist, maxnode.

4. Set for loop of i< 1 to n-2.

5. Set for loop ofi< 1 to n.

6. Check whether dist[i] =newdist then if n-1 then calculate smalldist=dist[i].

7. Assign the value of i<j.

8. print current.

9. Check whether dist[i] <small dist if it is true print current value otherwise print newdist[i].

10. Stop.

Page 78: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

64 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter no of vertices4

enter no of edges4

EDGE Cost

1 2 1

2 3 2

3 4 3

1 3 3

edge from 1–>2edge from 2–>3edge from 1–>3

Result:

Thus the C++ program for implementation of Kruskal’salgorithm was written, executed and the output was

verified successfully

Outcome:

Thus the outcome Kruskal’s algorithm techniques has been attained

Page 79: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

65 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Viva-voce

1. Define-Depth First Search

2. Name the different ways of representing a graph.

3. When is a graph said to be weakly connected?

4. When is a graph said to be maximal?

5. What is meant by the length of the path?

6. Define - Adjacency Matrix

7. Define -Incidence Matrix

8. What is meant by traversing a graph? State thedifferent ways of traversing a graph.

9. How can you minimum spanning trees from graphs?

10. What is a Sink node?

11. What is the Source node?

12. List the 2 important representations of graph.

13. Give any three examples for shortest path problem.

14. List the applications of MST.

15. Define -Prim’s Algorithm

16. Define -DFS

17. What is called Biconnectivity?

18. What do you mean by Complete Graph?

19. Define -Degree

20. Define-Directed Graph

21. List the two types of graphs.

Page 80: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

66 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Expt.No17 IMPLEMENTATION OF BELLMAN FORD ALGORITHM

Aim:

To write a program to implement Bellman fordalgorithm to find the minimum cost spanning tree

Software requirements:

Server with C++ compiler

Hardware requirements:

Standalone desktops (or) Server supporting 30 terminals or more

Algorithm:

1. Start

2. Read the value of n

3. Read small dist, newdist, maxnode

4. Set for loop of i< 1 to n-2

5. Set for loop ofi< 1 to n

6. Check whether dist[i] =newdist then if n-1 then calculate smalldist=dist[i]

7. Assign the value of i<j

8. print current

9. Check whether dist[i] <small dist if it is true print current value otherwise print newdist[i]

10. Stop

Page 81: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

67 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Sample Output:

Enter the source, destination and cost of edge

0

1

-1

Enter the source, destination and cost of edge

0

2

4

Enter the source, destination and cost of edge 1

2

3

Enter thesource, destination and cost of edge 1

3

2

Enter the source, destination and cost of edge 3

1

1

Enter the source, destination and cost of edge 1

4

2

Enter the source, destination and cost of edge 4

3

-3

Enter the source, destination and cost of edge 3

5

2

Page 82: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

68 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

Cost source node

0 0

1 -1

2 1

-2 4

1 1

Result:

Thus the C++ program for implementation of Bellman fordalgorithm was written, executed and the output

was verified successfully

Outcome:

Thus the outcome Bellman ford algorithm techniques has been attained

Page 83: Dhanalakshmi College of Engineering - DCE1. Create a base class as student 1.1 Declare the data members as rollno and name[25]. 1.2 Declare the member functions as void get() void

69 Format No.:DCE/Stud/LM/34/Issue:00/Revision:00

1. What is Bellman ford algorithm?

2. Define-Depth First Search

Viva-voce

3. Name the different ways of representing a graph.

4. When is a graph said to be weakly connected?

5. When is a graph said to be maximal?

6. What is meant by the length of the path?

7. Define - Adjacency Matrix

8. Define -Incidence Matrix

9. What is meant by traversing a graph? State thedifferent ways of traversing a graph.

10. How can you minimum spanning trees from graphs?

11. What is a Sink node?

12. What is the Source node?

13. List the 2 important representations of graph.

14. Give any three examples for shortest path problem.

15. List the applications of MST.

16. Define -Prim’s Algorithm

17. Define - DFS

18. What is called Bi-connectivity?

19. What do you mean by Complete Graph?