Question
TheBibliographyAbstract Data Type stores references. References can be added to the bibliography or removed from the bibliography. No matter how references are represented, they are
TheBibliographyAbstract Data Type stores references. References can be added to the bibliography or removed from the bibliography. No matter how references are represented, they are ordered. Duplicate references are not allowed. You can assume that each author has just one publication and that each publication has only one author.
The ADT for aBibliographyincludes these operations:
- new, which creates a new, empty bibliography
- addReference, which adds a reference to the bibliography
- removeReference, which removes a reference from the bibliography
- outputBibliography, which generates an ordered list of references
For this part, how a reference is represented doesn't matter. The following stand-alone Python function accepts a list of references and returns a bibliography containing those references. It assumes the ADT is implemented as a Python class,
i.e. usingBibliography()as the new operation.
def makeBib(ref_list):
myBib = Bibliography()
for ref in ref_list:
myBib.addReference(ref)
return myBib
Question.
What is the best-case Big-O complexity of themakeBibfunction for an input list withnreferences? Explain your answer. Take eachBibliographyoperation as a basic step of computation.
(4 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started