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

Explain all-pair shortest-paths problem, Explain All-pair shortest-paths pr...

Explain All-pair shortest-paths problem Given a weighted linked graph (undirected or directed), the all pairs shortest paths problem asks to find the distances (the lengths of

State the ruby programming language, The Ruby Programming Language Alth...

The Ruby Programming Language Although data structures and algorithms we study aren't tied to any program or programming language, we need to write particular programs in speci

Determine the complexity, 1)    The set of the algorithms whose order is O ...

1)    The set of the algorithms whose order is O (1) would run in the identical time.  True/False 2)    Determine the complexity of the following program into big O notation:

Homework, Write a recursive function the computes the number of digits in a...

Write a recursive function the computes the number of digits in a positive integer n. For example if n = 6598, the function should return 4. Find a variant expression and a thresho

Mapping constain, one to many one to one many to many many to one

one to many one to one many to many many to one

Binary tree construction, Construct a B+ tree for the following keys, start...

Construct a B+ tree for the following keys, starting with an empty tree.  Each node in the tree can hold a maximum of 2 entries (i.e., order d = 1). Start with an empty root nod

Find error for curious number, #include #include int sumFact(int numb);...

#include #include int sumFact(int numb); int calculateFactorial(int digit); main() { int numb, sumfact; do{ printf ("Enter a number 1 to 9999\n"); scanf("%

Find the adjacency matrix, Consider the digraph G with three vertices P1,P2...

Consider the digraph G with three vertices P1,P2 and P3 and four directed edges, one each from P1 to P2, P1 to P3, P2 to P3 and P3 to P1. a. Sketch the digraph. b. Find the a

What is a binary search tree (bst), What is a Binary Search Tree (BST)? ...

What is a Binary Search Tree (BST)? A binary search tree B is a binary tree every node of which satisfies the three conditions: 1.  The value of the left-subtree of 'x' is le

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