Question: x is an integer. All nodes in a BST T are primes. Design an algorithm to check xs primality. If x is a prime and
x is an integer. All nodes in a BST T are primes.
Design an algorithm to check xs primality.
If x is a prime and its key exists in the BTS already, return 1; if x is a prime but its key does not exist in the BTS , insert it into the BST; if x is not a prime, return 0.
(pseudo code required with proper input and outputs ) and calculate time complexity
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
