Guest User

Untitled

a guest
Mar 21st, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. void dumpStack(listNode *top, int currentDigit, int currentTable) {
  2. while (isEmpty() == 0) {
  3. listNode *temp = pop();
  4. int digit = getDigit(temp, currentDigit);
  5. int hashIndex = digit;
  6. addTail(hashTable[currentTable][hashIndex], temp);
  7. cout << "Added " << temp->data << " to hashTable[" << currentTable << "][" << hashIndex << "]" << endl;
  8. cout << hashTable[currentTable][hashIndex]->head->next->data << endl;
  9. }
  10. cout << "DONE DUMPSTACK" << endl;
  11. printTable(hashTable[currentTable]);
  12. cout << hashTable[currentTable][9]->head->next->data << endl;
  13. }
  14.  
  15. void printTable(linkedListQueue **ht) {
  16. for (int i = 0; i < 10; i++) {
  17. linkedListQueue *temp = ht[i];
  18. if (isEmpty(temp) == 0) {
  19. cout << "Table [" << currentTable << "][" << i << "]:";
  20. while (temp->head->next != nullptr) {
  21. cout << " " << temp->head->next->data;
  22. if (temp->head->next->next != nullptr)
  23. cout << ",";
  24. temp->head->next = temp->head->next->next;
  25. }
  26. cout << endl;
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment