Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CpE 207 Data Structures Fall 2020/2021 Assignment #6 Q1 (15 pts] A kindergarten teacher wants to represent a list of her students' records (by their

image text in transcribed

CpE 207 Data Structures Fall 2020/2021 Assignment #6 Q1 (15 pts] A kindergarten teacher wants to represent a list of her students' records (by their ID). For each child we would like to mark whether he is a boy or a girl. Suggest a data structure that supports the following operations in O(log n) time in the worst case, where n is the number of students (boys and girls) in the data structure when the operation is executed: Using algorithms: 1. Explain what data structure you would use, extra fields added to your data structure. 2. Explain how each of the above operations will be executed (write algorithms explaining their time complexity). a. Insert (SID,G) function - Insert a new student s with student ID (SID) and gender (G) b. ChangeGender(k) - Change the student with SID = k to be a boy. c. Find Diff(k) function, Find the difference between the number of girls and the number of boys () #of girls - #of boys 1) among all the students with SID smaller than k

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

Determine the roles of spatial layout and functionality.

Answered: 1 week ago