Question

4. In an array-based implementation of the ADT list, what is the best case performance of the contains method? a. O(1) b. O(l

0 0
Add a comment Improve this question Transcribed image text
Answer #1
4)  a.  O(1)
in best case the item we are searching for is present at the first position of the array.
in that case it only takes one single operation.
5)  a.  O(n)
in worst case we might need to go through all positions of the array to find the item we are searching for.
so, in worst case it takes n operations.
6)  a.  O(n)
when the item we are searching for does not contain inside the array.
then we need to go through all n elements of array to verify that.
so, it takes n operations.
Add a comment
Know the answer?
Add Answer to:
4. In an array-based implementation of the ADT list, what is the best case performance of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT