Define a procedure called make-avl-tree, Data Structure & Algorithms

Assignment Help:

This question deals with AVL trees. You must use mutable pairs/lists to implement this data structure:

(a) Define a procedure called make-avl-tree which makes an AVL tree with one node. Also create another constructor build-avl-tree that creates an AVL tree from a root, left subtree and right subtree. The constructors return an AVL tree object.

(b) Create procedures for accessing the root, left subtree and right subtree, and also mutators for changing the root, left subtree and right subtree of an avl argument.

(c) Write a procedure called (insert n t). This procedure has 2 arguments: n is the value being inserted, t is the AVL tree.

(d) Write a procedure called (lookup n t). This procedure has 2 arguments: n is the value being looked up, t is the AVL tree. The subtree with n as its root is returned (or '() if no such node is found).

(e) Write a procedure called (print-as-list t). This procedure prints the AVL tree passed in t as a regular list (not a mutable list).

(f) Write a procedure called (print-inorder t). This procedure prints the AVL tree passed in t in inorder traversal form.


Related Discussions:- Define a procedure called make-avl-tree

Illumination of wire frame, Illumination of wire frame The colour or sh...

Illumination of wire frame The colour or shade that a surface appears to the human eye depends primarily on three  factors : Colour and strength of incoming illumination

A bst is traversed in which order recursively, A  BST is traversed in the ...

A  BST is traversed in the following order recursively: Right, root, left e output sequence will be in In Descending order

Evaluation of arithmetic expressions, Stacks are often used in evaluation o...

Stacks are often used in evaluation of arithmetic expressions. An arithmetic expression contains operands & operators. Polish notations are evaluated through stacks. Conversions of

What is a height balanced tree, What is a height balanced tree? Height Ba...

What is a height balanced tree? Height Balanced Tree (AVL Tree) An AVL tree is a binary search tree in which the height of the left and right subtree of the root vary by at most

Finite automata, find the grammar of regular expression of (a/?)(a/b)?

find the grammar of regular expression of (a/?)(a/b)?

Compute the shortest paths to all network nodes, (i)  Consider a system usi...

(i)  Consider a system using flooding with hop counter. Suppose that the hop counter is originally set to the "diameter" (number of hops in the longest path without traversing any

Data structure, Ask question #Minimum 1Mark each of the following statement...

Ask question #Minimum 1Mark each of the following statements as valid or invalid. If a statement is invalid, explain why. a. current ¼ list; b. temp->link->link ¼ NULL; c. trail->l

Acyclic graph, Tree is a widely used data structure employed for representi...

Tree is a widely used data structure employed for representing several problems. We studied tree like a special case of acyclic graph. Though, rooted trees are most prominent of al

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd