Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

TRIBHUWAN UNIVERSITY

Kritipur, Kathmandu, Nepal

Practical Report on
Data Structures and Algorithm
CACS201

Submitted to:
Department of Computer Science and Applications (CSA)

In partial fulfillment of the request for the degree of


Bachelor of Computer Application (BCA)

Submitted by:
Name: Nischal Bhurtel
Roll no: 39
BCA 3RD Semester

Under the Supervision of


Sameer Sitaula

Mechi Multiple Campus


Department of BCA
Bhadrapur, Jhapa, Nepal
2023
Practical Report of

Data Structures and Algorithm

CACS201

Lab Report 1:

Stack

Submitted to:

Department of Computer Science and Applications(CSA)

In partial fulfillment of the requirements for the backelor of

Bachelor of Computer Application (BCA)

Submitted by: Submitted to:

Nischal Bhurtel Sameer Sitaula

Roll no 39 ______________

BCA 3RD Semester Signature


1. Basic Operations of Stack:

Program Code:
Output:

Conclusion:
In this lab, we successfully implement the essential stack operations (push,
pop, display, isEmpty, and isFull). These operations are fundamental for
managing data efficiently in a stack data structure. This program demonstrates
proficiency in basic data structure manipulation.
2. Evaluate Postfix Expression:

Source Code:
Output:

Conclusion:
In this lab, we can efficiently evaluate postfix expressions. Users can input a
postfix expression, and the program calculates and displays the result. This
implementation showcases a practical understanding of stack-based
algorithms.
3. Infix to Postfix:

Source Code:
Output:

Conclusion:
This lab efficiently converts infix expressions to postfix notation. The
provided algorithm and output showcase the code's effectiveness in
simplifying mathematical expressions.
Practical Report of

Data Structures and Algorithm

CACS201

Lab Report 2:

Queue

Submitted to:

Department of Computer Science and Applications(CSA)

In partial fulfillment of the requirements for the backelor of

Bachelor of Computer Application (BCA)

Submitted by: Submitted to:

Nischal Bhurtel Sameer Sitaula

Roll no 39 ______________

BCA 3RD Semester Signature


1. Implementation of Linear Queue:

Source Code:
Output:

Conclusion:
In this lab, this implementation demonstrates the functionality of a linear
queue, offering enqueue and dequeue operations along with error handling for
full or empty conditions. The code efficiently manages a queue of integers,
displaying its contents before and after dequeuing elements.
2. Basic Operations of Circular Queue:

Program Code:
Output:

Conclusion:
In this lab, we successfully implement the operations of a circular queue,
including insertion (enqueue) and deletion (dequeue) of data. It also provides
functionality to check if the queue is empty or full. Users can interact with the
queue through a menu-driven interface. Overall, this code demonstrates a
practical understanding of circular queues and their operations
Practical Report of

Data Structures and Algorithm

CACS201

Lab Report 3:

Linked List

Submitted to:

Department of Computer Science and Applications(CSA)

In partial fulfillment of the requirements for the backelor of

Bachelor of Computer Application (BCA)

Submitted by: Submitted to:

Nischal Bhurtel Sameer Sitaula

Roll no 39 ______________

BCA 3RD Semester Signature


1. Basic Operations of Singly Linked List:

Source Code:
Output:
Conclusion:
In this lab, successfully implements essential operations for singly linked lists.
This includes inserting and deleting data at the beginning, end, and specific
positions, as well as searching for a particular data and displaying the linked
list.
2. Implementation of Doubly Linked List:

Source Code:
Output:

Conclusion:
In this lab, this implementation successfully creates and displays a doubly
linked list. It demonstrates the insertion of elements at the end and displays the
list in both forward and reverse orders. This code serves as an effective
example of managing doubly linked lists and showcases a practical
understanding of this data structure.
Practical Report of

Data Structures and Algorithm

CACS201

Lab Report 4:

Recursion

Submitted to:

Department of Computer Science and Applications(CSA)

In partial fulfillment of the requirements for the backelor of

Bachelor of Computer Application (BCA)

Submitted by: Submitted to:

Nischal Bhurtel Sameer Sitaula

Roll no 39 ______________

BCA 3RD Semester Signature


1. Factorial:

Program Code:

Output:

Conclusion:
In this lab, we can efficiently calculate the factorial of a given number using a
recursive function. The program takes user input for the number and then
recursively computes its factorial. The output displays the result. This
implementation demonstrates a clear understanding of recursive algorithms for
mathematical operations.
2. Sum of Fibonacci Series of nth terms:

Program Code:

Output:

Conclusion:
In this lab, It effectively calculates the nth term of the Fibonacci series using a
recursive function. The program prompts the user to input the desired term,
and it then recursively computes the Fibonacci value for that term. The output
displays the result. This implementation showcases a clear understanding of
recursion for generating Fibonacci series values.
3. Tower of Hanoi:

Program Code:

Output:
Conclusion:
This lab efficiently solves the Tower of Hanoi problem using a recursive
algorithm. Users provide the number of disks, and the program calculates and
displays the sequence of moves required to solve the puzzle. The output also
includes the total number of moves made. This implementation demonstrates a
clear understanding of recursive problem-solving techniques for Tower of
Hanoi.
Practical Report of

Data Structures and Algorithm

CACS201

Lab Report 5:

Searching

Submitted to:

Department of Computer Science and Applications(CSA)

In partial fulfillment of the requirements for the backelor of

Bachelor of Computer Application (BCA)

Submitted by: Submitted to:

Nischal Bhurtel Sameer Sitaula

Roll no 39 ______________

BCA 3RD Semester Signature


1. Binary Searching:

Program Code:

Output:

Conclusion:
This lab effectively implements a binary search algorithm to search for a given
number in an array of ascending order. Users provide the number to search,
and the program conducts the binary search, displaying the result. It
demonstrates a practical understanding of binary search for data retrieval.
2. Linear Searching

Source Code:

Output:

Conclusion:
This lab effectively implements a linear search algorithm to search for a given
number in an array. Users provide the number to search, and the program
conducts the linear search, displaying the result. It demonstrates a practical
understanding of binary search for data retrieval.
Practical Report of

Data Structures and Algorithm

CACS201

Lab Report 6:

Sorting

Submitted to:

Department of Computer Science and Applications(CSA)

In partial fulfillment of the requirements for the backelor of

Bachelor of Computer Application (BCA)

Submitted by: Submitted to:

Nischal Bhurtel Sameer Sitaula

Roll no 39 ______________

BCA 3RD Semester Signature


1. Bubble Sorting:

Program Code:

Output:

Conclusion:
This lab efficiently implements the bubble sort algorithm to sort a given set of
numbers in ascending order. Users provide the total number of elements, and
the program sorts them using the bubble sort technique, displaying the sorted
result. In this example, the numbers are sorted successfully in ascending order.
This code demonstrates a practical understanding of the bubble sort algorithm
for basic sorting tasks.
2. Linear Sorting:

Program Code:

Output:

Conclusion:
This lab efficiently implements the linear sort algorithm to sort a given set of
numbers in ascending order. Users provide the total number of elements, and
the program sorts them using the linear sort technique, displaying the sorted
result. In this example, the numbers are sorted successfully in ascending order.
This code demonstrates a practical understanding of the linear sort algorithm
for basic sorting tasks.
3. Selection Sorting:

Program Code:

Output:

Conclusion:
This lab efficiently implements the bubble sort algorithm to sort a given set of
numbers in ascending order. Users provide the total number of elements, and
the program sorts them using the bubble sort technique, displaying the sorted
result. This code demonstrates a practical understanding of the bubble sort
algorithm for basic sorting tasks.

You might also like