Question
What is the average number of nodes accessed in search for a particular element in an unordered list? In an ordered list? In an unordered
What is the average number of nodes accessed in search for a particular element in an unordered list? In an ordered list? In an unordered array? In an ordered array? Note that a list could be implemented as a linked structure or within an array.
I found the answer to this question, but I just have another follow-up question that I hope will illuminate something for me.
For all of the ADT implementations except for ordered arrays, the avg number of operations comes to , since the formula is divided by n to provide the average, and the "+1" is discarded because it's a constant factor. This is true for all of the ADTs except ordered arrays. For ordered arrays, performing a binary search algorithm (as opposed to, I guess, a linear one), would come to
My question is: why isn't the constant factor discarded in this case? Or should the answer to the avg number of operations for linear search algorithms be ? Thanks for any help you can offer me.
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