Q1. 
>>First sort both the strings using counting sort perhaps. 
>>Then starting from the first character, search for it in the second string 
using binary search. 
>>The succeeding character of A will be searched from the index in B at 
which last character of A was found

Worst case: When both the strings are alike : O(log(m) + log(m-1) + log(m-2) 
...log(1)) = O(m*log(m))

But Average case will be quite efficient

Abhishek Khattri,
Computer Engineering,
Netaji Subhas Institute of Technology

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/vo0EQrVjxBUJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to