1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
OLga [1]
3 years ago
12

Extend the class linkedListType by adding the following operations: Write a function that returns the info of the kth element of

the linked list. If no such element exists, terminate the program. Write a function that deletes the kth element of the linked list. If no such element exists, terminate the program.
Computers and Technology
1 answer:
WINSTONCH [101]3 years ago
6 0

Answer:

Explanation:

The following code is written in Java. Both functions traverse the linkedlist, until it reaches the desired index and either returns that value or deletes it. If no value is found the function terminates.

public int GetNth(int index)

       {

       Node current = head;

       int count = 0;

       while (current != null)

       {

       if (count == index)

       return current.data;

       count++;

       current = current.next;

       }

       assert (false);

       return 0;

       }

public int removeNth(int index)

       {

       Node current = head;

       int count = 0;

       while (current != null)

       {

       if (count == index)

       return current.remove;

       count++;

       current = current.next;

       }

       assert (false);

       return 0;

       }

You might be interested in
What is a word processor in ms word​
marysya [2.9K]

A word processor is software or a device that allows users to create, edit, and print documents. It enables you to write text, store it electronically, display it on a screen, modify it by entering commands and characters from the keyboard, and print it. Of all computer applications, word processing is the most common.

6 0
3 years ago
Read 2 more answers
What is a programming concept based on objects and data and how they relate to one another, instead of logic and actions. Hint:
Gre4nikov [31]
Object-oriented programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic.
3 0
3 years ago
Why do companies use online collaborative productivity software.
vladimir2022 [97]

Why do companies use online collaborative productivity software? Companies use online collaborative productivity software to allow employees to share document such as reports or spreadsheets and make edits or comments.

4 0
3 years ago
Change the following sentences using 'used to
Alinara [238K]

Answer:

a. We <u>used to</u> go to school together.

b. How did you <u>use to</u> spend the winter evenings?

c. We <u>used to </u>have our milk delivered.

d. I <u>used to</u> be in love with him.

e. At one time there <u>used to</u> be trees in the garden.

5 0
3 years ago
CODEHS- Please help!
Ksivusya [100]

Answer:

Revisiting "Build a Tower"

Recall in the last section how we made Karel make a tower of tennis balls. We told Karel to move() and turnLeft() and putBall() until we had a tower. At the end of the program, Karel was still at the top of the tower, like as in the picture below.

Stuck at top

Suppose that now we want Karel to come back down from the top of the tower. The first thing we need to do is get Karel facing in the right direction. One way to do this is to tell Karel

turnLeft();

turnLeft();

turnLeft();

And then tell Karel to

move();

move();

move();

back to the bottom of the tower.

However, telling Karel to turnLeft() three times is not very readable. That's a lot of writing when all we really want is to tell Karel to "turn right."

Explanation:

Hopefully it would help.

8 0
3 years ago
Other questions:
  • A windows host sends a tcp segment with source port number 1200 and destination port number 25. the sending host is a(n) _______
    10·1 answer
  • What is the purpose of the overload keyword in the ip nat inside source list 1 pool nat_pool overload command?
    8·1 answer
  • 1.Which type of camera tool pushes the picture back and makes it wider, exaggerating the distance between the background and for
    13·2 answers
  • To save and store data separate from a computer, it helps to have an
    15·2 answers
  • Issues with paper based records include a. time spent re-keying data, searching for paper copies, and filing. b. storage volume
    9·1 answer
  • How do i move a file in python3
    10·1 answer
  • What is ‘Software Testing’?
    13·1 answer
  • Identify the correct characteristics of Python tuples. Check all that apply.
    9·1 answer
  • b. Write a complete program for the following situation related to setting the speed of a car to preset values before starting a
    5·1 answer
  • Who is the best valorant character
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!