2023 2024 Student Forum > Management Forum > Main Forum

 
  #2  
26th July 2016, 06:02 PM
Super Moderator
 
Join Date: Aug 2012
Re: IIIT Hyderabad Advanced Problem Solving

Friend As on your Asking here I m Sharing Advanced Problem Solving
Assignment of International Institute of Information Technology Hyderabad :

1. You are given a binary tree in the form of its array representation. Decide if the tree is a binary search tree or
not. The first number in the input indicates the number of elements that follows, and the blank spaces in the
array are indicated by a -1.
Input: 14 17 12 25 9 15 21 29 -1 11 -1 -1 19 -1 27
Output: YES
Input: 14 17 12 25 9 18 21 29 -1 11 -1 -1 19 -1 27
Output: NO

2. Given the in order and one of pre-order or post order traversals of a binary tree, output the remaining of preorder or post order traversal of the tree. Your input will contain the number of nodes, n, followed by 1 for the
in-order and post-order, and 2 for in-order and pre-order traversals, followed by 2n integers corresponding to the
two traversals.
Input:
7 1
2 3 5 1 4 7 6
2 5 3 7 6 4 1
Output:
1 3 2 5 4 6 7
Thought Exercise: If pre-order and post-order traversals of a binary tree are given, can you uniquely reconstruct
the tree?

3. Given an in-fix expression containing positive integers and the four basic arithmetic operations and possible
parenthesis, output the postfix and prefix equivalents of the expression. The input will contain spaces between
operations and operands. Make sure that the operator precedences are taken care while interpreting the order
of evaluation.
Input:
7 * (3 + 4)
Output:
7 3 4 + *
* 7 + 3 4

4. If you are given n numbers (without repetitions), find the number of of unique binary search trees that can be
created out of it. Your input contains the number of numbers. Note that the actual numbers are not relevant,
as long as they are unique.
Input: 5
Output: 42


Advanced Problem Solving Assignment of International Institute of Information Technology Hyderabad




Contact Details :
040 6653 1000

Address :

International Institute of Information Technology, Hyderabad
Gachibowli, Hyderabad, Telangana 500032


Quick Reply
Your Username: Click here to log in

Message:
Options

Thread Tools Search this Thread



All times are GMT +5. The time now is 02:02 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
SEO by vBSEO 3.6.0 PL2

1 2 3 4