Write a method delete() that takes an int argument k and deletes the kth ele- a linked list, if it exists.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 4SA
icon
Related questions
Question

Please help me complete the following code using JAVA. (See image for the Objective)

 

And please use this code as the foundation of your code (edit/modify it):

 

import java.io.*;

public class Q1320{

  public static void main(String[] args) throws Exception {

    try {

      String d1 = args[0].trim();

      String[] data = d1.split(" ");

      Q1320 obj = new Q1320();

      String output = obj.q1320(data[0], data[1]);

      System.out.println(output);

 

    } catch (Exception e) {

      e.printStackTrace();

    }

  }

   

  //Your code goes here

  public String q1320(String input, String n){

   return "Replace this with the output of your algorithm";

}

 

}

1.3.20 Write a method delete() that takes an int argument k and deletes the kth ele-
ment in a linked list, if it exists.
Transcribed Image Text:1.3.20 Write a method delete() that takes an int argument k and deletes the kth ele- ment in a linked list, if it exists.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning