Question: Question 2 ( 6 marks ) Consider the following red - black tree containing keys 1 0 , 2 3 , 3 1 , 3
Question marks
Consider the following redblack tree containing keys
and :
Draw the redblack tree that results from inserting a node with key into this tree. Show
the steps followed, ie draw the intermediary trees. Question marks
A nonprofit organization provides addiction recovery programs for troubled youth and
maintains information about its programs using a paperbased strategy. The charity is
growing rapidly and you were hired to help it move to a more efficient information
management system.
Your first task is to design a data structure that can be used to implement a data storage
solution for the new information system.
Your data structure design should allow the system to store, for each program,
information organized as a record with components where is an
integer identifying the program no programs can have the same identifier is a string,
the name of the program, is a string, a description of the program, is an integer, the
weekly cost of the program, is an integer, the size of the program, ie the maximum
number of spots in the program, o is an integer, the current occupancy, ie the number
of spots currently taken by clients, e is a string, the eligibility conditions for being accepted
to the program, and is an integer, the rating of the program, a number from to
Your design can be based on any of the data structures discussed in class: you can
augment them, combine them, etc. Your data structure must support implementations of the following operations:
SEARCHli searches for the program with id i and returns the record associated
with it if the program is in the data structure
SEARCHNn searches for the program with name n and returns the record
associated with it if the program is in the data structure
INSERTi n d c s o e r inserts a new record into the data structure
DELETEi deletes from the data structure the record corresponding to the
program with identifier if the program is in the data structure
AVAILABLEPROGRAMS returns the records of the programs with available
spots.
PRINTDS prints the content of the data structure
Provide a Java implementation of your data structure as a class with methods that
implement the operations described above.
Include in your submission test data that can be used to create an instance of your class,
insert programs into this instance, delete a program and print the content of the data
structure. Question marks Let be a connected, undirected graph.
a marks Assume that and are spanning
trees of and that their sets of edges meet the following conditions:
and represents the empty set.
What is the smallest number of vertices that G can have? Explain your answer
and provide an example of such a graph. Clearly describe the spanning trees in
the example you provide.
b marks Let be a graph. Provide an algorithmic strategy that can find
and output exactly two spanning trees of that do not share any edges, eg
where and are spanning trees of and
if such two spanning trees exist.
Provide your algorithmic strategy using pseudo code or a detailed description in
natural language. Explain why your algorithmic strategy meets the requirement.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
