|
Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
Maintains a list of elements ordered using move-to-front heuristic. More...
#include <favorites_list_mtf.h>


Public Member Functions | |
| void | access (T elem) |
| Accessess element (possibly new), increasing its access count. | |
| std::list< T > | get_favorites (int k) const |
| Returns an ordered list of the k most frequently accessed elements. | |
Public Member Functions inherited from dsac::list::FavoritesList< T > | |
| int | size () const |
| Returns number of distinct elements in the list. | |
| bool | empty () const |
| Returns true if the list is non-empty. | |
| void | access (T elem) |
| Accessess element (possibly new), increasing its access count. | |
| void | remove (T elem) |
| Removes the given element from the list of favorites (if found) | |
| std::list< T > | get_favorites (int k) const |
| Returns an ordered list of the k most frequently accessed elements. | |
Additional Inherited Members | |
Protected Types inherited from dsac::list::FavoritesList< T > | |
| typedef std::list< std::pair< int, T > >::iterator | iterator |
| typedef std::list< std::pair< int, T > >::const_iterator | const_iterator |
Protected Member Functions inherited from dsac::list::FavoritesList< T > | |
| iterator | find (T elem) |
Protected Attributes inherited from dsac::list::FavoritesList< T > | |
| std::list< std::pair< int, T > > | contents |
Maintains a list of elements ordered using move-to-front heuristic.
|
inline |
Accessess element (possibly new), increasing its access count.

|
inline |
Returns an ordered list of the k most frequently accessed elements.