the following piece of code. (The numbers on the left margin denote line numbers.) line# 01 class LL_node { 02     int val; 03     LL_node next; 04     public LL_node (int n) { 05         val = n; 06         next = null; 07     } 08     public void set_next (LL_node nextNode) { 09         next = nextNode; 10     } 11     public LL_node get_next () { 12         return next;

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
icon
Related questions
Question

Consider the following piece of code. (The numbers on the left margin denote line numbers.)

line#
01 class LL_node {
02     int val;
03     LL_node next;
04     public LL_node (int n) {
05         val = n;
06         next = null;
07     }
08     public void set_next (LL_node nextNode) {
09         next = nextNode;
10     }
11     public LL_node get_next () {
12         return next;
13     }
14     public void set_value (int input) {
15         val = input;
16     }
17     public int get_value () {
18         return val;
19     }
20 }
21 public class LL {
22     protected LL_node head;
23     protected LL_node tail;
24     public LL () {
25         head = null;
26         tail = null;
27     }
28     public int append (int n) {
29         if (head == null) {
30             head = new LL_node(n);
31             tail = head;
32         } else {
33             LL_node new_node;
34             new_node = new LL_node(n);
35             tail.set_next (new_node);
36             tail = new_node;
37         }
38         return n;
39     }
40 }


which the following statement is true (it can be more than one of the statements could be true. 

A.To search an element in a linked list represented by an object/instance of class LL, we have to start from the head node and traverse the list until we find the element or reach the tail node without success.
 
B.When the linked list represented by an object/instance of class LL is empty, the head and tail references point to null.
 
C.An object/instance of class LL can represent a linked list that allows nodes to be added at the tail end only.
 
D.The advantage of having the reference to the tail node along with the head node in class LL is that we can start searching the list from the tail node and continue till the head node, until we have found the element or the search has failed.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Methods of StringBuilder class
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education