Advertisement
Cinestra

Impartial PRoject 2

Feb 27th, 2023
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include "Set.h"
  2.  
  3. void Set::initializeEmptySet()
  4. {
  5. m_size = 0;
  6.  
  7. m_head = new Node;
  8. m_head->m_next = nullptr;
  9. m_head->m_prev = nullptr;
  10. }
  11.  
  12. Set::Set()
  13. {
  14. initializeEmptySet();
  15. }
  16.  
  17. Node* Set::findClosestLocation(const ItemType& value) const
  18. {
  19. // We will either find if the value exists in the set
  20. // Or we will find the closest value greater than the given value
  21.  
  22. // Go through each node looking for a match
  23.  
  24. Node* p = m_head;
  25.  
  26. while (p->m_value < value)
  27. {
  28. p = p->m_next;
  29. }
  30.  
  31. return p;
  32. }
  33.  
  34. bool Set::insert(const ItemType& value)
  35. {
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement