Combinatorics › Counting principles
Bits and binary trees
Solve the first problem 4 problems
- Edit distance between Big and Bang ●○○○○ 10 ptsGiven two strings and , find the minimum number of operations needed to convert into . The allowed operations are deleting a character, replacing a character with another, and inserting a character at any position.
- Element without a duplicate ●○○○○ 10 ptsEvery element of the list appears exactly twice except one element, which appears only once. Find the element that does not have a duplicate.
- Locating a single bit error ●●○○○ 20 ptsA binary code satisfies the parity check equations , and , where is addition modulo 2. A code of this type was changed to after a bit error occurred at only one position during communication, so the bit at position flipped. Find .
- Count unival subtrees in a tree ●●○○○ 20 ptsA unival subtree of a binary tree is a subtree in which all nodes have the same value. A single leaf counts as a unival subtree. Consider the following binary tree. The root has value . The root's left child has value and is a leaf. The root's right child has value ; its left child has value and its right child has value (a leaf). The node with value (the left child of the right child) has two children, both with value (leaves). How many unival subtrees does the tree have?
More in Counting principles
Counting in lists and arraysCounting principleHandshakesInteger pairs with bounded productLicence platesNumbers and codes with digit rulesNumbers containing a digitNumbers from digit cardsOutfits and selectionsParity and odd sumsStacking blocksVowels and consonantsWords and strings with restrictions