Question: Describe a recursive algorithm that takes a list L of distinct integers finds the sum of the primes in the list. Write your answer in

 Describe a recursive algorithm that takes a list L of distinct

Describe a recursive algorithm that takes a list L of distinct integers finds the sum of the primes in the list. Write your answer in pseudo-code or any well-known procedural language like Python, Java, C++, ..... You may assume that your language has a built in way to determine whether a number is prime or not, and has the following built in functions manipulate lists. i. "empty"? which returns TRUE if a given list is empty, FALSE otherwise ii) "first" which returns the first element of a given nonempty list. iii) "rest" which returns a list containing all but the first element of a given nonempty list. Note that if the has only element, "rest" will the empty list. procedure Sum_of-Primes (L: list of integers)

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!