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
Self-Driving Bus
Cerinta completa Treeland is a country with cities and roads. There is exactly one path between any two cities. The ruler of Treeland wants to implement a self-driving bus system and asks tree-loving Alex to plan the bus routes. Alex
Self Balancing Tree
Cerinta completa An AVL tree (Georgy Adelson-Velsky and Landis’ tree, named after the inventors) is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if
Reverse a linked list
Cerinta completa This challenge is part of a tutorial track by MyCodeSchool and is accompanied by a video lesson. Given the pointer to the head node of a linked list, change the next pointers of the nodes so that their
