We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This was also my approach, although I kept a record of the index of the last found word in magazine and used it as a starting point for the inner loop, i.e., for(int j=lastFoundIndex...)
This speeds up the search as the second loop won't have to start from the beginning of the magazine array. However, it does require the arrays to be sorted first.
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →
This was also my approach, although I kept a record of the index of the last found word in magazine and used it as a starting point for the inner loop, i.e., for(int j=lastFoundIndex...)
This speeds up the search as the second loop won't have to start from the beginning of the magazine array. However, it does require the arrays to be sorted first.