Can we use tail recursion elimination to optimize the


Tail Recursion and Exception Handling

Can we use tail recursion elimination to optimize the following program?

exception OddNum;

let fun f(0,count) = count

| f(1, count) = raise OddNum

| f(x, count) = f(x-2, count+1) handle OddNum => -1

Why or why not? Explain. This is a tricky situation - try to explain succinctly what the issues are and how they might be resolved.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Can we use tail recursion elimination to optimize the
Reference No:- TGS01269941

Expected delivery within 24 Hours