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
A ________ algorithm is a method of locating a specific item of information in a larger collection of data.
pav-90 [236]
A .) Sort

more ... To arrange or group in a special way (such as by size, type or alphabetically).
6 0
3 years ago
The variable sentence stores a string. Write code to determine how many words in sentence start and end with the same letter, in
irina [24]

Answer:

sentence = "hello wow a stores good"

same_letter_count = 0

sentence_list = sentence.split()

for s in sentence_list:

   if s[0] == s[-1]:

       same_letter_count += 1

print(same_letter_count)

Explanation:

*The code is in Python.

Initialize the sentence with a string

Initialize the same_letter_count as 0

Split the sentence using split method and set it to the sentence_list

Create a for loop that iterates through the sentence_list. If the first and last of the letters of a string are same, increment the same_letter_count by 1

When the loop is done, print the same_letter_count

4 0
3 years ago
"What technology will examine the current state of a network device before allowing it can to connect to the network and force a
slava [35]

Answer:

a network access control

3 0
3 years ago
What is the function of a slide transition in a presentation program? A. It enables you to change the presentation layouts. B. I
Lelechka [254]

The answer would be

C. It adds visual effects when you move from one slide to another.

Hope this has helped you! :)

5 0
3 years ago
Read 2 more answers
Consider the following two code segments: Segment 1: while (k > 0) { System.out.println(k); k--; } --------------- Segment 2:
zepelin [54]

Answer:

Always same value

Explanation:

These both code segments will always generate identical values given that we provide same value of k to both segments.

You can see attached pictures.

6 0
3 years ago
Other questions:
  • If your DTP document contains watermarks on every page, where can you place them?
    13·2 answers
  • The set of specific, sequential steps that describe exactly what a computer program must do to complete the work is called a(n _
    14·1 answer
  • Which two technologies support the building of single-page applications? and are two technologies helpful in building single pag
    12·1 answer
  • Which of the following information would best be displayed throughout the use of a time line
    11·1 answer
  • Which of the following information should be included in audit documentation? a. Procedures performed. b. Audit evidence examine
    13·1 answer
  • How did you generate a random number for the user to guess?
    9·1 answer
  • Explain the term game! And give me complete sentences. U can use ur opinion as well!
    11·1 answer
  • Why should we not underestimate the widespread of mass media?
    13·1 answer
  • Is there a way for me to play a .mp3 file from my computer using Atom?
    10·1 answer
  • Discuss the advantages and disadvantages of supporting links to files that cross mount points (that is, the file link refers to
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!