Discrete Mathematics with Graph Theory (3rd Edition) 233

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

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

Section 8.3 231 Since 4 = n #- 1 and n #- 2, we set f = L~J = 1 and m = L~J = 2. Since 30 = x > am, we replace n by n - m = 2 and change the list to 30,31. Since n = 2, x #- a1 and x = a2, we output "true" and stop. This search required four comparisons of x with an element in the list; a linear search would have used ten comparisons. (c) Since n = 11 #- 1 and n #- 2, the algorithm sets f = L 1i J = 3 and m = L 2; J = 7. Since 7 = a3 < x = 16 ~ a7 = 17, the algorithm replaces n by m - f = 4 and changes the list to 10, 12, 15, 17. Since 4 = n #- 1 and n #- 2, the algorithm sets f = L~J = 1 and m = L~ = 2. Since x = 16 > a2 = 12, the algorithm replaces n with n - m = 2 and changes the list to 15, 17. Since n = 2 and x #- a1 and x #- a2, the algorithm outputs "false" and stops. This search required five comparisons of x with other elements; a linear search would have re- quired eleven. 6. (a) [BB] To find the complement of the set A = {a1, a2, ... , ad withrespectto U =
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern