Skip to main content

Thread: Straight Insertion Sort and Double-Linked List?


hello!
have sort double-linked list via straight insertion sort. problem seem somehow wrong. got segmentation fault after third time cycle starts, using numbers: 3 5 4 2 7 6 8 9 1
help. i'm more looking hint of i'm doing wrong ready-to-use code. source attached below...
attached files attached files

use debugger gdb step though code.

ran through list 2<->1, output:
program received signal sigsegv, segmentation fault.
0x080494a6 in straightinsertionsort () @ kpp.cpp:203
warning: source file more recent executable.
203 if(p->next->prev||p->prev) p->next->prev=p->prev;
(gdb) p p->next
$4 = (linked_list *) 0x0

p->next null pointer p->next->prev undefined

on first sight algorithm seems strange too, insertion sort need add_before? if remember correctly have swap links


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Straight Insertion Sort and Double-Linked List?


Ubuntu

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support