I have a relatively simple question from the algorithms theory as to what is the difference between them? Is that in one case you count the number of nodes and in the other case, the number of edges on the shortest path between root and concrete node? Could anyone clarify my doubt as to which is which?
Feb 9, 2022 in Python 1,430 views

## 1 answer to this question.

To answer your question, you will have to be aware of the fact that the depth and height are properties of a node: The depth of a node is the number of edges from the node to the tree's root node and also the root node will have a depth of 0.

The given height of a node is the number of edges on the longest path from the node to a leaf. The height would be 0 for a leaf node. For a tree, the height would be the height of its root node and could also be the depth of its deepest node. When talking about the diameter which is also the width of the tree, is the number of nodes on the longest path between any two leaf nodes. The image of the tree below has a diameter of 6 nodes.

• 9,670 points

## What is the difference between list and tuple?

Lists are mutable(values can be changed) whereas ...READ MORE

+1 vote

## What is the difference between classes and labels in machine learning?

Classes and Labels both are almost same things ...READ MORE

## What is the difference between Python and IPython?

There are few differences between Python and ...READ MORE

## What is the difference between re.search and re.match?

The theoritical approach can be this way, re.match is ...READ MORE

## Competitive Programming Algorithm Sock Drawing Probability Question

Another way to look at the problem ...READ MORE

## Find the minimum strength someone must have in the beginning so that he can cross N cells (Interview question)

Problem Statement: Mustafa wants to cross a dungeon. ...READ MORE

## Why would anyone use set instead of unordered_set?

Unordered sets must compensate for their O(1) ...READ MORE

## Implement Tree(Datastructure) in Java

I wrote a small "TreeMap" class based ...READ MORE