Need help with sml languege I need to write a binarySearch function that recursively implements the binary search algorithm to search a sorted integer list for a specified integer and returns true if it is found, false otherwise. For exa
Need help with sml languege I need to write a binarySearch function that recursively implements the binary search
Here is my slice function:
fun count(index,hd::tl,start,stop) =
if index+1 >= stop then hd::nil
else if index >= start then hd::count(index+1,tl,start,stop)
else count(index+1,tl,start,stop);
fun slice(x::y, start, stop) =
count(0,x::y,start,stop);
And here is the dummy implementation of binary search :
fun binarySearch(sortedList, value) = false;
Trending now
This is a popular solution!
Step by step
Solved in 2 steps