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

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.

Posted Date: 3/28/2013 3:44:36 AM | Location : United States







Related Discussions:- Define a procedure called make-avl-tree, Assignment Help, Ask Question on Define a procedure called make-avl-tree, Get Answer, Expert's Help, Define a procedure called make-avl-tree Discussions

Write discussion on Define a procedure called make-avl-tree
Your posts are moderated
Related Questions
Q. An, array, A comprises of n unique integers from the range x to y(x and y inclusive where n=y-x). Which means, there is only one member that is not in A. Design an O(n) time alg

write a c++ program to find out the area of a curve y=f(x) between x=a and x=b

ALGORITHM (Insertion of element into a linked list) Step 1 Begin the program Step 2 if the list is empty or any new element comes before the start (head) element, then add t

Describe an algorithm to play the Game of Nim using all of the three tools (pseudocode, flowchart, hierarchy chart)

Write an algorithm for multiplication of two sparse matrices using Linked Lists.

Data records are stored in some particular sequence e.g., order of arrival value of key field etc. Records of sequential file cannot be randomly accessed i.e., to access the n th

Define Big Omega notation Big Omega notation (?) : The lower bound for the function 'f' is given by the big omega notation (?). Considering 'g' to be a function from the non-n

What are the properties of an algorithsm?

How to construct a data flow diagram for a college assignment and marking systemA

A binary tree is a tree data structures in which each node have at most two child nodes, generally distinguished as "right" and "left". Nodes with children are called parent nodes,