联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2019-03-27 10:18

Assignment 4 (75 points)

CS 610 Spring 2019

Instructor : Ravi Varadarajan

Due : Mar 27,2019 in class

Problem 1. (5 points) Recall in a red-black tree black-height bh(x) of a node

x is the number of black nodes in a path to an external node in the subtree

rooted at x, excluding x. Prove by induction on the height of x that the number

of internal nodes in the subtree rooted at x is at least 2bh(x) ? 1.

Problem 2. (10 points) Starting with an empty AVL tree show the trees (with

balance factor at each node) after insertion of each of the following keys in the

order shown: 25,10,5,18,22,20,12,14,15,16

Problem 3. (10 points) Starting with the AVL tree constructed in the first

problem show the trees (with balance factor at each node) after deletion of

each of the following keys in the order shown: 25,15,18,10,5,12,16,22,14,20

Problem 4. (20 points) Problem R-3.11 of the text book. For RB tree, lightly

crosshatch the nodes colored black.

Problem 5. (10 points) Show that the total running time of performing n

union and find operations in amortized union-find data structure is O(n) if

all the union operations are performed before all the finds in the sequence of n

operations.

Problem 6. (8 points) Show that 5 elements can be sorted using 7 comparisons

in the worst-case. Is it optimal Explain.

Problem 7. (12 points) Let A and B be two sequences of n integers each.

Given an integer x, describe an O(n log n)-time algorithm for determining if

there is an integer a in A and b in B such that x = a + b.

1


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp