Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
fp2024:hw2 [2024/04/17 18:15]
pdmatei created
fp2024:hw2 [2024/04/17 18:32] (current)
pdmatei
Line 23: Line 23:
  
 Notice that there are multiple possible BS trees to represent one text, however you do not need to take this into account in this homework. Notice that there are multiple possible BS trees to represent one text, however you do not need to take this into account in this homework.
 +
 +==== Keeping the tree balanced ====
 +Adding new nodes to a BST might require a change in the current tree structure, in order to (i) preserve the binary-search property stated above, as well as (ii) minimal height. Fortunately,​ a ''​rebalance''​ method that preserves both (i) and (ii) has already been implemented,​ and in our limited set of tests, you will not need it in the code you will write.
 +
 +==== Constructing the tree ====
 +
 Our tree is called ''​WTree'',​ and is implemented by the following case classes: Our tree is called ''​WTree'',​ and is implemented by the following case classes:
 <code scala> <code scala>
Line 122: Line 128:
 ===== Submission rules ===== ===== Submission rules =====
  
-  * Please follow the [[fp2023:​submission-guidelines| Submission guidelines]] which are the same for all homework. +  * Please follow the [[fp2024:​submission-guidelines| Submission guidelines]] which are the same for all homework. 
-  * To solve your homework, download the {{:fp2023:​h2-word-tree.zip|Project template}}, import it in IntellIJ, and you are all set. Do not rename the project manually, as this may cause problems with IntellIJ.+  * To solve your homework, download the {{:fp2024:​h2-word-tree.zip|Project template}}, import it in IntellIJ, and you are all set. Do not rename the project manually, as this may cause problems with IntellIJ.