COIS 2020H Assignment 5
AVL( 1 mark: note you are getting 2 from the lab on AVL trees)
AVL: modified to support generics, with testing
Splay (2 marks total)
Splay: modified to support generics, with testing
2-3-4 (3 marks)
2-3-4: modified to support generics, with testing
Bonus: 1 mark
BST traversal that actually shows levels on different levels, and correctly centres
Theory (2 marks each)
Showing how red-black trees are equivalent to 2-3-4 trees (theory question, not programming)
Using a B Tree + Linked List for a filesystem
Programming Part (6 marks)
You are going to test and implement your own AVL, Splay, and 2-3-4 trees (note that AVL is mostly in the lab). Your implementations need to support generics, (using icomparable) so you need to test with sortable objects or simple version of those you make yourself, but I would test these with integers first.
- AVL Tree.
Red Black Tree Normally I ask for Red-Black Trees in this assignment, but I don’ think there’s time in summer 2021
- Splay Tree.
- A 2-3-4 Tree. (These are also called 2-4 Trees or 2,4 trees)
It’s up to you to write test cases to show that the trees are working properly for small numbers of inputs (~ 20 elements are fine).
• Traverse (Breadth first + one of the depth first traversals, I suggest in-order). For AVL and Splay these traversals are the same (exactly the same) as the BST ones, since they are both BSTs.
• Find (note that in the splay tree “Find” puts the found node at the root)
• FindAndDelete (this should search for a specific entry, if it exists delete it and then properly fix the tree)
You will likely need to make several methods which make this work (rotations for example), show tests for each of those as well.
- Challenge problem: Make a traversal for the BST variants that prints the trees in something like a natural formatting of how you would write them by hand (with the root in the middle of the tree at the top). Assume the data values are 1 or 2 digit integers. There’s some badly working code to get you started in the AVL lab as a ‘printLevelOrder’ which also uses “printGivenLevel’, but you need to make this work for a tree that could potentially have 32 leaf nodes. This is a variant of a level order traversal. Ideally what your program should do is figure out how wide the tree is at the bottom and set the spacing for that appropriately at the beginning, so the tree doesn’t just start in the middle of the screen, but is left justified with the leftmost element on the left edge of the screen being the leftmost node of the tree. Discuss the run time efficiency of this sort of traversal.
Oh and for more fun – you can widen the window that Visual studio generates by default so you’re not actually stuck to the size it creates things at.
Theory Part (2 marks each)
- Theory Question (Note: I realise there are answers to this on the web). Show how Red-Black Tree insertions are equivalent to 2-3-4 tree insertions.
- How would you use a B tree combined with a linked list to make a filesystem? (this is essentially FAT from MS-DOS)
With Love, Revenge Retribution isn't an actual existence however a subject principally including show and different books. Subsequently, the most ideal approach to investigate retribution is to once in a while check the story close by. As a dramatization, the awfulness of retribution is principally character - driven, the intention of the character is straightforward: retaliation - under the name of adoration. Bel-imperia is looking for retribution on her darling, Andre. The thought process speaks to a cozy connection between certainty of misfortune and vengeance and love. The subject of affection and retribution in Shakespeare's "Hamlet's Love" is one of Hamlet's most remarkable topics, however one preferred position - the intensity of vengeance advances Hamlet's adoration. I will vindicate the homicide of his dad. While Hamlet was befuddled, he discovered that his mom got hitched to his uncle not long after his dad kicked the bucket. Despite the fact that he didn't question the sudden passing of his dad soon he was as yet stunned. As Kenneth Muir stated, "He (Hamlet) was stunned by Gertrude. Retribution is want for vengeance and fairness. At the point when the individual you love gets injured, that nature will vindicate. In any case, inaccurate conduct of these counter can prompt genuine results. In the awfulness of William Shakespeare 'Hamlet', Fortinbras, Hamlet, Lertes demonstrated that their craving for retribution unavoidably prompts misfortune. By losing somebody you love, Hamlet 's job has made it conceivable to make a move. The youthful Fortinbras established a military to restore the land lost by his dad to Hamlet and the lord. Both Hamlet and Leltus added to the vengeance of the showy topic. Both of these characters love their dad definitely. That is the reason they are delivering retribution. Be that as it may, their adoration is misshaped, and now they want to fight back against the passing of their dads. Be that as it may, they treat it in different ways. Hamlet realized who murdered his dad, yet he didn't make a move right away. Rarthes was somewhat indistinct, which was the reason for his dad's passing, yet he quickly acted to vindicate him. "For heck, unwaveringness! Promise, Retribution is the topic of this film. We saw this when Sook-hee promised to vindicate her dad's passing, her better half, and her retribution once more. Retribution is the explanation behind acquainting her with the universe of Assassin and helping her accomplish her objectives. It has become an endless loop of her. In some cases I see it influences her, however this is by all accounts the best thing knowing how Sook-hee does. She is carrying on a "typical" life and decided to render retribution while strolling. Despite the fact that it appears to be a toy of her destiny, Sook-hee settles on his own choice>GET ANSWER