Question: Question 1 A ( 2 1 Marks ) ( a ) Suppose you have been tasked with designing an algorithm that finds and stores all

Question 1A (21 Marks)(a) Suppose you have been tasked with designing an algorithm that finds and stores all the prime numbers between two arbitrary numbers, N and M, where N < M. Required: (i) State the appropriate data structure you can use to store the prime numbers [1](ii) Justify your choice of data structure in (i) above [2](b) Consider the following words: Brenda, James, Aaron, Andrew, Mukai, Tatenda, Nyabiko, Ntsoaki, Axiel, Bobby Required: (i) Populate a BST using the words above. [5](ii)State with justification whether the tree you drew above is or is not a: a. Complete binary tree [1] b. strictly binary tree [1] c. perfect binary tree [1](iii) Show the order of traversal of the tree using each of the following methods: a. Preorder [2] b. In-order [2] c. Post-order [2] d. Depth-first search [2](iv) Calculate the maximum number of permissible nodes for this tree. [2]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!