# B in a digraph in which every vertex has exactly one

This preview shows pages 1–3. Sign up to view the full content.

(b) In a digraph in which every vertex has exactly one in-edge and exactly one out-edge the number of edges equals the number of vertices, true or false? (c) A binary search tree that has the red-black tree balance property is an AVL tree, true or false? (d) A min-heap contains the keys 1 , 2 , . . . , 127. The height of the heap is 6, true or false? (e) In a simple graph with n vertices the number of simple paths of length 2 is O ( n 3 ), true or false? 3. (15 points) Prove that if f ( n ) is O ( n ) and g ( n ) is Ω( n ) then f ( n ) is O ( g ( n )). You cannot use any of the theorems stated in the lecture notes, the textbook, or the lab notes. Your proof should rely only on the definition of Big-Oh. 4. (20 pts) Consider the following graph G with vertices 1 , 2 , 3 , 4 , 5 , 6 and edges 1-2, 1-3, 2-3, 2-4, 2-5, 3-5, 3-6, 4-5, 5-6 (a) Suppose we run the breadth-first search algorithm on G , starting at node 1 and such that the algorithm explores the edges incident to a node in the numerical order of the labels of the node at the other end. What cross edges does the algorithm find? (b) Draw the spanning tree of discovery edges produced by the algorithm stated in (a). (c) For the same graph G assume that each edge has a weight obtained by adding the numbers of the two vertices at its ends. For example, 1-2 has weight 3 and 3-5 has weight 8. Give a minimal spanning tree for G .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
5. (15 pts) Consider sequences of queue operations, each operation being an enqueue or a dequeue. We
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