ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Anagrams.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*---------------------------- File Anagrams.h -----------------------------*/
3/*--------------------------------------------------------------------------*/
36/*--------------------------------------------------------------------------*/
37/*----------------------------- DEFINITIONS --------------------------------*/
38/*--------------------------------------------------------------------------*/
39
40#ifndef __ADS_Anagrams
41 #define __ADS_Anagrams
42/* self-identification: #endif constant */
43
44/*--------------------------------------------------------------------------*/
45/*------------------------------ INCLUDES ----------------------------------*/
46/*--------------------------------------------------------------------------*/
47
48#include "ADS/Contract.h"
49
50#include <algorithm>
51#include <cstddef>
52#include <functional>
53#include <string>
54#include <unordered_map>
55#include <utility>
56#include <vector>
57
58/*--------------------------------------------------------------------------*/
59/*--------------------------- NAMESPACE ------------------------------------*/
60/*--------------------------------------------------------------------------*/
61
62namespace ADS
63{
64
86template< class S , class Hash = std::hash< S > >
87[[nodiscard]] std::vector< std::vector< S > >
88anagramGroups( const std::vector< S > & words );
89
92[[nodiscard]] inline std::vector< std::vector< std::string > >
93anagramGroups( const std::vector< std::string > & words );
94
95/*--------------------------------------------------------------------------*/
96
97} // end( namespace ADS )
98
99/*--------------------------------------------------------------------------*/
100/*-------------------------- IMPLEMENTATION --------------------------------*/
101/*--------------------------------------------------------------------------*/
102
103#include "ADS/string/impl/Anagrams.tpp"
104
105/*--------------------------------------------------------------------------*/
106
107#endif /* Anagrams.h included */
108
109/*--------------------------------------------------------------------------*/
110/*-------------------------- End File Anagrams.h ---------------------------*/
111/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
std::vector< std::vector< S > > anagramGroups(const std::vector< S > &words)
the classes of anagrams among the words, in the order of their first word, each in the order of the w...
Definition ADT.h:96