Cerinta completa We consider metric space to be a pair, , where is a set and such that the following conditions hold: where is the distance between points and . Let’s define the product of two metric spaces, , to
Tree : Top View
Cerinta completa Given a pointer to the root of a binary tree, print the top view of the binary tree. The tree as seen from the top the nodes, is called the top view of the tree. For example :
The crazy helix
Cerinta completa Natural numbers from 1 to N have been placed in an increasing order over some helix ( a circular structure ). When the helix starts rotating, it is easy to find out The position of a given number
Super Maximum Cost Queries
Cerinta completa Victoria has a tree, , consisting of nodes numbered from to . Each edge from node to in tree has an integer weight, . Let’s define the cost, , of a path from some node to some other
Taxicab Driver’s Problem
Cerinta completa Burger Town is a city that consists of special junctions and pathways. There is exactly one shortest path between each pair of junctions. Junction is located at and the distance between two junctions is defined by the Taxicab
Starfleet
Cerinta completa In a galaxy far away, there is a constant battle between the republic and the droid army. The droid army decided to launch their final attack on the republic. They have N space-fighters. Initially the ith fighter is
Sum of the Maximums
Cerinta completa Alexey is playing with an array, , of integers. His friend, Ivan, asks him to calculate the sum of the maximum values for all subsegments of . More formally, he wants Alexey to find . Alexey solved Ivan’s
Unique Colors
Cerinta completa You are given an unrooted tree of nodes numbered from to . Each node has a color, . Let be the number of different colors in the path between node and node . For each node , calculate
Tree: Preorder Traversal
Cerinta completa Complete the function in the editor below, which has parameter: a pointer to the root of a binary tree. It must print the values in the tree’s preorder traversal as a single line of space-separated values. Input Format
Square-Ten Tree
Cerinta completa The square-ten tree decomposition of an array is defined as follows: The lowest () level of the square-ten tree consists of single array elements in their natural order. The level (starting from ) of the square-ten tree consists
