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
I have the assembly for the max. can someone change the variables of it and make it min. I mean, the assembly for finding the mi
tatyana61 [14]
Bruh i honeselty dont know
4 0
3 years ago
13. You're doing research for a paper. When would you use an indirect citation?
Whitepunk [10]

Answer:

D

Explanation:

d is the answer

5 0
2 years ago
What standards organization maintains the ethernet standard?.
Fofino [41]

Answer:

Ethernet standards are written and maintained by the IEEE, the Institute of Electrical and Electronic Engineers which has its corporate office in New York City and its operations center in Piscataway, New Jersey.

Explanation:

5 0
2 years ago
Which of the following statement is true?
Lynna [10]
C is the correct answer I believe
4 0
3 years ago
How do you launch windows on a computer?
alexandr1967 [171]
You shood just be able to tern it on 
5 0
3 years ago
Other questions:
  • Why is the protocol down, even though you issued the no shutdown command for interface vlan 99?
    5·2 answers
  • Select all ways that databases may help you manage and manipulate data and records.
    11·1 answer
  • What are barcode and rfid tags ​
    11·2 answers
  • Why is UDP less reliable than TCP?
    9·2 answers
  • Sam needs to create a spreadsheet for his coworkers. They will need to follow a crossed a long road of data. Sam would like to m
    15·1 answer
  • Define time management and give two activities that you can do to help manage your tasks, homework, or projects better.
    12·1 answer
  • ¿Cuales son las empresas mas exitosas que aún usan hoja de cálculo? porfa es urgentee
    6·1 answer
  • How can i fix this, if i log in my acc it keeps saying wrong nickname or pass. even though my email and pass is correct
    12·1 answer
  • The method used to transfer information to far off place instantly is called​
    13·2 answers
  • Desktop computers have a(n) ________ unit, located within the system unit, that plugs into a standard wall outlet, converts AC t
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!