I create a student list (linked list) that can add, view and edit student information. I have two fields, namely: the name of the student and the class of students, and I add new students to the list so that they are sorted according to the degrees of students in descending order.
I finished doing the add and browse. The problem is in the editing part, because I need to edit this information, then I need to sort it again so that it is in the correct location of the list.
For example, I have information about three students according to my grades:
student1 90 -> student2 85 -> student3 80 -> NULL
Then I need to edit class student2 to 75 so that the edited linked list is now ordered as follows:
student1 90 -> student3 80 -> student2 75 -> NULL
How can I do it? You do not need to give me the code. I just need some tips on how I can implement the editing part of my program. I am going to create a new node (with edited information), delete the old node and insert the edited node into the list. Is my logic correct? or is there a better way to solve my problem.
source share