Category: data structure
Given a BST (Binary Search Tree) with duplicates, find its mode(s) – the most frequently occurred element. A BST has the following characteristics: The left subtree of a node …
Given a binary tree, compute the average values for the nodes on each level and return them in the form of an array. For example: Input: 3 / \ …
A Queue implements First In First Out while a Stack is First In Last Out. It is possible to implement a queue using two stacks. When an item is …
Given an array of integers of size N. The array should originally store numbers from 1 to N, however, during transmission, one of the number is duplicated to another …
Given a binary tree, convert it to a string that consist of parenthesis and interests in the pre-order traversal. The empty brackets () for left sub trees can be …