You are not logged in. Please login at www.codechef.com to post your questions!

×

What is an ordered tree?

The Wikipedia link provided in the problem is quite difficult to understand from.

https://www.codechef.com/JULY17/problems/EXPTREE

Can someone please explain to me in a simple language what ordered tree exactly is?

asked 09 Jul '17, 02:12

abdullah768's gravatar image

5★abdullah768
2.4k420
accept rate: 17%


You can find better explanation here and why it is relevant to the question -> http://cs.lmu.edu/~ray/notes/orderedtrees/

link

answered 11 Jul '17, 13:03

vis_24_hal's gravatar image

3★vis_24_hal
123
accept rate: 20%

Thanks, exactly what I was looking for.

(11 Jul '17, 21:45) abdullah7685★

An ordered tree contains nodes (elements) which can be ordered according to a specific criteria. Often it is a binary tree, i.e. nodes have at most two children (conveniently called the left and right child). The tree is ordered when at every node, all elements in its left child tree are smaller than elements in its right subtree (and if the non-leaf node itself contains an element, it is greater than the elements in the left subtree and less than the elements in the right subtree).

(provided all elements in the tree are unique - if not, then some "greater than" / "less than" above becomes "greater or equal to" / "less or equal to".)

Simple example:

    4
  /   \
 2     6
/ \   / \
1 3   5 7
link

answered 09 Jul '17, 02:21

sudip_95's gravatar image

4★sudip_95
7556
accept rate: 10%

1

How is that relevent to the problem where values are not even there and only the arrangement of nodes are to be considered?

(09 Jul '17, 15:08) abdullah7685★
5

@sudip_95 everyone has access to stackoverflow so if you are pasting answer from there atleast give credits to the original writer

(11 Jul '17, 17:11) divik5444★

Exactly

Lets give him Credit

(12 Jul '17, 22:24) vaibhavchhabra1★
link

answered 15 Jul '17, 01:14

gauravjp50's gravatar image

4★gauravjp50
1
accept rate: 0%

I think you'll better understand by viewing this image;-> ( http://i.imgur.com/9Gv0tdL.png )

link

answered 23 Jul '17, 19:18

vishal9619's gravatar image

2★vishal9619
152
accept rate: 25%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×699
×33

question asked: 09 Jul '17, 02:12

question was seen: 6,069 times

last updated: 23 Jul '17, 19:18