- Give the definition of an algorithm?

ANSWER TO QUESTION 1

- What are the three basic sorting algorithms?

ANSWER TO QUESTION 2

- What is the degree of vertex b in a graph?

ANSWER TO QUESTION 3

- What are the three common ways to represent a graph?

ANSWER TO QUESTION 4

1. Array A has the following initial content: {5,3,7,2,8,6}

You have to sort the elements into ASCENDING ORDER using the SELECTION SORT algorithm.

The sorting takes five phases. Show the content of the array at the end of each phase.

INITIAL {5, 3, 7, 2, 8, 6}

2. Use the binary search tree shown in the following figure to answer A and B:

A. List the nodes in this binary tree using the PREORDER traversal algorithm.

ANSWER TO 2. A

B. Node 30 is deleted from the tree, and node 75 is inserted into the tree. Redraw the binary search tree to show these changes.

ANSWER TO 2. B

3. Create the adjacent matrix of the graph shown in Figure 2 using 0s and 1s as its
elements. An edge between two vertices is indicated by a 1; the absence of an edge is a 0.

ANSWER TO 3

4. List the vertices visited in the graph as shown in Figure 3 in DEPTH-FIRST SEARCH order.

ANSWER TO 4

5. Figure is a 2-3-4 tree. Redraw the tree after inserting keys 25 and 75 into the tree.

(A SPLIT OF NODE IS NECESSARY DURING THE INSERTION.)

ANSWER TO 5