Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Trie::CountPart(){
- int counter = 0;
- for(int j = 0; j < TrieMaxElem; j++){
- if(j == 0){
- counter = counter + CountPart(root -> GetPtr(j), 1, 0, 0, 0, 0);
- }else if(j == 4){
- counter = counter + CountPart(root -> GetPtr(j), 0, 1, 0, 0, 0);
- }else if(j == 8){
- counter = counter + CountPart(root -> GetPtr(j), 0, 0, 1, 0, 0);
- }else if(j == 14){
- counter = counter + CountPart(root -> GetPtr(j), 0, 0, 0, 1, 0);
- }else if(j == 20){
- counter = counter + CountPart(root -> GetPtr(j), 0, 0, 0, 0, 1);
- }else{
- counter = counter + CountPart(root -> GetPtr(j), 0, 0, 0, 0, 0);
- }
- }
- return counter;
- }
- int Trie::CountPart(TrieNode* p, int a, int e, int i, int o, int u){
- int counter = 0;
- if(p == 0)
- return 0;
- if(p -> GetPtr(0) != 0)
- a++;
- if(p -> GetPtr(4) != 0)
- e++;
- if(p -> GetPtr(8) != 0)
- i++;
- if(p -> GetPtr(14) != 0)
- o++;
- if(p -> GetPtr(20) != 0)
- u++;
- for(int j = 0; j < TrieMaxElem; j++){
- counter = counter + CountPart(p -> GetPtr(j), a, e, i, o, u);
- }
- if((p -> GetStrEnds()) && ((a+e+i+o+u) == 3))
- if(a == 0 || a == 1)
- if(e == 0 || e == 1)
- if (i == 0 || i == 1)
- if(o == 0 || o == 1)
- if(u == 0 || u == 1)
- counter++;
- return counter;
- }
Add Comment
Please, Sign In to add comment