소스 검색

Fixed delete (in theory). forgot to sub1 from curmag when going to a new curnode compression still seems off though...

tarfeef101 7 년 전
부모
커밋
b88d77b2bf
2개의 변경된 파일2개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 6
      source3.h
  2. BIN
      testfile3

+ 2 - 6
source3.h

@@ -402,7 +402,6 @@ class Triehard // compressed decimal trie
 					}
 					else
 					{
-						cout << "case 1" << endl;
 						return; // node does not exist, will make this an error later
 					}
 				}
@@ -410,7 +409,6 @@ class Triehard // compressed decimal trie
 				{
 					if (curmag)
 					{
-						cout << "case 2" << endl;
 						return; // should be error later, but the val isn't inserted, since there is mag left in the wrong number
 					}
 					else if (curnode->getX((*val)[i])) // if we have the correct child
@@ -419,18 +417,16 @@ class Triehard // compressed decimal trie
 						pos = (*val)[i];
 						prevnode = curnode;
 						curnode = curnode->getX(pos);
-						curmag = curnode->getMag();
+						curmag = curnode->getMag() - 1;
 					}
 					else
 					{
-						cout << "case 3 " << curnode->getX((*val)[i]) << endl;
 						return; // we don't have the right child, so return (to be error)
 					}
 				}
 			}
 			
-			cout << "we here" << endl;
-			
+
 			// at this point, we have curnode being the "end" of our value
 			if (!(prevnode)) // if we are deleting one of the base trees
 			{

BIN
testfile3