Analysis Of Algorithms University of Bridgeport Analysis of Algorithms



Download 3.4 Mb.
Page15/33
Date28.05.2018
Size3.4 Mb.
#51061
1   ...   11   12   13   14   15   16   17   18   ...   33

Average Case Complexity

First we need to set up a model.

As a first step we’ll determine the average case complexity given that the element is present in the array. Here, we take into account the probability of not finding an element at a particular level (in worst case we assumed had taken this part to be one i.e. the element being not found at a particular level was taken as a certainty) and add to it the work done at the next level recursively.

Thus,


AElementPresent(1) = 1

AElementPresent (2k – 1) =

=

=

Repeating ‘i’ times,



AElementPresent (2k – 1) =

Let ‘i = k-1’,


Download 3.4 Mb.

Share with your friends:
1   ...   11   12   13   14   15   16   17   18   ...   33




The database is protected by copyright ©ininet.org 2024
send message

    Main page