VladimirMee
BAN USERFixed: KMP gives a O(n + m) Solution
- VladimirMee October 27, 2010ок, your examples made it all clear to me, now i get it) appreciate your help, thanks)
- VladimirMee October 27, 2010Still dont get it(( For example, tree described above with only left childs in the left subtree and right childs in the right one and depth = 8 would be very wide and its width won`t be be 2^8 = 256? What is the formala to calculate width for each tree?
For example, the height is the longest path from root to leaves, but what about width? How it`s gonna be found?
vinaysachdeva23, please, can you give the source (book or prooflink or article) of definition of width you gave? I couldn`t find
- VladimirMee October 26, 2010No, width hasn`t been found yet and nobody can tell the exact definition of a width of a tree, neither do I, but I`d like to get to know.
- VladimirMee October 26, 2010
class print
- VladimirMee October 28, 2010{
public:
void operator()(pair<string, int> word)
{
if(word.second > 1)
cout << "word: " << word.first << " : " << word.second << "\n";
}
};
void main()
{
string s = "test str this is test str";
map<string, int> dic;
stringstream sstr(s);
while(sstr.good())
{
string str("");
sstr >> str;
dic[str]++;
}
for_each(dic.begin(), dic.end(), print());
}