Discrete Mathematics with Graph Theory (3rd Edition) 234

Discrete Mathematics with Graph Theory (3rd Edition) 234 -...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
232 9. .c 1 .c 2 1,4,9,12 4,9,12 4,9,12 4,9,12 9,12 9,12 9,12 9,12 .c 3 2,4,7,7,9,11 2,4,7,7,9,11 4,7,7,9,11 7,7,9,11 7,7,9,11 7,9,11 9,11 11 11 12 1 1,2 1,2,4 1,2,4,4 1,2,4,4,7 1,2,4,4,7,7 1,2,4,4,7,7,9 1,2,4,4,7,7,9,9 1,2,4,4,7,7,9,9,11,12 The algorithm required nine comparisons. to. (a) [BB] The lists 1 and 2,3,4 can be merged with one comparison . .cl.c2 .c3 1 2,3,4 1,2,3,4 (b) [BB] The lists 5 and 2,3,4 can be merged with three comparisons . .c 1 .c 2 .c 3 5 2,3,4
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 5 3,4 5 4 2 2,3 2,3,4,5 Solutions to Exercises (c) [BB] The lists 1,3,5 and 2,4,6 can be merged with 3 + 3 - 1 = 5 comparisons . .c 1 .c 2 .c 3 1,3,5 3,5 3,5 5 5 2,4,6 2,4,6 1 4,6 1,2 4,6 6 1,2,3 1,2,3,4 1,2,3,4,5,6 11. Two such lists are 1,2,3,4 and 5, and here's why . .c 1 .c 2 .c 3 1,2,3,4 5 2,3,4 5 3,4 5 4 5 1 1,2 1,2,3 1,2,3,4,5 12. To merge two given sorted lists of lengths s and t, into a single sorted list of length s + t, proceed as follows....
View Full Document

Ask a homework question - tutors are online