Posted: September 1st, 2023
CSC 316 – Data Structures Homework Assignment
CSC 316 – Data Structures Homework Assignment 4 Due Date: July 11, 2014 Problem 4.1 Suppose that a set S is represented by a splay tree. Write pseudocode for the following operation: Range(S, K 1 , K 2 ) which changes S to the set of all its members for which the key value K satisfies K 1 ≤ K ≤ K 2 . Analyze the running time of your pseudocode. Problem 4.2 (a) Show the heaps that result from inserting 6, 5, 2, 4, 7, 1, and 3 into an initially empty heap (show the heaps as partially ordered trees, not as arrays). (b) Show the heaps that result from performing three successive DeleteMin operations on the heap resulting from part (a). Problem 4.3 A priority queue is said to be stable if deletions of items with equal priority value occur in the order in which they were inserted. Which of the following priority queue structures are stable: linked lists sorted in increasing order of priority (key), balanced search trees (e.g., 2-3 trees), heaps, leftist heaps. Explain why, or give counter- examples. Problem 4.4 (a) Show the result of inserting (in the order given) the following keys into an initially empty leftist heap