Skip to content
Brahă Petru Bogdan edited this page Sep 12, 2024 · 7 revisions

I. To do:

  1. rbt
  2. maxheap
  3. minheap
  4. graph
  5. hash_table
  • equality method
  • yoda creater
  • more error checking for structures, optimisation methods, proof - robustness of testing

//------------------------------------------------

II. The initial ideas:

  1. source of my idea
  • my plan is different - i want to visualise a data structure after calling one of its methods. basically, it prints the output in an intuitive way, but not the process itself.
  1. the initial implementation of the heap data structure:
  • as_array: bool = false;

  • as_btree: bool = true;

  • there were 2 abstract classes: heap<T, as_array> and heap<T, as_btree>

  • maxheap and minheap were supposed to inherit a template specialized class

  • maxheap

    • as_array
    • as_btree
  • minheap

    • as_array
    • as_btree
  • there are 4 types of heaps and six classes

  • the plan was changed because of the bugs of VS's Intellisense - inheriting template specialized classes

  • there will be only two classes: maxheap (represented as an array) and minheap (represented as a binary tree)

  1. the initial implementation of the tree data structure:
  • i was avoiding creating extra data members for small classes like node.

  • preprocessing - wrong

  • the number of child nodes in template

    • this strategy was automatically implying that children had to have the same number of children as their parent (no more/less)
    • one solution was to define children as "node*" and not "node_tree<T, nr_children>": by some verifications i realised this method was not reliable
  • the number of child nodes non-existent, just in the constructor

  • the number of child nodes as a data member (x)

  • there is a lot more to talk about here !!!!!!!!!!!!!!!!

  • problem - node_avlt was inheriting node_bint pointers!

  • solution - each class has its children

  • each type of tree has its own type of node

  • static polymorphism

  • trivial_tree is the most general tree that can be build; it can be considered a playground for a developer. the arity is variable, it might be complete or not

    • binary tree only if no arity is written in the constructor

//------------------------------------------------

III. Minute questions:

  1. open-close principle is the hardest to achieve

  2. decision over the source code:

  • based on this i moved the implementation of classes from C++ files to their header
  1. discussion about what an abstract class should contain operator == and = should be implemented in the final class / instantiable classes

  2. prnt VS operator <<:

  • "prnt" - displays on standard output
  • "operator <<" - displays where the user tells it so
  1. friend functions
  • instantiable classes contains them
  • i will exclude (linking, intersection, ejection)
  1. maxheap does not inherit array - no matching methods

  2. template documentation

  • class template == template class number
  • template class == number
  1. default constructor problem

  2. protected - private members

  3. including files problem

  4. iterator documentation

  5. forget about the initialisation test. using the fixture it is not relevant

  6. for each - the order of execution of the operators: "!=", "*", "++".

  7. initial idea of testing: let the user test himself some values for an data structure

  8. standard for comparing functions: return true if the order of two elements have to be changed

  9. should the advanced data structures depend on developer-designed basic structures? - no

    • slow
    • to much functionality
    • solution: define smaller
  10. data_structure or data_structure as a parameter, where t == typedef const T& t; ?

    • data_structure won't work, no casts will be done
    • solution: use data_structure
  11. & const does not exist

  12. to or not to copy a node?

    • insert: user inserts node with existent children => mess with n
    • instance synergy:
    • operator =
  13. interfaces can not contain data members (nodes has their own implementation ideas)

  14. data structures should be

    • independent of the base type that it stores. there is just one part of the implementation that requires more analysis: ordering of the elements. the ordering problem is based on sorting and comparisons. the convoluted types should be tested when it comes to this problem, testing them with insertions is redundant;
    • aggregate
  15. getl now throws if it is empty

  • modifier and specific methods, instance synergy will return reference

  • typedefs are used only for constant, iterator, query, synergy

  • returning reference to allow obj.method.method

  • i can not allow modifying structures outside of themselves => return constant indexes/nodes

  • before iterator class defined inside of the class that uses it

Clone this wiki locally