6.5)DoublyLinkedList-1.docx - Write a program that reads a list of students(first names only from a file It is possible for the names to be in unsorted

6.5)DoublyLinkedList-1.docx - Write a program that reads a...

This preview shows page 1 - 2 out of 2 pages.

Write a program that reads a list of students (first names only) from a file. It is possible for the names to be in unsorted order in the file but they have to be placed in sorted order within the linked list. The program should use a doubly linked list . Each node in the doubly linked list should have the student’s name, a pointer to the next student, and a pointer to the previous student. Here is a sample visual. The head points to the beginning of the list. The tail points to the end of the list. When inserting consider all the following conditions: if(!head){ //no other nodes }else if (strcmp(data, head->name)<0){ //smaller than head }else if (strcmp(data, tail->name)>0){ //larger than tail }else{ //somewhere in the middle }
Image of page 1
When deleting a student consider all the following conditions: student may be at the head, the tail or in the middle Below, you will find a sample of what the file looks like. Notice the names are in unsorted order but the
Image of page 2

You've reached the end of your free preview.

Want to read both pages?

  • Spring '19

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors