Contains the source code from the course work throughout my undergraduate Computer Engineering degree at Brigham Young University. There is a mixture of Go, Python, C, C++, Java, VHDL, Verilog, Matlab, Bash, Assembly, etc..
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TwoThreeTreeInterface.h 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //YOU MAY NOT MODIFY THIS DOCUMENT
  2. #pragma once
  3. #include <string>
  4. using namespace std;
  5. class TwoThreeTreeInterface {
  6. public:
  7. TwoThreeTreeInterface() {}
  8. virtual ~TwoThreeTreeInterface() {}
  9. //This class may use a node of your own creation.
  10. /*
  11. * Attempts to add the given word to the tree
  12. *
  13. * Addition should be consistent with the instructions found in the exam instructions.
  14. */
  15. virtual void add(string word) = 0;
  16. /*
  17. * Attempts to add the given string of words to the tree
  18. *
  19. * A string of words consists of alphabetical characters, no punctuation marks,
  20. * and white space as the delimiter separating words. The string should be parsed and
  21. * each word should be added to the tree.
  22. */
  23. virtual void addPhrase(string words) = 0;
  24. /*
  25. * Attempts to remove the given word from the tree
  26. *
  27. * Removal should be consistent with the instructions found in the exam instructions.
  28. */
  29. virtual void remove(string word) = 0;
  30. /*
  31. * The tree should print in the following format:
  32. *
  33. * Root (value)
  34. * Left subtree root (value)
  35. * Left left subtree root (value)
  36. * Left middle subtree root (value)
  37. * Left right subtree root (value)
  38. * Middle subtree root (value)
  39. * Middle left subtree root (value)
  40. * Middle middle subtree root (value)
  41. * Middle right subtree root (value)
  42. *
  43. * Right subtree root (value)
  44. * Right left subtree root (value)
  45. * Right middle subtree root (value)
  46. * Right right subtree root (value)
  47. *
  48. */
  49. virtual string printTree() = 0;
  50. };