Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (10 marks) Consider an abstract data type that consists of a set S of positive integers upon which the following two operations can be

image text in transcribed

1. (10 marks) Consider an abstract data type that consists of a set S of positive integers upon which the following two operations can be performed: DELETE(S, i): Delete integer i from the set S. If i S, there is no effect. SUCCESSORS, i): Return the successor of integer i in S, ie. minU s i j i). If i has no successor in S, i.e. if i 2 max S, then return 0. Note that it is not necessary for i to be in S Initially, S is a set of consecutive integers from a to b. For example, if a - 5,b - 10 then ini- tially S 15,6,7,8,9, 10}. After some DELETEO operations, suppose that S 16,8, 10} then SUCCESSORS, 14) 0, SUCCESSORS. 3)-6 and SUCCESSORS, 6) = SUCCESSORS, 7) = 8. In this question you will describe a data structure with O(a(n)) amortized cost per operation by answering the following questions. (a) What is your data structure to represent S? (b) How do you initialize your data structure and how much time does it take to initialize it? (c) Provide an algorithm for DELETE that takes O(a(n)) amortized time. (d) Provide an algorithm for SUCCESSOR that takes O(a(n)) amortized time 1. (10 marks) Consider an abstract data type that consists of a set S of positive integers upon which the following two operations can be performed: DELETE(S, i): Delete integer i from the set S. If i S, there is no effect. SUCCESSORS, i): Return the successor of integer i in S, ie. minU s i j i). If i has no successor in S, i.e. if i 2 max S, then return 0. Note that it is not necessary for i to be in S Initially, S is a set of consecutive integers from a to b. For example, if a - 5,b - 10 then ini- tially S 15,6,7,8,9, 10}. After some DELETEO operations, suppose that S 16,8, 10} then SUCCESSORS, 14) 0, SUCCESSORS. 3)-6 and SUCCESSORS, 6) = SUCCESSORS, 7) = 8. In this question you will describe a data structure with O(a(n)) amortized cost per operation by answering the following questions. (a) What is your data structure to represent S? (b) How do you initialize your data structure and how much time does it take to initialize it? (c) Provide an algorithm for DELETE that takes O(a(n)) amortized time. (d) Provide an algorithm for SUCCESSOR that takes O(a(n)) amortized time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago