Can you reconstruct the tree

Assignment Help Computer Engineering
Reference no: EM132121043

Reconstructing Binary Trees Via Traversals

Recall the binary tree data structure; recall three algorithms for traversing the tree: the inorder traversal, the preorder traversal, and the postorder traversal.

1. Suppose you are given the preorder traversal and the inorder traversal of a binary tree. Can you reconstruct the tree? If so, give an algorithm for doing so and prove its correctness. If not, give a counter example. Note that a binary tree is not necessarily a binary search tree.

2. Suppose you are given the preorder and postorder traversals of a binary tree. Can you reconstruct the tree? If so, give an algorithm for doing so and prove its correctness If not, give a counter example.

3. Suppose you are given the preorder traversal of a binary tree. In addition, you are told that the tree is a binary search tree. Can you reconstruct the tree? If so, give an algorithm for doing so and prove its correctness. If not, give a counter example.

Reference no: EM132121043

Questions Cloud

Explain in detail the characters in product variety concept : Explain in detail the characters in the product variety concept. Give examples to support of yours answers.
Write a function called ismagic that takes a 2d array : Write a function called isMagic that takes a 2D array and returns true if the 2D array is a magic square and false otherwise.
Give an algorithm that randomly permutes an input array a : Give an algorithm that randomly permutes an input array A. What is the run-time of your algorithm?
What are the benefit of using short circuit evaluations : What are the benefit of using short circuit evaluations? Are there are safety/reliability issues involved? If so, what are they?
Can you reconstruct the tree : Can you reconstruct the tree? If so, give an algorithm for doing so and prove its correctness.
Describe three threats to access control : Describe three threats to Access Control from what were covered within the reading and give an example of each.
Business opposed to opening a new venture : What are the advantages of purchasing an existing business opposed to opening a new venture?
Write an application named collegelist : Write an application named CollegeList that declares an array of four "regular" CollegeEmployees, three Faculty, and seven Students.
What are the benefits of franchise to both the franchisee : What are the benefits of franchise to both the franchisee and franchiser and What factors would you consider if interested in buying a franchise?

Reviews

Write a Review

Computer Engineering Questions & Answers

  Draw a barplot of the sample

Draw a barplot of the sample. Calculate the mean, standard deviation and variance of the sample.

  Write a 700 to 1050 word paper on a specific web or mobile

write a 700 to 1050 word paper on a specific web or mobile application.describe a specific web or mobile applications

  Why must a clone of a file set be in the same disk partition

Tokens can expire in DFS. Does this require synchronized clocks using DFS? Why must a clone of a file set be in the same disk partition?

  What do you feel are the most important rules for database

what guidelines should you follow when you design a database? in addition to using the course material use the library

  Perform a fit-gap analysis of the scenario

Perform a fit-gap analysis of this scenario considering organizational/social changes as well as IT changes.

  Which category of security control deals with education

Define the difference between least privilege and separation of duties.

  Write a single statement that assigns num_ones with the num

A cashier distributes change using the maximum number of five dollar bills, followed by one dollar bills.

  Write a program that provides the user with a menu of choice

You are to write a program that provides the user with a menu of choices that have to do with performing operations on two-dimensional arrays. In particular, the menu should provide the following options.

  Create developers own machines yet not have direct access

Describe the steps you should take so that developers can create and manage their own machines yet not have direct access to the Hyper-V hosts.

  How to implement successor in an ordered dictionary realized

Describe how to implement successors(k) in an ordered dictionary realized using an ordered search table. What is its running time?

  Write a function named twowords that gets and returns

This problem provides practice using a while True loop. Write a function named twoWords that gets and returns two words from a user.

  How is discrete multitone different from other multiplexing

How is discrete multitone different from the other multiplexing techniques? How does code division multiplexing distinguish one signal from another?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd