data structures and algorithms
data structures and algorithms
In collaboration with
MIDLANDS STATE UNIVERSITY
BMIS (BSc Management of Information Systems Hons)
ASSIGNMENT : 2
OVERALL
MARK
Comments:
QUESTION 1
Question 2
a. Extended Binary Tree: A binary tree with additional nodes to represent empty subtrees.
b. Complete Binary Tree: A binary tree where every level is fully filled, except possibly the
last level.
c. Full Binary Tree: A binary tree where every node has two children.
d. Skewed Binary Tree: A binary tree where every node has only one child.
e. Strictly Binary Tree: A binary tree where every node has two children, and all leaf nodes
are at the same level.
f. Expression Binary Tree: A binary tree representing an expression, where operators are
internal nodes and operands are leaf nodes.
g. Binary Search Tree: A binary tree where each node's value is greater than its left child and
less than its right child.
Fibonacci Search
Example:
1. Divide the list into two segments using Fibonacci numbers: 2-4-6-8 (Fibonacci number 5)
and 10-12-14-16-18 (Fibonacci number 8)
2. Compare the middle element of the first segment (6) with the target element (10). Since
10 is greater, we search in the second segment.
3. Divide the second segment into two smaller segments: 10-12 (Fibonacci number 3) and
14-16-18 (Fibonacci number 5)
4. Compare the middle element of the first segment (11) with the target element (10). Since
10 is less, we search in the left segment.
5. The target element 10 is found.
Question 3
Table comparing the time complexities of 6 sorting algorithms:
Question 4
The sorted lists using Quick sort, Merge sort, and Radix sort up to 5 passes:
a. Quick sort:
b. Merge sort:
c. Radix sort: