SlideShare a Scribd company logo
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
DOI : 10.5121/ijcsea.2012.2203 29
LINEAR SEARCH VERSUS BINARY SEARCH:
A STATISTICAL COMPARISON
FOR BINOMIAL INPUTS
Anchala Kumari1
, Rama Tripathi2
, Mita Pal3
and Soubhik Chakraborty4*
1
University Department of Statistics, Patna University, Patna-800005, India
2
Department of Information Technology, BIT Mesra, Ranchi-835215, India
3, 4
Department of Applied Mathematics, BIT Mesra, Ranchi-835215, India
*corresponding author’s email: soubhikc@yahoo.co.in (S. Chakraborty)
ABSTRACT
For certain algorithms such as sorting and searching, the parameters of the input probability distribution,
in addition to the size of the input, have been found to influence the complexity of the underlying algorithm.
The present paper makes a statistical comparative study on parameterized complexity between linear and
binary search algorithms for binomial inputs.
KEY WORDS
Linear search; binary search; parameterized complexity; statistics; factorial experiments
1 INTRODUCTION
Two of the popular search algorithms are linear search and binary search. While linear
search (also called sequential search) scans each array element sequentially, a binary search in
contrast is a dichotomic divide and conquer search algorithm. For an extensive literature on
searching, see Knuth [1].
In the present paper we investigate the effect of parameters n and p of a Binomial distribution
input on the number of comparisons in linear search and binary search. Using factorial
experiment, it is observed that both the main effects n and p and the interaction effects n*p are
highly significant for linear and significant but comparatively less for binary search. The result
clearly suggests that apart from the size of the input, the parameters of the input distribution need
also be taken into account to explain the behavior of certain algorithms. In an earlier work on
parameterized complexity, Anchala and Chakraborty [2] used factorial experiment to explain
software complexity for insertion sort. The same authors have used factorial experiments with a
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
30
response surface design in [3] to examine the nature of the fast and popular quicksort. The first
researchers to work on parameterized complexity are Downey and Fellows [4].
2. Experimental results
2.1 Results using factorial experiment
Binomial variates are independently filled in an array of size k = 2000 (fixed) and we make a
linear search for an element which is in the array. We are interested in finding the number of
comparisons expected to ascertain that the searched element is present. To ensure the searched
element is indeed available in the array, one array index was randomly selected and the key of
this index is the searched element. The code is omitted.
Binomial distribution (definition): Let X be a Binomial variate with parameters n and p. The
probability P (X = x) = n
Cx px
(1-p)n-x
where x=0, 1, 2, …n and 0<p<1. Binomial distribution has
three assumptions:
1. Trials are independent.
2. Each trial can result in one of two possible outcomes which we call “success” and
“failure” respectively.
3. The probability of success p is fixed in each trial. The expression for P(X=x) gives the
probability of getting x successes in n trials made under the three above-mentioned assumptions.
The distribution is so called as the expression for P(X=x) is the general term, i.e., (x+1)-th term in
the Binomial expansion of (q+p)n
, q=1-p is the probability of failure in each trial. Since we
assume p as fixed, q is fixed as well. Further literature on Binomial distribution can be found in
Gupta and Kapoor [5].
To study the main effects n and p as well as the interaction effects n*p of the parameters n and p
of Binomial (n, p) distribution input on the number of comparisons, a 32
factorial experiment was
conducted with two factors n and p each at three levels (3000, 6000, 9000 for n and 0.2, 0.5 and
0.8 for p). Table 1 gives the data for the desired factorial experiment (n is written as N and p as P;
this is what MINITAB will print) for linear search while table 2 gives the same for binary search.
Tables 3 and 4 give the ANOVA tables depicting the results of factorial experiment on linear
search and binary search respectively.
2.2 Other experimental results
Tables 5-8 and figures 1-8 summarize our other experimental results. These results were obtained
for fixed array size k = 2000.
3. Discussion
It can be theoretically argued that the parameters of the Binomial distribution, in addition to the
array size k (here fixed at 2000), will affect the number of comparisons in linear search (the same
for binary search is under investigation). Since the searched element can be present in more than
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
31
one place, we suppose the first time it comes is in position r, r=1, 2…k. Then we must have that
the first r-1 comparisons did not yield the searched element and that the r-th comparison yielded
it.
Evidently, this probability is P(r) = C{1-f(y, n, p)}r-1
f(y, n, p), r=1, 2…k………(1)
where y is the searched element.
This is because the k array elements are independently filled with Binomial (n, p) variates, so that
the probability of any array element to be y is P(X=y)=f (say) and not to be y is 1-f. C is a
normalization factor to ensure ΣP(r) =1, r = 1, 2…k It can be shown that the expected number of
comparisons
= E(r) = Σ rP(r), the summation over r is from1 to k, = C f S where C = 1/ [1- P(0)-P(k+1)-
P(k+2)……]
f = n
Cy px
(1-p)n-y
and, S = [1- {1- f}k
]/ f 2
- k{1- f}k
/ f
Remark: The random variable r follows a doubly truncated Geometric distribution since r cannot
take the value 0, nor can it take a value higher than k.
The expression for the expected number of comparisons, however, does not establish the
significance of the interaction effect n*p and hence we resorted to factorial experiments. Our
results confirm the interaction effect, besides the main effects, is highly significant. Further,
figures 1-8 suggest an O(n) complexity for fixed p and k and O(p) complexity for fixed n and k.
4. Conclusion
Using 32
factorial experiment, it is observed that not only the main effects n and p but even the
interaction effects n*p are highly significant in influencing the number of comparisons in linear
search for Binomial (n, p) input. However, it is also observed that the main effects n, p and the
interaction effects n*p are comparatively less significant in influencing the number of
comparisons in binary search for Binomial (n, p) input.. Moreover, the mean comparisons seems
to depend linearly on n and p for fixed k. Interestingly, this is true for both linear and binary
search. The results clearly suggest why, apart from the size of the input, the parameters of the
input distribution need also be taken into account to explain the behavior of certain algorithms.
The role of factorial experiments is firmly established in parameterized complexity analysis in
such algorithms.
To the question which algorithms are better suited for such studies in parameterized complexity,
the answer is that those in which fixing the input parameter characterizing the array size (k in our
case) does not fix all the computing operations. The sorting and searching algorithms fall into this
category. Future work includes similar interesting case studies.
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
32
TABLES AND FIGURES
-------------------------
Table 1: Mean number of comparisons in linear search for fixed array size (2000) and varying N and P.
First set of observations
P N=3000 N=6000 N=9000
0.2 119.92 515.02 967.79
0.5 112.47 581.42 1185.53
0.8 108.03 535.30 1022.51
Second set of observations
P N=3000 N=6000 N=9000
0.2 118.03 516.09 967.95
0.5 112.09 582.50 1184.36
0.8 107.56 533.40 1020.31
Third set of observations
P N=3000 N=6000 N=9000
0.2 119.06 514.86 968.03
0.5 111.43 581.89 1186.46
0.8 108.98 536.20 1021.56
Table 2: Mean number of comparisons in binary search for fixed array size (2000) and varying N and P.
First set of observations
P N=3000 N=6000 N=9000
0.2 1001.33 4019.86 7059.48
0.5 994.98 3934.99 6934.33
0.8 1034.68 4086.44 7029.36
Second set of observations
P N=3000 N=6000 N=9000
0.2 975.69 4046.29 7054.04
0.5 998.20 3966.216952.95
0.8 982.34 4002.587058.36
Third set of observations
P N=3000 N=6000 N=9000
0.2 1014.414032.38 7019.08
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
33
0.5 1005.05 3966.83 6989.9
0.8 988.91 3991.40 7039.2
Table 3: Analysis of Variance for y, using Adjusted SS for Tests (linear search)
Source DF Seq SS Adj SS Adj MS F P
N 2 4030817 4030817 2015409 2659942.28 0.000
p 2 42272 42272 21136 27895.62 0.000
N*p 4 42014 42014 10504 13862.63 0.000
Error 18 14 14 1
Total 26 4115118
S = 0.870453 R-Sq = 100.00% R-Sq(adj) = 100.00%
MINITAB version 15 was used to yield the results of the factorial experiments of Linear search:-
Multilevel Factorial Design
Factors: 2 Replicates: 3
Base runs: 9 Total runs: 27
Base blocks: 1 Total blocks: 1
Number of levels: 3, 3
General Linear Model: y versus N, p
Factor Type Levels Values
N fixed 3 1, 2, 3
p fixed 3 1, 2, 3
Table 4: Analysis of Variance for y, using Adjusted SS for Tests (binary search)
Source DF Seq SS Adj SS Adj MS F P
N 2 162847793 162847793 81423897 123575.44 0.000
P 2 16681 16681 8340 12.66 0.000
N*P 4 8489 8489 2122 3.22 0.037
Error 18 11860 11860 659
Total 26 162884823
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
34
S = 25.6691 R-Sq = 99.99% R-Sq(adj) = 99.99%
MINITAB version 15 was used to yield the results of the factorial experiments of binary search:-
Multilevel Factorial Design
Factors: 2 Replicates: 3
Base runs: 9 Total runs: 27
Base blocks: 1 Total blocks: 1
Number of levels: 3, 3
General Linear Model: y versus N, P
Factor Type Levels Values
N fixed 3 1, 2, 3
P fixed 3 1, 2, 3
Table 5: Mean and SD of no. of comparisons for fixed p=0.2 and N varying from 3000 to 9000
LINEAR SEARCH BINARY SEARCH
Linear Binary
N MEAN SD MEAN SD
3000 95.42429 5.099625 971.1229 21.92183
4000 211.8057 8.217798 1928.013 42.26884
5000 340.4814 10.77158 2893.254 76.00657
6000 483.5814 15.46534 3880.792 1111.529
7000 632.7686 19.9731 4879.703 148.2382
8000 820.7614 25.74744 5854.994 185.6159
9000 971.8386 31.84307 6849.33 222.3924
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
35
Table 6: Mean and SD of no. of comparisons for fixed p=0.5 and N varying from 3000 to 9000
LINEAR SEARCH BINARY SEARCH
Linear Binary
N MEAN SD MEAN SD
3000 130.1014 7.00651 972.08 21.59409
4000 264.1129 8.887761 1980.031 42.77784
5000 415.3614 13.31927 2928.61 77.99048
6000 588.0328 18.06139 3899.347 112.9273
7000 756.0186 24.04293 4844.13 148.9676
8000 924.8 26.66672 5850.78 185.8966
9000 1121.763 36.24661 6819.733 222.2228
Table 7: Mean and SD of no. of comparisons for fixed p=0.8 and N varying from 3000 to 9000
LINEAR SEARCH BINARY SEARCH
Linear Binary
N MEAN SD MEAN SD
3000 115.6329 6.243703 1018.141 21.48802
4000 245.1214 8.52181 1985.369 44.04666
5000 393.5871 12.7249 2975.52 78.13666
6000 550.3929 17.45485 3982.537 114.5793
7000 704.8671 22.51765 4990.81 152.1838
8000 856.3285 27.90663 5981.506 189.8659
9000 1041.273 33.69814 7011.628 227.1954
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
36
Table 8: Mean and SD of no. of comparisons for fixed N=10,000 and p varying from 0.1 to 0.9
LINEAR SEARCH BINARY SEARCH
Linear Binary
P MEAN SD MEAN SD
0.1 146.4986 8.256072 1007.9 21.96101
0.2 312.5357 9.884373 2030.541 43.94901
0.3 488.8714 14.8072 3028.646 79.62766
0.4 683.6443 20.83033 4020.094 116.2303
0.5 887.1243 27.49452 5019.079 153.6259
0.6 1076.687 34.59078 6050.274 190.9012
0.7 1289.791 42.12352 7076.607 229.6028
0.8 1460.953 49.30895 8077.373 268.2914
0.9 1601.191 55.57834 9095.618 305.9862
Fig. 1 Plot between N and Mean Comparisons for linear search (p=0.2)
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
37
Fig. 2 Plot between N and Mean Comparisons for Binary Search (p=0.2)
Fig. 3 Plot between N and mean comparisons for linear search (p=0.5)
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
38
Fig. 4: Plot between N and mean comparisons for binary search (p=0.5)
Fig. 5: Plot between N and mean comparisons for linear search (p=0.8)
Fig. 6 Plot between N and mean comparisons for binary search (p=0.8)
International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012
39
Fig. 7 Plot between p and mean comparisons for linear search (N=10,000)
Fig. 8 Plot Between p and corresponding mean for binary search (N=10,000)
References
[1] Knuth, D. E. The Art of Computer Programming, Vol. 3: Sorting and Searching, Addison Wesley,
(1997), 3rd ed., 396-408
[2] Kumari , A. and Chakraborty , S., Software Complexity: A Statistical Case Study Through
Insertion Sort, Applied Math. and Compu., vol. 190(1), (2007), p. 40-50
[3] Kumari, A. and Chakraborty, S., A Simulation Study on Quick Sort Parameterized Complexity
Using Response Surface Design, International Journal of Mathematical Modeling, Simulation and
Applications, Vol. 1, No. 4, (2008), 448-458
[4] Downey, Rod G.; Fellows, Michael R. (1999). Parameterized Complexity. Springer.
[5] S. C. Gupta and V. K. Kapoor, Fundamentals of Mathematical Statistics, Sultan Chand and Sons,
New Delhi, reprint 2010

More Related Content

What's hot

KNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing ValuesKNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing Values
ijeei-iaes
 
Solving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy Number
Solving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy NumberSolving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy Number
Solving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy Number
IJERA Editor
 
Ou3425912596
Ou3425912596Ou3425912596
Ou3425912596
IJERA Editor
 
Parameter Estimation for the Exponential distribution model Using Least-Squar...
Parameter Estimation for the Exponential distribution model Using Least-Squar...Parameter Estimation for the Exponential distribution model Using Least-Squar...
Parameter Estimation for the Exponential distribution model Using Least-Squar...
IJMERJOURNAL
 
Grds international conference on pure and applied science (9)
Grds international conference on pure and applied science (9)Grds international conference on pure and applied science (9)
Grds international conference on pure and applied science (9)
Global R & D Services
 
THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...
THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...
THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...
AM Publications
 
A Mathematical Programming Approach for Selection of Variables in Cluster Ana...
A Mathematical Programming Approach for Selection of Variables in Cluster Ana...A Mathematical Programming Approach for Selection of Variables in Cluster Ana...
A Mathematical Programming Approach for Selection of Variables in Cluster Ana...
IJRES Journal
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type i
Alexander Decker
 
Unger
UngerUnger
Unger
Uri Unger
 
Integration techniques for two dimensional domains
Integration techniques for two dimensional domainsIntegration techniques for two dimensional domains
Integration techniques for two dimensional domains
eSAT Publishing House
 
A0280106
A0280106A0280106
Metaheuristic Optimization: Algorithm Analysis and Open Problems
Metaheuristic Optimization: Algorithm Analysis and Open ProblemsMetaheuristic Optimization: Algorithm Analysis and Open Problems
Metaheuristic Optimization: Algorithm Analysis and Open Problems
Xin-She Yang
 
N41049093
N41049093N41049093
N41049093
IJERA Editor
 
A Non Parametric Estimation Based Underwater Target Classifier
A Non Parametric Estimation Based Underwater Target ClassifierA Non Parametric Estimation Based Underwater Target Classifier
A Non Parametric Estimation Based Underwater Target Classifier
CSCJournals
 
Parameter Estimation for the Weibul distribution model Using Least-Squares Me...
Parameter Estimation for the Weibul distribution model Using Least-Squares Me...Parameter Estimation for the Weibul distribution model Using Least-Squares Me...
Parameter Estimation for the Weibul distribution model Using Least-Squares Me...
IJMERJOURNAL
 
Novel algorithms for detection of unknown chemical molecules with specific bi...
Novel algorithms for detection of unknown chemical molecules with specific bi...Novel algorithms for detection of unknown chemical molecules with specific bi...
Novel algorithms for detection of unknown chemical molecules with specific bi...
Aboul Ella Hassanien
 
O0447796
O0447796O0447796
O0447796
IJERA Editor
 
Analytical Solutions of simultaneous Linear Differential Equations in Chemica...
Analytical Solutions of simultaneous Linear Differential Equations in Chemica...Analytical Solutions of simultaneous Linear Differential Equations in Chemica...
Analytical Solutions of simultaneous Linear Differential Equations in Chemica...
IJMERJOURNAL
 

What's hot (18)

KNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing ValuesKNN and ARL Based Imputation to Estimate Missing Values
KNN and ARL Based Imputation to Estimate Missing Values
 
Solving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy Number
Solving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy NumberSolving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy Number
Solving Fuzzy Maximal Flow Problem Using Octagonal Fuzzy Number
 
Ou3425912596
Ou3425912596Ou3425912596
Ou3425912596
 
Parameter Estimation for the Exponential distribution model Using Least-Squar...
Parameter Estimation for the Exponential distribution model Using Least-Squar...Parameter Estimation for the Exponential distribution model Using Least-Squar...
Parameter Estimation for the Exponential distribution model Using Least-Squar...
 
Grds international conference on pure and applied science (9)
Grds international conference on pure and applied science (9)Grds international conference on pure and applied science (9)
Grds international conference on pure and applied science (9)
 
THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...
THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...
THE ROLE OF HIGH ORDER TERMS IN LANDAU THEORY TOWARD LANDAU-KHALATNIKOV EQUAT...
 
A Mathematical Programming Approach for Selection of Variables in Cluster Ana...
A Mathematical Programming Approach for Selection of Variables in Cluster Ana...A Mathematical Programming Approach for Selection of Variables in Cluster Ana...
A Mathematical Programming Approach for Selection of Variables in Cluster Ana...
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type i
 
Unger
UngerUnger
Unger
 
Integration techniques for two dimensional domains
Integration techniques for two dimensional domainsIntegration techniques for two dimensional domains
Integration techniques for two dimensional domains
 
A0280106
A0280106A0280106
A0280106
 
Metaheuristic Optimization: Algorithm Analysis and Open Problems
Metaheuristic Optimization: Algorithm Analysis and Open ProblemsMetaheuristic Optimization: Algorithm Analysis and Open Problems
Metaheuristic Optimization: Algorithm Analysis and Open Problems
 
N41049093
N41049093N41049093
N41049093
 
A Non Parametric Estimation Based Underwater Target Classifier
A Non Parametric Estimation Based Underwater Target ClassifierA Non Parametric Estimation Based Underwater Target Classifier
A Non Parametric Estimation Based Underwater Target Classifier
 
Parameter Estimation for the Weibul distribution model Using Least-Squares Me...
Parameter Estimation for the Weibul distribution model Using Least-Squares Me...Parameter Estimation for the Weibul distribution model Using Least-Squares Me...
Parameter Estimation for the Weibul distribution model Using Least-Squares Me...
 
Novel algorithms for detection of unknown chemical molecules with specific bi...
Novel algorithms for detection of unknown chemical molecules with specific bi...Novel algorithms for detection of unknown chemical molecules with specific bi...
Novel algorithms for detection of unknown chemical molecules with specific bi...
 
O0447796
O0447796O0447796
O0447796
 
Analytical Solutions of simultaneous Linear Differential Equations in Chemica...
Analytical Solutions of simultaneous Linear Differential Equations in Chemica...Analytical Solutions of simultaneous Linear Differential Equations in Chemica...
Analytical Solutions of simultaneous Linear Differential Equations in Chemica...
 

Similar to LINEAR SEARCH VERSUS BINARY SEARCH: A STATISTICAL COMPARISON FOR BINOMIAL INPUTS

A New Enhanced Method of Non Parametric power spectrum Estimation.
A New Enhanced Method of Non Parametric power spectrum Estimation.A New Enhanced Method of Non Parametric power spectrum Estimation.
A New Enhanced Method of Non Parametric power spectrum Estimation.
CSCJournals
 
A STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMS
A STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMSA STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMS
A STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMS
ijfcstjournal
 
A statistical comparative study of
A statistical comparative study ofA statistical comparative study of
A statistical comparative study of
ijfcstjournal
 
PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...
PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...
PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...
IJCSEA Journal
 
Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...
Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...
Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...
ijcsa
 
Interpolation of-geofield-parameters
Interpolation of-geofield-parametersInterpolation of-geofield-parameters
Interpolation of-geofield-parameters
Cemal Ardil
 
Q130402109113
Q130402109113Q130402109113
Q130402109113
IOSR Journals
 
Using Partitioned Design Matrices in Analyzing Nested-Factorial Experiments
Using Partitioned Design Matrices in Analyzing Nested-Factorial ExperimentsUsing Partitioned Design Matrices in Analyzing Nested-Factorial Experiments
Using Partitioned Design Matrices in Analyzing Nested-Factorial Experiments
International journal of scientific and technical research in engineering (IJSTRE)
 
Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...
Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...
Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...
IOSR Journals
 
BPSO&1-NN algorithm-based variable selection for power system stability ident...
BPSO&1-NN algorithm-based variable selection for power system stability ident...BPSO&1-NN algorithm-based variable selection for power system stability ident...
BPSO&1-NN algorithm-based variable selection for power system stability ident...
IJAEMSJORNAL
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type i
Alexander Decker
 
Bayesian Estimation for Missing Values in Latin Square Design
Bayesian Estimation for Missing Values in Latin Square DesignBayesian Estimation for Missing Values in Latin Square Design
Bayesian Estimation for Missing Values in Latin Square Design
inventionjournals
 
A Thresholding Method to Estimate Quantities of Each Class
A Thresholding Method to Estimate Quantities of Each ClassA Thresholding Method to Estimate Quantities of Each Class
A Thresholding Method to Estimate Quantities of Each Class
Waqas Tariq
 
similarity measure
similarity measure similarity measure
similarity measure
ZHAO Sam
 
ColosimoIntieriPacella_v03[1]
ColosimoIntieriPacella_v03[1]ColosimoIntieriPacella_v03[1]
ColosimoIntieriPacella_v03[1]
Andrea Intieri
 
K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!
K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!
K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!
idescitation
 
On Pairs of Pythagorean Triangles –I
On Pairs of Pythagorean Triangles –IOn Pairs of Pythagorean Triangles –I
On Pairs of Pythagorean Triangles –I
iosrjce
 
D044042432
D044042432D044042432
D044042432
IJERA Editor
 
Iwsm2014 putnam revisited (han suelmann) for publication
Iwsm2014   putnam revisited (han suelmann) for publicationIwsm2014   putnam revisited (han suelmann) for publication
Iwsm2014 putnam revisited (han suelmann) for publication
Nesma
 
STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...
STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...
STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...
Wireilla
 

Similar to LINEAR SEARCH VERSUS BINARY SEARCH: A STATISTICAL COMPARISON FOR BINOMIAL INPUTS (20)

A New Enhanced Method of Non Parametric power spectrum Estimation.
A New Enhanced Method of Non Parametric power spectrum Estimation.A New Enhanced Method of Non Parametric power spectrum Estimation.
A New Enhanced Method of Non Parametric power spectrum Estimation.
 
A STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMS
A STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMSA STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMS
A STATISTICAL COMPARATIVE STUDY OF SOME SORTING ALGORITHMS
 
A statistical comparative study of
A statistical comparative study ofA statistical comparative study of
A statistical comparative study of
 
PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...
PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...
PARTITION SORT REVISITED: RECONFIRMING THE ROBUSTNESS IN AVERAGE CASE AND MUC...
 
Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...
Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...
Partition Sort Revisited: Reconfirming the Robustness in Average Case and Muc...
 
Interpolation of-geofield-parameters
Interpolation of-geofield-parametersInterpolation of-geofield-parameters
Interpolation of-geofield-parameters
 
Q130402109113
Q130402109113Q130402109113
Q130402109113
 
Using Partitioned Design Matrices in Analyzing Nested-Factorial Experiments
Using Partitioned Design Matrices in Analyzing Nested-Factorial ExperimentsUsing Partitioned Design Matrices in Analyzing Nested-Factorial Experiments
Using Partitioned Design Matrices in Analyzing Nested-Factorial Experiments
 
Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...
Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...
Parametric Sensitivity Analysis of a Mathematical Model of Two Interacting Po...
 
BPSO&1-NN algorithm-based variable selection for power system stability ident...
BPSO&1-NN algorithm-based variable selection for power system stability ident...BPSO&1-NN algorithm-based variable selection for power system stability ident...
BPSO&1-NN algorithm-based variable selection for power system stability ident...
 
Bayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type iBayes estimators for the shape parameter of pareto type i
Bayes estimators for the shape parameter of pareto type i
 
Bayesian Estimation for Missing Values in Latin Square Design
Bayesian Estimation for Missing Values in Latin Square DesignBayesian Estimation for Missing Values in Latin Square Design
Bayesian Estimation for Missing Values in Latin Square Design
 
A Thresholding Method to Estimate Quantities of Each Class
A Thresholding Method to Estimate Quantities of Each ClassA Thresholding Method to Estimate Quantities of Each Class
A Thresholding Method to Estimate Quantities of Each Class
 
similarity measure
similarity measure similarity measure
similarity measure
 
ColosimoIntieriPacella_v03[1]
ColosimoIntieriPacella_v03[1]ColosimoIntieriPacella_v03[1]
ColosimoIntieriPacella_v03[1]
 
K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!
K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!
K-Sort: A New Sorting Algorithm that Beats Heap Sort for n 70 Lakhs!
 
On Pairs of Pythagorean Triangles –I
On Pairs of Pythagorean Triangles –IOn Pairs of Pythagorean Triangles –I
On Pairs of Pythagorean Triangles –I
 
D044042432
D044042432D044042432
D044042432
 
Iwsm2014 putnam revisited (han suelmann) for publication
Iwsm2014   putnam revisited (han suelmann) for publicationIwsm2014   putnam revisited (han suelmann) for publication
Iwsm2014 putnam revisited (han suelmann) for publication
 
STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...
STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...
STATISTICAL ANALYSIS OF FUZZY LINEAR REGRESSION MODEL BASED ON DIFFERENT DIST...
 

Recently uploaded

132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
mamunhossenbd75
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
enizeyimana36
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
NazakatAliKhoso2
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 

Recently uploaded (20)

132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
Heat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation pptHeat Resistant Concrete Presentation ppt
Heat Resistant Concrete Presentation ppt
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball playEric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
Eric Nizeyimana's document 2006 from gicumbi to ttc nyamata handball play
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
Textile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdfTextile Chemical Processing and Dyeing.pdf
Textile Chemical Processing and Dyeing.pdf
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 

LINEAR SEARCH VERSUS BINARY SEARCH: A STATISTICAL COMPARISON FOR BINOMIAL INPUTS

  • 1. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 DOI : 10.5121/ijcsea.2012.2203 29 LINEAR SEARCH VERSUS BINARY SEARCH: A STATISTICAL COMPARISON FOR BINOMIAL INPUTS Anchala Kumari1 , Rama Tripathi2 , Mita Pal3 and Soubhik Chakraborty4* 1 University Department of Statistics, Patna University, Patna-800005, India 2 Department of Information Technology, BIT Mesra, Ranchi-835215, India 3, 4 Department of Applied Mathematics, BIT Mesra, Ranchi-835215, India *corresponding author’s email: soubhikc@yahoo.co.in (S. Chakraborty) ABSTRACT For certain algorithms such as sorting and searching, the parameters of the input probability distribution, in addition to the size of the input, have been found to influence the complexity of the underlying algorithm. The present paper makes a statistical comparative study on parameterized complexity between linear and binary search algorithms for binomial inputs. KEY WORDS Linear search; binary search; parameterized complexity; statistics; factorial experiments 1 INTRODUCTION Two of the popular search algorithms are linear search and binary search. While linear search (also called sequential search) scans each array element sequentially, a binary search in contrast is a dichotomic divide and conquer search algorithm. For an extensive literature on searching, see Knuth [1]. In the present paper we investigate the effect of parameters n and p of a Binomial distribution input on the number of comparisons in linear search and binary search. Using factorial experiment, it is observed that both the main effects n and p and the interaction effects n*p are highly significant for linear and significant but comparatively less for binary search. The result clearly suggests that apart from the size of the input, the parameters of the input distribution need also be taken into account to explain the behavior of certain algorithms. In an earlier work on parameterized complexity, Anchala and Chakraborty [2] used factorial experiment to explain software complexity for insertion sort. The same authors have used factorial experiments with a
  • 2. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 30 response surface design in [3] to examine the nature of the fast and popular quicksort. The first researchers to work on parameterized complexity are Downey and Fellows [4]. 2. Experimental results 2.1 Results using factorial experiment Binomial variates are independently filled in an array of size k = 2000 (fixed) and we make a linear search for an element which is in the array. We are interested in finding the number of comparisons expected to ascertain that the searched element is present. To ensure the searched element is indeed available in the array, one array index was randomly selected and the key of this index is the searched element. The code is omitted. Binomial distribution (definition): Let X be a Binomial variate with parameters n and p. The probability P (X = x) = n Cx px (1-p)n-x where x=0, 1, 2, …n and 0<p<1. Binomial distribution has three assumptions: 1. Trials are independent. 2. Each trial can result in one of two possible outcomes which we call “success” and “failure” respectively. 3. The probability of success p is fixed in each trial. The expression for P(X=x) gives the probability of getting x successes in n trials made under the three above-mentioned assumptions. The distribution is so called as the expression for P(X=x) is the general term, i.e., (x+1)-th term in the Binomial expansion of (q+p)n , q=1-p is the probability of failure in each trial. Since we assume p as fixed, q is fixed as well. Further literature on Binomial distribution can be found in Gupta and Kapoor [5]. To study the main effects n and p as well as the interaction effects n*p of the parameters n and p of Binomial (n, p) distribution input on the number of comparisons, a 32 factorial experiment was conducted with two factors n and p each at three levels (3000, 6000, 9000 for n and 0.2, 0.5 and 0.8 for p). Table 1 gives the data for the desired factorial experiment (n is written as N and p as P; this is what MINITAB will print) for linear search while table 2 gives the same for binary search. Tables 3 and 4 give the ANOVA tables depicting the results of factorial experiment on linear search and binary search respectively. 2.2 Other experimental results Tables 5-8 and figures 1-8 summarize our other experimental results. These results were obtained for fixed array size k = 2000. 3. Discussion It can be theoretically argued that the parameters of the Binomial distribution, in addition to the array size k (here fixed at 2000), will affect the number of comparisons in linear search (the same for binary search is under investigation). Since the searched element can be present in more than
  • 3. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 31 one place, we suppose the first time it comes is in position r, r=1, 2…k. Then we must have that the first r-1 comparisons did not yield the searched element and that the r-th comparison yielded it. Evidently, this probability is P(r) = C{1-f(y, n, p)}r-1 f(y, n, p), r=1, 2…k………(1) where y is the searched element. This is because the k array elements are independently filled with Binomial (n, p) variates, so that the probability of any array element to be y is P(X=y)=f (say) and not to be y is 1-f. C is a normalization factor to ensure ΣP(r) =1, r = 1, 2…k It can be shown that the expected number of comparisons = E(r) = Σ rP(r), the summation over r is from1 to k, = C f S where C = 1/ [1- P(0)-P(k+1)- P(k+2)……] f = n Cy px (1-p)n-y and, S = [1- {1- f}k ]/ f 2 - k{1- f}k / f Remark: The random variable r follows a doubly truncated Geometric distribution since r cannot take the value 0, nor can it take a value higher than k. The expression for the expected number of comparisons, however, does not establish the significance of the interaction effect n*p and hence we resorted to factorial experiments. Our results confirm the interaction effect, besides the main effects, is highly significant. Further, figures 1-8 suggest an O(n) complexity for fixed p and k and O(p) complexity for fixed n and k. 4. Conclusion Using 32 factorial experiment, it is observed that not only the main effects n and p but even the interaction effects n*p are highly significant in influencing the number of comparisons in linear search for Binomial (n, p) input. However, it is also observed that the main effects n, p and the interaction effects n*p are comparatively less significant in influencing the number of comparisons in binary search for Binomial (n, p) input.. Moreover, the mean comparisons seems to depend linearly on n and p for fixed k. Interestingly, this is true for both linear and binary search. The results clearly suggest why, apart from the size of the input, the parameters of the input distribution need also be taken into account to explain the behavior of certain algorithms. The role of factorial experiments is firmly established in parameterized complexity analysis in such algorithms. To the question which algorithms are better suited for such studies in parameterized complexity, the answer is that those in which fixing the input parameter characterizing the array size (k in our case) does not fix all the computing operations. The sorting and searching algorithms fall into this category. Future work includes similar interesting case studies.
  • 4. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 32 TABLES AND FIGURES ------------------------- Table 1: Mean number of comparisons in linear search for fixed array size (2000) and varying N and P. First set of observations P N=3000 N=6000 N=9000 0.2 119.92 515.02 967.79 0.5 112.47 581.42 1185.53 0.8 108.03 535.30 1022.51 Second set of observations P N=3000 N=6000 N=9000 0.2 118.03 516.09 967.95 0.5 112.09 582.50 1184.36 0.8 107.56 533.40 1020.31 Third set of observations P N=3000 N=6000 N=9000 0.2 119.06 514.86 968.03 0.5 111.43 581.89 1186.46 0.8 108.98 536.20 1021.56 Table 2: Mean number of comparisons in binary search for fixed array size (2000) and varying N and P. First set of observations P N=3000 N=6000 N=9000 0.2 1001.33 4019.86 7059.48 0.5 994.98 3934.99 6934.33 0.8 1034.68 4086.44 7029.36 Second set of observations P N=3000 N=6000 N=9000 0.2 975.69 4046.29 7054.04 0.5 998.20 3966.216952.95 0.8 982.34 4002.587058.36 Third set of observations P N=3000 N=6000 N=9000 0.2 1014.414032.38 7019.08
  • 5. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 33 0.5 1005.05 3966.83 6989.9 0.8 988.91 3991.40 7039.2 Table 3: Analysis of Variance for y, using Adjusted SS for Tests (linear search) Source DF Seq SS Adj SS Adj MS F P N 2 4030817 4030817 2015409 2659942.28 0.000 p 2 42272 42272 21136 27895.62 0.000 N*p 4 42014 42014 10504 13862.63 0.000 Error 18 14 14 1 Total 26 4115118 S = 0.870453 R-Sq = 100.00% R-Sq(adj) = 100.00% MINITAB version 15 was used to yield the results of the factorial experiments of Linear search:- Multilevel Factorial Design Factors: 2 Replicates: 3 Base runs: 9 Total runs: 27 Base blocks: 1 Total blocks: 1 Number of levels: 3, 3 General Linear Model: y versus N, p Factor Type Levels Values N fixed 3 1, 2, 3 p fixed 3 1, 2, 3 Table 4: Analysis of Variance for y, using Adjusted SS for Tests (binary search) Source DF Seq SS Adj SS Adj MS F P N 2 162847793 162847793 81423897 123575.44 0.000 P 2 16681 16681 8340 12.66 0.000 N*P 4 8489 8489 2122 3.22 0.037 Error 18 11860 11860 659 Total 26 162884823
  • 6. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 34 S = 25.6691 R-Sq = 99.99% R-Sq(adj) = 99.99% MINITAB version 15 was used to yield the results of the factorial experiments of binary search:- Multilevel Factorial Design Factors: 2 Replicates: 3 Base runs: 9 Total runs: 27 Base blocks: 1 Total blocks: 1 Number of levels: 3, 3 General Linear Model: y versus N, P Factor Type Levels Values N fixed 3 1, 2, 3 P fixed 3 1, 2, 3 Table 5: Mean and SD of no. of comparisons for fixed p=0.2 and N varying from 3000 to 9000 LINEAR SEARCH BINARY SEARCH Linear Binary N MEAN SD MEAN SD 3000 95.42429 5.099625 971.1229 21.92183 4000 211.8057 8.217798 1928.013 42.26884 5000 340.4814 10.77158 2893.254 76.00657 6000 483.5814 15.46534 3880.792 1111.529 7000 632.7686 19.9731 4879.703 148.2382 8000 820.7614 25.74744 5854.994 185.6159 9000 971.8386 31.84307 6849.33 222.3924
  • 7. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 35 Table 6: Mean and SD of no. of comparisons for fixed p=0.5 and N varying from 3000 to 9000 LINEAR SEARCH BINARY SEARCH Linear Binary N MEAN SD MEAN SD 3000 130.1014 7.00651 972.08 21.59409 4000 264.1129 8.887761 1980.031 42.77784 5000 415.3614 13.31927 2928.61 77.99048 6000 588.0328 18.06139 3899.347 112.9273 7000 756.0186 24.04293 4844.13 148.9676 8000 924.8 26.66672 5850.78 185.8966 9000 1121.763 36.24661 6819.733 222.2228 Table 7: Mean and SD of no. of comparisons for fixed p=0.8 and N varying from 3000 to 9000 LINEAR SEARCH BINARY SEARCH Linear Binary N MEAN SD MEAN SD 3000 115.6329 6.243703 1018.141 21.48802 4000 245.1214 8.52181 1985.369 44.04666 5000 393.5871 12.7249 2975.52 78.13666 6000 550.3929 17.45485 3982.537 114.5793 7000 704.8671 22.51765 4990.81 152.1838 8000 856.3285 27.90663 5981.506 189.8659 9000 1041.273 33.69814 7011.628 227.1954
  • 8. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 36 Table 8: Mean and SD of no. of comparisons for fixed N=10,000 and p varying from 0.1 to 0.9 LINEAR SEARCH BINARY SEARCH Linear Binary P MEAN SD MEAN SD 0.1 146.4986 8.256072 1007.9 21.96101 0.2 312.5357 9.884373 2030.541 43.94901 0.3 488.8714 14.8072 3028.646 79.62766 0.4 683.6443 20.83033 4020.094 116.2303 0.5 887.1243 27.49452 5019.079 153.6259 0.6 1076.687 34.59078 6050.274 190.9012 0.7 1289.791 42.12352 7076.607 229.6028 0.8 1460.953 49.30895 8077.373 268.2914 0.9 1601.191 55.57834 9095.618 305.9862 Fig. 1 Plot between N and Mean Comparisons for linear search (p=0.2)
  • 9. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 37 Fig. 2 Plot between N and Mean Comparisons for Binary Search (p=0.2) Fig. 3 Plot between N and mean comparisons for linear search (p=0.5)
  • 10. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 38 Fig. 4: Plot between N and mean comparisons for binary search (p=0.5) Fig. 5: Plot between N and mean comparisons for linear search (p=0.8) Fig. 6 Plot between N and mean comparisons for binary search (p=0.8)
  • 11. International Journal of Computer Science, Engineering and Applications (IJCSEA) Vol.2, No.2, April 2012 39 Fig. 7 Plot between p and mean comparisons for linear search (N=10,000) Fig. 8 Plot Between p and corresponding mean for binary search (N=10,000) References [1] Knuth, D. E. The Art of Computer Programming, Vol. 3: Sorting and Searching, Addison Wesley, (1997), 3rd ed., 396-408 [2] Kumari , A. and Chakraborty , S., Software Complexity: A Statistical Case Study Through Insertion Sort, Applied Math. and Compu., vol. 190(1), (2007), p. 40-50 [3] Kumari, A. and Chakraborty, S., A Simulation Study on Quick Sort Parameterized Complexity Using Response Surface Design, International Journal of Mathematical Modeling, Simulation and Applications, Vol. 1, No. 4, (2008), 448-458 [4] Downey, Rod G.; Fellows, Michael R. (1999). Parameterized Complexity. Springer. [5] S. C. Gupta and V. K. Kapoor, Fundamentals of Mathematical Statistics, Sultan Chand and Sons, New Delhi, reprint 2010