Microsoft | SSE | Onsite

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2022-04-12Added By Anonymous
Source: Link

Question:

You are given a binary search tree where every node has a character and int.

Level0: G:4(root)

Level1: E:8(root->left) H:5 (root->right)

Level2: D:10(root->left->left) F:12(root->left->right)


How will you insert element into This tree. You have to maintain BST property for Character and min heap property for value.


Question:

You are given a 1-D array { 1,2,3,4,5,6,7,8,9,10}

Take N/2 and arrange elements alternatively in O(n) and O(1)

Output: 1,6,2,7,3,8,4,9,5,10

Comments