using list with the move-to-front heuristic the previous implementation of favorites list performs the access(emethod in time proportional to the index of in the favorites list that isif is the kth most popular element in the favorites listthen accessing it takes (ktime in many real-life access sequences ( web pages visited by user)once an element is accessed it is more likely to be accessed again in the near future such scenarios are said to possess locality of reference heuristicor rule of thumbthat attempts to take advantage of the locality of reference that is present in an access sequence is the move-to-front heuristic to apply this heuristiceach time we access an element we move it all the way to the front of the list our hopeof courseis that this element will be accessed again in the near future considerfor examplea scenario in which we have elements and the following series of accesseselement is accessed times element is accessed times **element is accessed times if we store the elements sorted by their access countsinserting each element the first time it is accessedthen each access to element runs in ( time each access to element runs in ( time **each access to element runs in (ntime thusthe total time for performing the series of accesses is proportional to ( nn ( which is ( on the other handif we use the move-to-front heuristicinserting each element the first time it is accessedthen each subsequent access to element takes ( time each subsequent access to element takes ( time **each subsequent access to element runs in ( time so the running time for performing all the accesses in this case is ( thusthe move-to-front implementation has faster access times for this scenario stillthe move-to-front approach is just heuristicfor there are access sequences where using the move-to-front approach is slower than simply keeping the favorites list ordered by access counts