I have tried to implement buckets after going through multiple threads on the forum and it turned out well for most of the test cases but the approach in inefficient for cases where lines are edited and replaced or similar operation is performed to change the content of bucket.Please suggest some tips to optimize the bucket implementation for the same.
You need to understand the concept of
Bucket in order to solve it successfully.
Buckets are meant to skip the n traversal steps with linked list, where you face issues updating data towards end.
At the same time, its meant for splitting the data into multiple small managable chunks that can shrink/expand at its own.
Look at the HashMap impleemntation to understand how does Buckets work, then probably you will get fair idea about what to do.
For your case, all I would say is your performance using Bucket approach should be same as the one with LinkedList. If you are able to do that, then your test case should pass.
Also, It is completely your choice whether to implement bucket or not. But your code must be efficient to pass our test case.
NOTE- We recommend bucket
Closing this topic as there is no response since last 12 hours. Please feel free to create a new topic and post this question as a reference link in the description of the new topic.