Hi Guys I don’t quite understand the following tutorial question:
write a ADT sorted list, The insertion, deletion and retrieval operations must be implemented recursively. [Note: The recursive requirement could be achieved by implementing a recursive search function that is used within the insertion/deletion or retrieval methods.
How can you implement one method that does 3 things?
I know that the professor is asking to implement a search method, but inserting deleting retrieving requires different operations.
thanks
Your professor is saying that you can use the search method as part of the way you achieve insert or delete. Abstractly, you have three tasks:
The
find where x should appear in the sorted listpart of both the insert and delete methods could be achieved using your implementation of search.You professor isn’t expecting you to write one method that does all three things, but instead is giving you the hint that your search method can be used inside your insert and delete methods.