Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

9. On the last page of these review problems is an implementation o the IntNode class. (a) Write an implementation of the static method public

image text in transcribed
9. On the last page of these review problems is an implementation o the IntNode class. (a) Write an implementation of the static method public static int countZeros( IntNode node ) that will count the number of zeros that occur in the given linked list of ints. (b) Write an implementation of a static method public static String list2String( IntNode node) that returns a String representation of the linked list referred to by the parameter node. If the linked list is empty, the String representation should be " (two square brackets next to each other). If the linked list is not empty, the String representation should look like this, "3 52 0 2-4 16 1", with a space before and after each entry of the list. (c) Write a method public static IntNode removeFirst( IntNode head) that returns a reference to the second node from the linked list referred to by the parameter head. (d) Write a method public static IntNode addFirat( int element, IntNode head) that returns a reference to the new head of a linked list with a node containing element followed by the list referred to by the parameter head. (e) Write a method public static void set ( int element, int i, IntNode head) that modifies the list referred to by the parameter head so that the i'th node in the list has its data changed to element. If there is no i'th node in the list, then the list is not modified

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago