1. Implement a phone book using a linked list structure. In this phone book, you are going to store a name, last name, email, and phone number. 2. Implement an insert operation to the phone book. With the insert operation, you're going to add the name, last
1. Implement a phone book using a linked list structure. In this phone book, you are going to store a name, last name, email, and phone number. 2. Implement an insert operation to the phone book. With the insert operation, you're going to add the name, last
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Use Java

Transcribed Image Text:**Phonebook with LinkedList**
1. **Task**: Implement a phone book using a linked list structure. In this phone book, you will store a name, last name, email, and phone number.
2. **Insert Operation**: Implement an insert operation to add the name, last name, email, and phone number of the person to the phone book.
3. **Methods to Implement**:
- **findByName**: Will return the information of the first record matching the name you send.
- **findAllByLastName**: Will return an ArrayList of all entries matching the last name you send.
- **deleteByName**: Will delete the first record matching the name you send to this method.
- **deleteAllMatchingLastName**: Will delete all entries matching the last name.
- **findAll**: Return all records as an ArrayList.
- **printPhoneBook**: Will print all entries in the phone book.
---
**Discussion**: Let’s discuss the following after you do the above task.
1. What is the time complexity of the above operations?
2. How can we come up with O(1) with the findByName operation? (lovely hash map)

Transcribed Image Text:# Phonebook with LinkedList
## 1. Implement a Phonebook Using a Linked List Structure
In this phonebook, you are going to store:
- Name
- Last Name
- Email
- Phone Number
### Code Overview
#### PhoneBookNode Class
```java
public class PhoneBookNode {
public Contact contact;
public PhoneBookNode next;
public PhoneBookNode(Contact contact) {
this.contact = contact;
}
}
```
- This Node class is designed for a singly linked list node implementation.
- The `contact` object is responsible for holding the value.
- It is a different version of the Node class used before.
#### Contact Class
```java
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class Contact {
public String firstName;
public String lastName;
public String email;
public String phoneNumber;
}
```
- The `Contact` class holds the details like `firstName`, `lastName`, `email`, and `phoneNumber`.
#### ListNode Example
```java
static class ListNode {
int value;
ListNode next;
ListNode(int x) {
value = x;
}
}
```
- This class is part of a standard singly linked list implementation.
### Description
- The PhoneBookNode class serves as the building block for our phonebook linked list. It connects `Contact` objects in a sequence.
- The Contact class uses annotations for automatic constructor generation and object string representation.
- The static ListNode class demonstrates basic linked list node structure, aiming to visualize linked node concepts.
This is a foundational implementation of a phonebook using linked list data structures, suitable for educational purposes in understanding linked lists and class design in Java.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education