February 2020
Beginner to intermediate
616 pages
15h 16m
English
We will begin the comparison by comparing first two nodes, so the temp1 and temp2 pointers will be set to point at the first and second nodes of the linked list, respectively (see Figure 5.26 (a)). The data members of temp1 and temp2 will be compared. As is clear, temp1->data is less than temp2->data (that is, 1 < 7), so their places will not be interchanged. Thereafter, the temp1 and temp2 pointers will shift one step further. We can see in Figure 5.26 (b) that the temp1 and temp2 pointers are set to point at nodes of the values 3 and 4, respectively:

Once again, the data members of the temp1 and temp2 pointers ...
Read now
Unlock full access