SlideShare a Scribd company logo
{public int idata;//data item (key) public double ddata;//data item publis link next;//next link in
list public link int id double dd)//constructor} idata = id; ddata=dd;} public void display link
()//display ourself {system out. Print ("{" + idata + ", " + ddata + "}");}}//end class link
class linklist {private link first;//ref to first link on list public link list ()//constructor {first =
null;//no links on lists yet public void insertfirst (int id, double dd)//make new link link new link
= new link (id, dd); newlink.next = first;//it points to old first link first = newlink;//now first
points to this} public link find (int key)//find link with given key {link current = first;
while(current.idata ! = key)}//(assumes non-empty list){//starts at first'//while no match, if
(current.next == null)//if end of list return null; else}'//didnt find it//not end list//not end of list,
//go to next link//found it return current;}
Solution
public class Link {
public int iData;
public double dData;
public Link next;
/**
* @param iData
* @param dData
*/
public Link(int iData, double dData) {
this.iData = iData;
this.dData = dData;
}
public void displayLink() {
System.out.println("{" + iData + ", " + dData + "} ");
}
}
public class LinkList {
private Link first;
public LinkList() {
// TODO Auto-generated constructor stub
first = null;
}
public void insertFirst(int id, double dd) {
Link newLink = new Link(id, dd);
}
public Link find(int key) {
Link current = first;
while (current.iData != key) {
if (current.next == null)
return null;
else
current = current.next;
}
return current;
}
}

More Related Content

PDF
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
PDF
Note             Given Code modified as required and required met.pdf
PDF
please i need help Im writing a program to test the merge sort alg.pdf
PDF
Given below is the completed implementation of MyLinkedList class. O.pdf
PDF
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
PDF
Design, implement, test(In Java ) a doubly linked list ADT, using DL.pdf
PDF
Implement a priority queue using a doublyLinked-cpp where the node wit.pdf
PDF
Objective The purpose of this exercise is to create a Linked List d.pdf
Here is the editable codeSolutionimport java.util.NoSuchEleme.pdf
Note             Given Code modified as required and required met.pdf
please i need help Im writing a program to test the merge sort alg.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
PLEASE MAKE SURE THE PROGRAM IS ASKING FOR INPUT FROM USER TO ADD OR.pdf
Design, implement, test(In Java ) a doubly linked list ADT, using DL.pdf
Implement a priority queue using a doublyLinked-cpp where the node wit.pdf
Objective The purpose of this exercise is to create a Linked List d.pdf

Similar to {public int idata;data item (key) public double ddata;data item p.pdf (20)

PDF
Please and Thank youObjective The purpose of this exercise is to .pdf
PDF
For each task, submit your source java code file.(1) Objective Im.pdf
PDF
Hi,I have added the methods and main class as per your requirement.pdf
PDF
code ----- public void add(int key, T value) { Link previou.pdf
PDF
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
PDF
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
PDF
Step 1 The Pair Class Many times in writing software we come across p.pdf
PDF
File LinkedList.java Defines a doubly-l.pdf
PDF
hi i have to write a java program involving link lists. i have a pro.pdf
PDF
public class MyLinkedListltE extends ComparableltEgtg.pdf
DOCX
Link list assi
DOCX
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
PDF
Node for list storage. class Ndd { int data; Ndd next; N.pdf
PDF
practice of using and manipulating a doubly linked list and (2) prac.pdf
DOCX
Lecture 18Dynamic Data Structures and Generics (II).docx
PDF
Objective The purpose of this exercise is to create a Linke.pdf
PDF
Objective The purpose of this exercise is to create a Linke.pdf
PDF
Linked List Objective The purpose of this exercise is to cr.pdf
PDF
In this assignment you will implement insert() method for a singly l.pdf
PDF
Fix my codeCode.pdf
Please and Thank youObjective The purpose of this exercise is to .pdf
For each task, submit your source java code file.(1) Objective Im.pdf
Hi,I have added the methods and main class as per your requirement.pdf
code ----- public void add(int key, T value) { Link previou.pdf
Solution#includestdio.h#includeconio.h#includealloc.h.pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Step 1 The Pair Class Many times in writing software we come across p.pdf
File LinkedList.java Defines a doubly-l.pdf
hi i have to write a java program involving link lists. i have a pro.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
Link list assi
The MyLinkedList class used in Listing 24.6 is a one-way directional .docx
Node for list storage. class Ndd { int data; Ndd next; N.pdf
practice of using and manipulating a doubly linked list and (2) prac.pdf
Lecture 18Dynamic Data Structures and Generics (II).docx
Objective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdf
Linked List Objective The purpose of this exercise is to cr.pdf
In this assignment you will implement insert() method for a singly l.pdf
Fix my codeCode.pdf
Ad

More from aroramobiles1 (20)

PDF
Please help with this JAVA Assignment and show output if you can ple.pdf
PDF
ooo T-Mobile LTE 820 PM courses.apexlearning.com Question 34 of 42 M.pdf
PDF
ood evening people. Ive been working on this code that sends a bur.pdf
PDF
Multiply. 0 072(10,000) Multiply. 317.02 middot 0.01 Write the nu.pdf
PDF
Mitochondria and chloroplasts have small genomes becauseQuestion .pdf
PDF
Meta-population theory and island biogeography theory are similar in .pdf
PDF
Java Programpublic class Fraction {   instance variablesin.pdf
PDF
Kim’s revenue one week ago were $251 less than three times Janes rev.pdf
PDF
I am having a hard time with this problem, can you help me #5. .pdf
PDF
How has television influenced the political process, specifically th.pdf
PDF
HISTORY Why is it called American revolutionSolutionThe .pdf
PDF
Explain what #include does in a source codeSolution Th.pdf
PDF
dNdS ratios reflect patterns of genetic divergence that have accumu.pdf
PDF
Discuss the complexity of problem definition and the importance of a.pdf
PDF
Define the following terms i. Hydraulic gradientii. Seepageiii. Cr.pdf
PDF
Describe how the principle of consistency can be applied to interfac.pdf
PDF
Chapter 8 was tough for me. When determining the lumber needs of the.pdf
PDF
You have been given a file that contains fields relating to CD infor.pdf
PDF
Write a java method named flipLines that accepts as its parameter a .pdf
PDF
Which of the following isare true regarding router operationA. R.pdf
Please help with this JAVA Assignment and show output if you can ple.pdf
ooo T-Mobile LTE 820 PM courses.apexlearning.com Question 34 of 42 M.pdf
ood evening people. Ive been working on this code that sends a bur.pdf
Multiply. 0 072(10,000) Multiply. 317.02 middot 0.01 Write the nu.pdf
Mitochondria and chloroplasts have small genomes becauseQuestion .pdf
Meta-population theory and island biogeography theory are similar in .pdf
Java Programpublic class Fraction {   instance variablesin.pdf
Kim’s revenue one week ago were $251 less than three times Janes rev.pdf
I am having a hard time with this problem, can you help me #5. .pdf
How has television influenced the political process, specifically th.pdf
HISTORY Why is it called American revolutionSolutionThe .pdf
Explain what #include does in a source codeSolution Th.pdf
dNdS ratios reflect patterns of genetic divergence that have accumu.pdf
Discuss the complexity of problem definition and the importance of a.pdf
Define the following terms i. Hydraulic gradientii. Seepageiii. Cr.pdf
Describe how the principle of consistency can be applied to interfac.pdf
Chapter 8 was tough for me. When determining the lumber needs of the.pdf
You have been given a file that contains fields relating to CD infor.pdf
Write a java method named flipLines that accepts as its parameter a .pdf
Which of the following isare true regarding router operationA. R.pdf
Ad

Recently uploaded (20)

PDF
Complications of Minimal Access Surgery at WLH
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Presentation on HIE in infants and its manifestations
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Classroom Observation Tools for Teachers
PPTX
Pharma ospi slides which help in ospi learning
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
RMMM.pdf make it easy to upload and study
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PPTX
Institutional Correction lecture only . . .
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Complications of Minimal Access Surgery at WLH
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Presentation on HIE in infants and its manifestations
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
human mycosis Human fungal infections are called human mycosis..pptx
Classroom Observation Tools for Teachers
Pharma ospi slides which help in ospi learning
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
RMMM.pdf make it easy to upload and study
Microbial diseases, their pathogenesis and prophylaxis
O7-L3 Supply Chain Operations - ICLT Program
STATICS OF THE RIGID BODIES Hibbelers.pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Institutional Correction lecture only . . .
VCE English Exam - Section C Student Revision Booklet
Chapter 2 Heredity, Prenatal Development, and Birth.pdf

{public int idata;data item (key) public double ddata;data item p.pdf

  • 1. {public int idata;//data item (key) public double ddata;//data item publis link next;//next link in list public link int id double dd)//constructor} idata = id; ddata=dd;} public void display link ()//display ourself {system out. Print ("{" + idata + ", " + ddata + "}");}}//end class link class linklist {private link first;//ref to first link on list public link list ()//constructor {first = null;//no links on lists yet public void insertfirst (int id, double dd)//make new link link new link = new link (id, dd); newlink.next = first;//it points to old first link first = newlink;//now first points to this} public link find (int key)//find link with given key {link current = first; while(current.idata ! = key)}//(assumes non-empty list){//starts at first'//while no match, if (current.next == null)//if end of list return null; else}'//didnt find it//not end list//not end of list, //go to next link//found it return current;} Solution public class Link { public int iData; public double dData; public Link next; /** * @param iData * @param dData */ public Link(int iData, double dData) { this.iData = iData; this.dData = dData; } public void displayLink() { System.out.println("{" + iData + ", " + dData + "} "); } } public class LinkList { private Link first; public LinkList() { // TODO Auto-generated constructor stub first = null; } public void insertFirst(int id, double dd) {
  • 2. Link newLink = new Link(id, dd); } public Link find(int key) { Link current = first; while (current.iData != key) { if (current.next == null) return null; else current = current.next; } return current; } }