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
galben [10]
2 years ago
14

Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p

ointer to delete the node while (first != nullptr) { temp = first; first = first->next; ____ } last = nullptr; count = 0; } Which of the following is the missing statement?
Computers and Technology
1 answer:
Lera25 [3.4K]2 years ago
5 0

Answer:

The answer is "delete temp;".

Explanation:

  • In the given code a class "doublyLinkedList" is defined that contains a method that is destroy(). This code uses a scope resolution operator to define the method outside the class.
  • To access this method write return type of function then class name:: (use scope resolution operator) and function name.
  • In this function, nodeType temp is a pointer variable that is used to delete the node.
  • In method definition, a loop is declared that check value that is first not equal to nullptr. which means the first node is not equal to null. In this loop, a temp variable holds the first variable value and the first variable value is holding another variable value and then use the "delete temp" statement to delete a node in the list.
  • Outside a loop, the last variable holds nullptr variable value and the count variable assigns a value that is 0.
You might be interested in
How acid rain pollution will affect the food chain
babunello [35]

Explanation:

Acid rain can cause serious problems for many different animals and plants. As a result, the entire food web is affected. For example, acid rain can cause phytoplankton in lakes to die. Insects, which rely on phytoplankton for food, now have less food to eat, and they begin to die as a result.

3 0
3 years ago
Read 2 more answers
Meg[] elements = {new Lois(), new Stewie(), new Meg(), new Brian()}; for (int i =0; i
Stells [14]

Complete question is attached as snapshot.

Answer:

This will result in a compilation error.

Here's the inheritance hierarchy:

Meg -> Lois -> Brian -> Stewie

Now Meg has 2 public Fxns, a() and toString().

Lois inherits from Meg and all its public functions as well but, overrides the a() fxn of its super class.

So finally Lois has fxns a(), b() and toString().

Brian extends Lois and inherits all the above listed fxns of Lois, but overrides the b() and toString() fxns.

Stewie extends Brian and inherits all the fxns of Brian, but overrides the a() and toString() fxns.

In the Main driver fxn, we call a() and b() methods of all these classes but, the base class Meg has no b() and it is not extending any class so its not available in its scope.

This results in a compilation error.

Explanation:

7 0
3 years ago
What is a good computer i should get
algol [13]

Answer:

MacBook or a Dell computer in my opinion

Explanation:

5 0
2 years ago
Read 2 more answers
Please help.
storchak [24]

Hey mate!

Answer:

import java.util.*;

class Max Min

{

public static void main()

{

int a,b,c,x,y,z,m,n;

Scanner in=new Scanner(System.in);

System.out.println("Enter three unequal numbers:");

a=in.nextInt();

b-in.nextInt();

c=in.nextInt();

x=Math.max(a,b);

y=Math.max(b,c);

z=Math.max(c,a);

m=Math.min(x,y);

n=Math.min(z,m);

System.out.printLn("Second Smallest Number is:"+n);

}

}

Explanation:

  1. here scanner class is used
  2. here java.util package is used

<em><u>h</u></em><em><u>o</u></em><em><u>p</u></em><em><u>e</u></em><em><u> </u></em><em><u>it</u></em><em><u> </u></em><em><u>he</u></em><em><u>lped</u></em><em><u> you</u></em><em><u>:</u></em><em><u>)</u></em>

4 0
3 years ago
Because all web browsers don't interpret html and css the same way, a major web development issue is
Triss [41]
Cross browser. Hope I am right.
8 0
3 years ago
Other questions:
  • Are u a chicken nugget!!??
    14·2 answers
  • Client computers cannot function unless they are connected to the network because they cannot access an operating system.
    7·1 answer
  • What Linux services can pose a problem when attempting to reach remote host on a network?
    5·2 answers
  • Which of the following scanning technique attackers use to bypass firewall rules, logging mechanism, and hide themselves as usua
    11·1 answer
  • The Cursor is blinking in a white area on the Screen. This area where text will appear in the ____.
    10·2 answers
  • Suppose 8 people want to communicate with each other using public key encryption. The communication between any pair of them is
    7·1 answer
  • Projects used for print and web have different ?
    5·1 answer
  • Guess The Song: <br> What Popping Brand New Whip Just Hopped In, I Got options
    15·1 answer
  • Write a program to input a number and check whether it is even or odd number
    7·1 answer
  • A slide titled Alexander Graham Bell. There are 6 bulleted entries on the slide, and there is a lot of text on the slide. There
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!