Suppose that instead of selecting a node using information gain (IG) in a binary decision tree, we select a node randomly from nodes with IG>0 - entropy

a) Show that each leaf of the tree contains at least one training data .
b) If we have n training data, what is the maximum number of leaf in constructed decision
tree? Compare result with the state that we used IG for selecting node.

Related

difference between m way tree and m way search tree

I tried finding the difference between m way tree and the m way search tree. Most resources only tells about m way search tree and end up being on B tree or B+ trees.
My doubts are:-
Is it analogous to the binary tree and binary search tree?
I read somewhere that m way trees don't have any particular order and
every node has to be filled fully before moving to the new node.(complete
tree)
Is it analogous to the binary tree and binary search tree?
Yes
m way trees don't have any particular order
This is true
and every node has to be filled fully before moving to the new node.(complete tree)
Something like this describes a step in an algorithm, and has little to do with the data structure itself: nothing is "moving" in a data structure.
Definitions
In short: an m-way tree puts no conditions on the values stored in the nodes, while an m-way search tree does.
Reva Freedman, associate professor at Northern Illinois University has notes on Multiway Trees where four terms are defined in succession, each time indicating which additional requirements apply for the next term:
multi way tree,
m-way tree
m-way search tree
B-tree of order m
Multiway Trees
A multiway tree is a tree that can have more than two children. A
multiway tree of order m (or an m-way tree) is one in which a tree can
have m children.
As with the other trees that have been studied, the nodes in an m-way
tree will be made up of key fields, in this case m-1 key fields, and
pointers to children.
To make the processing of m-way trees easier, some type of order will
be imposed on the keys within each node, resulting in a multiway
search tree of order m ( or an m-way search tree). By definition an
m-way search tree is a m-way tree in which:
Each node has m children and m-1 key fields
The keys in each node are in ascending order.
The keys in the first i children are smaller than the ith key
The keys in the last m-i children are larger than the ith key
M-way search trees give the same advantages to m-way trees that binary
search trees gave to binary trees - they provide fast information
retrieval and update. However, they also have the same problems that
binary search trees had - they can become unbalanced, which means that
the construction of the tree becomes of vital importance.
B-Trees
An extension of a multiway search tree of order m is a B-tree of
order m. This type of tree will be used when the data to be
accessed/stored is located on secondary storage devices because they
allow for large amounts of data to be stored in a node.
A B-tree of order m is a multiway search tree in which:
The root has at least two subtrees unless it is the only node in the tree.
Each nonroot and each nonleaf node have at most m nonempty children and at least m/2 nonempty children.
The number of keys in each nonroot and each nonleaf node is one less than the number of its nonempty children.
All leaves are on the same level.

complexity of -Count the number of identical trees in a given Tree

Count the number of identical trees in a given Tree, where a tree is said to be identical if the values of its node is same as its the value of all its children nodes, We can make the assumption that the tree is a binary tree
For each node I need to check if its is an identical tree
hence for every node I traverse the tree below it, i e the node and its tree to see if they are identical .
since I do a post order traversal to count tree,
Im not sure how to calculate the time complexity

Number of nodes in a B-Tree

How many nodes does a resulting B-Tree(min degree 2) have if I insert numbers from 1 to n in order?
I tried inserting nodes from 1 to 20 there was a series for the number of nodes coming but i could not generalize it.
Can anyone please help me derive the formula for this.
It will depend on the order of the B-Tree. The order of a BTree is the maximum number of children nodes a non-leaf node may hold (which is one more than the minimum number of keys such a node could hold).
According to Knuth's definition, a B-tree of order m is a tree which satisfies the following properties:
Every node has at most m children.
Every non-leaf node (except root) has at least ⌈m⁄2⌉ children.
The root has at least two children if it is not a leaf node.
A non-leaf node with k children contains k−1 keys.
All leaves appear in the same level, and internal vertices carry no information.
So in your case when you are inserting 20 keys if the order is m then based on the conditions mentioned above you can derive a set of inequalities that describes the possible value of m. But there is no equality formula that says the number of internal nodes in a B-Tree.

Minimum and Maximum number of nodes in a 2-3 Tree

I'm trying to find out what are the minimum and maximum number of nodes in a 2-3 Tree with n leaves.
I have tried blocking it with inf\sup but I couldnt go further then that the number of nodes in a 2-3 Tree is bigger then the number of nodes in a full-AVL tree.
Thanks in advance
Operating under the definition of a 2-3 tree at wikipedia:
In computer science, a 2–3 tree is a type of data structure, a tree where every node with children (internal node) has either two children (2-node) and one data element or three children (3-nodes) and two data elements. Nodes on the outside of the tree (leaf nodes) have no children and one or two data elements.
It appears to me that the maximum number of nodes in a tree will be when each internal node has 3 children. In order to find the maximum number of nodes in that tree, we must first find the height of the tree.
If there are n leaves in this 3 tree, then the height of the tree is height = log3(n) (log base 3 of n) and so the max number of items would be 3^height.
The smallest tree is one which has the smallest number of elements, which would be a tree with a single node.

Traversing an overflowing binary tree

Given a very large binary tree (i.e. with millions of nodes), how to handle determining the number of nodes in the tree? In other words, given the root node of this tree to a function, the function should return the number of nodes in the tree.
Or let's say how do you check if the Binary Tree is BST if the tree has very large number of nodes?
Walk all nodes and check whatever conditions/metric you need. There is nothing else you can do without additional knowledge about the tree.
You can enforce particular conditions at the time when tree is created (i.e. must be balanced/sorted/whatever) or collect information about tree at creation time (i.e. store and constantly update number of children).
To check if it's a VALID bst you have to visit every node depth first and ensure each node is smaller than the previous.
If you want to evaluate how long that will take for a balanced BST you could get a quick approximation of the size by counting the length of one leg, I believe the total size will be between 2^(n-1) and 2^n-1 inclusive

Resources