From 1911f9cfef687fbe38d62eaadb8beec2424eda2c Mon Sep 17 00:00:00 2001 From: zleyyij <75810274+zleyyij@users.noreply.github.com> Date: Tue, 19 Nov 2024 22:10:22 -0700 Subject: [PATCH] vault backup: 2024-11-19 22:10:22 --- .../software development/ECE1400/Chapter 17 Exercises.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/education/software development/ECE1400/Chapter 17 Exercises.md b/education/software development/ECE1400/Chapter 17 Exercises.md index 67adf53..6f3d402 100644 --- a/education/software development/ECE1400/Chapter 17 Exercises.md +++ b/education/software development/ECE1400/Chapter 17 Exercises.md @@ -77,11 +77,11 @@ In the above code, if the new item needs to be inserted at the *end* of the list struct node *insert_into_ordered_list(struct node *list, struct node *new_node) { struct node *cur = list, *prev = NULL; while (cur->value <= new_node->value) { + prev = cur; + cur = cur->next; if (cur->next == NULL) { break; } - prev = cur; - cur = cur->next; } prev->next = new_node; new_node->next = cur;