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 command would you issue from a command prompt to see a listing of the computers in your workgroup?
ololo11 [35]
<span>Net View is the command issue from a command prompt to see a listing of the computers in your workgroup.It will display the list of domains,computers resources which have been shared by the specified computer then it will list all computers currently in our domain.The syntax for net view using command prompt NET VIEW [\\computername [/CACHE] | [/ALL] | /DOMAIN[:domainname]].</span>
8 0
3 years ago
'|'/2`/ '|'[] |)[-([]|)[- '|'#!$
natita [175]

Answer: mr Man

Explanation:

7 0
3 years ago
The
saveliy_v [14]
The answer is Undo I think
4 0
2 years ago
Read 2 more answers
When writing potential test questions, it is very important to use vocabulary words in their correct form. Please select the bes
Ilya [14]
The answer is True.

Hope I helped!
6 0
3 years ago
Read 2 more answers
ethics and internal control are important applications in accounting . Provide FIVE code of ethics and five internal control mea
IceJOKER [234]
Ethics:
- to ensure that privacy will not be lost.
-ensuring personal information is not lost
-information in the accountings will not be submitted or shared with anyone
-information will be saved and viewed by the business.
- The business will not falsely make the accountings.
6 0
3 years ago
Other questions:
  • Jack wants to store a large amount of data on his computer. He chooses to use a database for this purpose. What is a database? A
    8·1 answer
  • &gt;
    6·1 answer
  • Create a text file that contains your expenses for last month in the following categories: • Rent • Gas • Food • Clothing • Car
    13·1 answer
  • How can investors receive compounding returns
    13·1 answer
  • If you decide to get married, a trade-off would be that you have to give up being single.
    12·2 answers
  • The part of a rocket engine that allows the combustion gases and flames to leave the rocket engine is the
    14·1 answer
  • What is the build in libary function to compare two strings?​
    15·1 answer
  • Example of language processor software
    8·1 answer
  • What is the most used gaming keyboard in 2022?
    8·1 answer
  • Try using the index method yourself now! Using the index method, find out the position of "x" in "supercalifragilisticexpialidoc
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!