Solved-ASSIGNMENT 2- WRITTEN -Solution

$30.00 $19.00

(a) Draw the 2-3 tree that results when you insert the keys S E A R C H X M P L Y in that order into an initially empty tree. Construct the corresponding red-black tree. Find a sequence of keys to insert into a BST and a red-back BST such that the height of…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)
  1. (a) Draw the 2-3 tree that results when you insert the keys S E A R C H X M P L Y in that order into an initially empty tree. Construct the corresponding red-black tree.

    1. Find a sequence of keys to insert into a BST and a red-back BST such that the height of the BST is less than the height of the red-black BST, or prove that no such sequence is possible.

  1. Define right-leaning red-black BSTs as BSTs having red and black edges satisfying the following three restrictions:

      1. Red links lean right only.

      1. No node has two red links connected to it.

      2. Every path from the root to a leaf has the same black depth.

    1. Rewrite the put() method, on page 439 of the Sedgewick book, so that it works for right-leaning red-black trees instead of left-leaning red-black trees.

    1. Using a construction proof, show that for every right-leaning red-black tree there is a corresponding left-leaning red-black tree.

  1. Let= ( , ), where = { , , , , , , , â„Ž} and =

{{ , }, { , }, { , },{ , }, { , }, { , }, { , }, { , }, { , }, { , â„Ž}, { , â„Ž} }.

    1. Draw the corresponding graph with no edges crossing.

    2. How many paths are there in from to â„Ž?

    1. How many of these paths have length less than 5? List them.

  1. Let = ( , ) be an undirected graph, with no parallel edges or self-loops. Let | | = and | | = . Prove by induction that 2 ≤ 2 − for all ≥ 1.

  1. Consider the graph G shown below:

  1. How many spanning subgraphs are there?

  2. How many connected spanning subgraphs are there?

  3. How many of the spanning subgraphs have vertex 0 as an isolated vertex?