Stuck on the module @gouravsardana
I have aplied two approaches in modul 8 till now,

  1. every bucket contains a hashmap where hashmap[0]=line(0-50),hasmap=line(51-100) and every bucket act as node of linked list
  2. bucket is a hashmap only and every hasmap contains list(page).

but there is a common problem in both, i don’t understand how to code the updatelines and searchreplace methods, because updatelines can have multiple lines removed in the member variables of the class and this change should be at the address of the member variable…
in class versionimpl
private string nmae
private list list
so every change should be in list right? but in updatelines method when i iterate the list of bucket and then the list of page in it, the code is getting real messy.?
can someone help me walk through the logic a little, i am sure i am missing something crucial here?


In the todos it’ clearly mention for update lines -

  1. startingLineNo - starting line number of last time it received page from backend
  2. numberOfLines - number of lines received from backend last time.


  1. Remove the line numbers in the range(starting line no, ending line no)
  2. Inserting the lines in new content starting position starting line no

Use sublist to collect the line for a given range for start to end then clear the sublist using sublist.clear() and then add rest of the line to the list :slight_smile:

sir, but i am using a bucket as hashmap where key is 0 for list(1-100) and 1 for list(101-200) and so on,and every bucket is connected as linked list.
so what i don’t get is accessing the exact line number and replacing them is making my code too messy and I don’t think its supposed to be like this.
Can you have a look at my code, I think I am going wrong totally.

also for my previous implementation I referred this post which I created

@anmol1point0 I am not following the thread, but I can tell you one thing, I have suggested you guys to refer hashmap implementation , and not use hashmap for storing data

You have to analyse HashMap implementation to understand how effectively they have used Lists for BucketsUsing Hashmap may lead to unexpected results

sir, i am implementing like hashmap implementatin,
and buckets as linkedlist(pages)
but I am getting timeout exception in very basic cases.

Hey that means your solution is not optimised , can you check your logic again ?

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.