Optimal Resilient Sorting and Searching in the presence of Dynamic Memory Faults