This topic contains a solution. Click here to go to the answer

Author Question: For the questions below, assume Node is a class consisting of an int info and a Node next and header ... (Read 283 times)

tatyanajohnson

  • Hero Member
  • *****
  • Posts: 569
For the questions below, assume Node is a class consisting of an int info and a Node next and header is a HeaderNode that has Node front, rear and int count where front references the first item in the list, rear references the last item in the list and count is the number of elements in the list.


Previously, to iterate through a linked list, we used a while loop.  Which of the following for-loops could replace the previous while loop that would start at head and go until temp == null?
◦ for (Node temp = header.front, int j = 0;  j < header.count; temp = temp.next)  { ... }
◦ for (int j = 0;  j < header.count; j++) { ... }
◦ for (Node temp = header.front;  temp != header.rear; temp = temp.next) { ... }
◦ for (Node temp = header.front, int j = 0;  j < header.count; temp = temp.next, j++) { ...}
◦ for (Node temp = header.front, int j = 0;  j < header.count && temp != header.rear; temp = temp.next, j++) { ... }


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by tatyanajohnson on Aug 30, 2020

bbburns21

  • Sr. Member
  • ****
  • Posts: 336
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 49% of students answer this correctly




tatyanajohnson

  • Member
  • Posts: 569
Reply 2 on: Aug 30, 2020
Wow, this really help


ricroger

  • Member
  • Posts: 352
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

The modern decimal position system was the invention of the Hindus (around 800 AD), involving the placing of numerals to indicate their value (units, tens, hundreds, and so on).

Did you know?

The human body produces and destroys 15 million blood cells every second.

Did you know?

Pink eye is a term that refers to conjunctivitis, which is inflammation of the thin, clear membrane (conjunctiva) over the white part of the eye (sclera). It may be triggered by a virus, bacteria, or foreign body in the eye. Antibiotic eye drops alleviate bacterial conjunctivitis, and antihistamine allergy pills or eye drops help control allergic conjunctivitis symptoms.

Did you know?

Vital signs (blood pressure, temperature, pulse rate, respiration rate) should be taken before any drug administration. Patients should be informed not to use tobacco or caffeine at least 30 minutes before their appointment.

Did you know?

The word drug comes from the Dutch word droog (meaning "dry"). For centuries, most drugs came from dried plants, hence the name.

For a complete list of videos, visit our video library