Question 1:
Module: CSE102 Assignment 1
Assessment
The tasks contribute 10% to the overall assessment of CSE102
Submission
Please complete the assessment tasks using Microsoft Word and submit via ICE. You are also asked to print out a copy of your answers and submit it in the class or my office by 10-April- 2017, Monday.
Deadline
10-April- 2017, Monday 17:30.
________________________________________________________________________
Question 1
Consider the following graph G.
d
b
c
a
f
e
3. Starting at the vertex a and resolving ties by the vertex alphabetical order traverse the graph by breadth-first-search (BFS) and construct the corresponding BFS tree. (5 marks)
4. Starting at the vertex a and resolving ties by the vertex alphabetical order traverse the graph by depth-first-search (DFS) and construct the corresponding DFS tree. (5 marks)
Question 2
Given the Bubble sort algorithm as below:
ALGORITHM BubbleSort(A[0..n − 1])
//Sorts a given array by bubble sort
//Input: An array A[0..n − 1] of orderable elements
//Output: Array A[0..n − 1] sorted in ascending order
for i=0 to n − 2 do
for j = n-1 downto i+1 do
if A[j ]