Implementation of Linked List Applications
Implementation of Linked List Applications
On
SUBMITTED BY
190030230 B.Naveen
190030265 Ch.Kalyan
190030494 G.S.S.Dhanush
ASSISTANT PROFESSOR
KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.
DEPARTMENT OF BASIC ENGINEERING SCIENCES
CERTIFICATE
I express the sincere gratitude to our director Dr. A Jagadeesh for his administration
towards our academic growth.
I express sincere gratitude to our Coordinator and HOD-BES Dr. D. Haritha for her
leadership and constant motivation provided in successful completion of our academic
semester. I record it as my privilege to deeply thank for providing us the efficient faculty and
facilities to make our ideas into reality.
I express my sincere thanks to our project supervisor Mr. S. PRADEEP RAJ for
his/her novel association of ideas, encouragement, appreciation and intellectual zeal which
motivated us to venture this project successfully.
Name: B.Naveen
Ch.Kalyan
E.Sai Supriya
G.S.S.Dhanush
190030265
190030437
190030494
ABSTRACT
The main aim of this project is to implement one of the most important applications of linked
list. In this project we have to show the applications of linked list. That is
1. Polynomial Addition
2. Polynomial Subtraction
3. Polynomial Multiplication
4. Polynomial Derivation
By this project we can easily can solve the polynomial operations. It will become very easy
for doing the Addition, Subtraction, Multiplication and Derivation for the given expression.
INDEX
1 Introduction 6
4 Class Diagram 9
5 Implementation 10 - 19
6 Outputs/ ScreenShots 20
7 Conclusion 21
INTRODUCTION
Introduction to Linked Lists:- Linked List is a very commonly used linear data structure
which consists of group of nodes in a sequence. Each node holds its own data and the address
of the next node hence forming a chain like structure. Linked Lists are used to create trees
and graphs. By using the linked list we have created Node class to access exponential and
coefficient then we created Linked List (LL) class to access the values, make an polynomial
equation in terms of “x” and operations like Addition, Subtraction, Multiplication,
Differentiate the polynomial equations.
AIM
Advantages: We can easily calculate the polynomial operations using liked list
SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:
Language : Java
Operating system: windows 7 (or) above
Software : ECLLIPSE.
HARDWARE REQUIREMENTS:
The hardware requirements that map towards the software are as follows:
RAM : 2gb
tmp1 = tmp;
tmp = tmp.next;
}
if (flag ==0)
{
Node node = new Node();
node.exp = exp;
node.coeff = coeff;
node.next = null;
if(head == null)
{
head = node;
}
else
{
tmp1.next = node;
}
}
}
public void poly_mul(Node poly1,Node poly2)
{
LL poly3 = new LL();
Node temp = poly2;
if(poly1 == null || poly2 == null)
{
System.out.println("One is zeropolynomial");
return;
}
while(poly1 != null)
{
poly2 = temp;
while(poly2 != null)
{
poly3.insertformul(poly1.coeff *poly2.coeff,poly1.exp+poly2.exp);
poly2 = poly2.next;
}
poly1 = poly1.next;
}
System.out.println("The poly after multiplication is:");
poly3.show();
}
public void poly_derive(Node poly1,Node poly2)
{ LL poly31 =new LL();
LL poly32 = new LL();
if( poly1 == null || poly2 == null)
{
System.out.println("one is Zero polynoial");
return ;
}
while(poly1 != null)
{
poly31.insert(poly1.coeff * poly1.exp,poly1.exp - 1);
poly1 = poly1.next;
}
while(poly2 != null)
{
poly32.insert(poly2.coeff * poly2.exp,poly2.exp - 1);
poly2 = poly2.next;
}
System.out.println("First poly derivative:"");
poly31.show();
System.out.println("Second poly derivative:");
poly32.show();
}
}
Main.java
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
String s;
int p;
Scanner in = new Scanner(System.in);
LL poly1 = new LL();
LL poly2 = new LL();
LL poly3 = new LL();
System.out. println("Enter number of terms in polynomial one");
s = in. nextLine();
p = Integer.parseInt(s);
poly1 = poly1.create(p);
System.out. println("polynomial one:");
poly1.show();
System.out. println("Enter number of terms in polynomial two");
s = in. nextLine();
p = Integer.parseInt(s);
poly2=poly2.create(p);
System.out. println("polynomial two:");
poly2.show();
System.out.println("1.Addition:");
poly3.poly_add(poly1.head,poly2.head);
System.out.println("2.Substraction:");
poly3.poly_subs(poly1.head,poly2.head);
System.out.println("3.Multiplication:");
poly3.poly_mul(poly1.head,poly2.head);
System.out.println("4.Derivation:");
poly3.poly_derive(poly1.head,poly2.head);
}
}
OUTPUT
Screen Shots:
CONCLUSION
By this we can easily calculate the operations like Addition, Subtraction, Multiplication,
Differentation in polynomial using linked list.