Rules for abstract data type-tree, Data Structure & Algorithms

Assignment Help:

null(nil) = true                     // nil refer for empty tree

null(fork(e, T, T'))= false   //  e : element , T and T are two sub tree leaf(fork(e, nil, nil)) = true

leaf(fork(e, T, T')) = false if not null(T) or not null(T')

leaf(nil) = error

left(fork(e, T, T')) = T

left(nil) = error

right(fork(e, T, T')) = T' right(nil) = error

 

Contents (fork (e, T, T')) = e contents (nil) = error

Consider the definition of Tree (ADT). A way to think of a binary tree is that this is either empty (nil) or have an element and two sub trees that are themselves binary trees. Fork operation joins two sub trees along a parent node and generates another Binary tree. It might be noted that a tree containing a single leaf is described to be of height 1.

Definition: A tree is connected, acyclic graph

1913_Rules for Abstract data type-tree.png


Related Discussions:- Rules for abstract data type-tree

A binary tree of depth "d" is an almost complete binary tree, A binary tree...

A binary tree of depth "d" is an almost complete binary tree if  A) Every leaf in the tree is either at level "d" or at level "d-1"  B)  For any node "n" in the tree with a

Breadth-first search, Breadth-first search starts at a given vertex h, whic...

Breadth-first search starts at a given vertex h, which is at level 0. In the first stage, we go to all the vertices that are at the distance of one edge away. When we go there, we

Queue, algorithm for insertion in a queue using pointers

algorithm for insertion in a queue using pointers

Complexity of quick sort, Q. What do you mean by the best case complexity o...

Q. What do you mean by the best case complexity of quick sort and outline why it is so. How would its worst case behaviour arise?

Algorithmss, calculate gpa using an algorithm

calculate gpa using an algorithm

Enumerate about the carrier set members, Enumerate about the carrier set me...

Enumerate about the carrier set members Ruby is written in C, so carrier set members (which is, individual symbols) are implemented as fixed-size arrays of characters (which is

Variable length codes, Variable length codes (Niveau I) Code the following ...

Variable length codes (Niveau I) Code the following sequence of integers (2, 4, 2, 8, 3, 1, 4, 5, 13, 2) with • unary codes • ? codes • d codes • Rice codes (for a suitable l) and

Pseudocode algorithm to print the numbers from 1 to 10, 1. Write a pseudoco...

1. Write a pseudocode algorithm to print the numbers from 1 to 10, and then from 10 to 1, using exactly one loop. 2. The function contains() takes a food as an argument and tell

Multiple stack, implement multiple stack in single dimensionl array.write a...

implement multiple stack in single dimensionl array.write algorithms for various stack operation for them

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