Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
Loading...
Searching...
No Matches
Public Member Functions
dsac::list::FavoritesListMTF< T > Class Template Reference

Maintains a list of elements ordered using move-to-front heuristic. More...

#include <favorites_list_mtf.h>

Inheritance diagram for dsac::list::FavoritesListMTF< T >:
Inheritance graph
Collaboration diagram for dsac::list::FavoritesListMTF< T >:
Collaboration graph

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
 

Detailed Description

template<typename T>
class dsac::list::FavoritesListMTF< T >

Maintains a list of elements ordered using move-to-front heuristic.

Member Function Documentation

◆ access()

template<typename T >
void dsac::list::FavoritesListMTF< T >::access ( elem)
inline

Accessess element (possibly new), increasing its access count.

Here is the call graph for this function:

◆ get_favorites()

template<typename T >
std::list< T > dsac::list::FavoritesListMTF< T >::get_favorites ( int  k) const
inline

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


The documentation for this class was generated from the following file: