0% found this document useful (0 votes)
145 views5 pages

Binary Search 27

Binary search is a specialized algorithm that takes advantage of sorted data. It divides the sorted data into two halves and examines the data at the split point to determine which half contains the target value. The underlying strategy is divide and conquer. Binary search is more efficient than linear search, with a runtime of O(log n). It works best on sorted arrays and binary search trees.

Uploaded by

hnikhra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
145 views5 pages

Binary Search 27

Binary search is a specialized algorithm that takes advantage of sorted data. It divides the sorted data into two halves and examines the data at the split point to determine which half contains the target value. The underlying strategy is divide and conquer. Binary search is more efficient than linear search, with a runtime of O(log n). It works best on sorted arrays and binary search trees.

Uploaded by

hnikhra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Binary Search

1. Binary search is a more specialized algorithm than sequential search as it takes


advantage of data that has been
a. Sorted
b. Not Sorted
c. random
d. none of the above
Ans:a
. !he underlying idea of binary search is to divide the sorted data into t"o halves and
to e#amine the data at the point of the split. !rue.
$. Binary search "hen compared to linear search is
a. %ore efficient
b. &ess efficient
c. slo"er
d. none
Ans:a
'. A search algorithm is an algorithm that accepts an argument a and tries to find a
record in the file "ith the primary key as a. !rue.
(. Binary search is a part of or used in "hich of the follo"ing
a. binary insertion sort
b. ideal search
c. suffi# array
d. all the above
Ans:d
). Binary search is a kind of **************** .
Ans. dichotomic search
+. ***************** strategy is a part of or used in binary search.
Ans. ,ivide and conquer
-. !he run time of binary search is *******
a. ./ln n0
b. ./n ln n0
c. ./log n0
d. ./n0
Ans. a
!he run time of binary search is ./ln n0 "hich is log n to the base e.
1. 2or finding the middle element in a binary search to avoid overflo"s the formula used
is ********** "here high and lo" are non3negative.
Ans. mid 4 lo" 5 /high3lo"06
17. !he mid element of a binary search can be found by using the relation
**************** .
Ans. mid 4 /high 5 lo"06
11. !he average successful search time taken by binary search on a sorted array of 17
items is *****
a. .)
b. .+
c. .-
d. .1
Ans. d
!he items 81989:.817 may be arranged in a binary search tree as sho"n
belo".So9to match 8(9the number of comparisons needed is 1;for 89it is 9 for 8- it is
9for 81 it is $ and so on.So9the average is /15/505/$5$5$5$05/'5'5'00617 4 .1


1. A fast "ay to search a sorted array is to use a **********.
Ans. Binary search

1$. 2or an array of million items9******** search operation is better than
************* search.
a. linear9binary
b. binary9linear
c. linear9fibonacci
d. none of the above
Ans. b
8(
8- 8
81
8)
817
7
8+
8$
8'
81
2or an array of a million elements9 binary search9 ./log N09 "ill find the target element
"ith a "orst case of only 7 comparisons. &inear search9 ./N09 on average "ill take
(779777 comparisons to find the element.
1'. 8n case of a binary search9the array must be ********** before it is searched.
Ans. sorted
1(. <hich of the follo"ing statement/s0 is6are not correct=
a. 8n sequential search9 the time comple#ity of an unsuccessful search is ./N0.
b.!he average case time comple#ity of sequential search algorithm is ./N0.
. c. 8n binary search9an unsuccessful search requires e#amining every in the array
d. 8n Binary search9 the time comple#ity of a successful search in the "orst case is ./log
N0.
Ans. c
1). >onsider the follo"ing algorithm.
/i0 >ompare the given Name "ith the Name in the middle of the list
/ii0 !his tells "hich half of the list contains Name
/iii0 !hen compare Name "ith the Name in the middle of the correct half to
,etermine "hich quarter of the list contains Name
/iv0 >ontinue the process until finding Name in the list
<hat does the above algorithm describe=
a. Sequential search
b. 8nde# sequential search
c. %erge sort
d. Binary search
Ans. d
1+.<hich of the follo"ing searching method runs most efficiently utilising the
memory for already sorted file=
a. Binary search
b. 8nde# sequential search
c. Sequential search "ith array implementation
d. Sequential search "ith linked list implementation
Ans. a

1-.!o search a single item from a group of - sorted items ho" many checks are
required in Binary Search
a.- b.' c.$ d.
Ans:c
Since ??4-
11.!o search a page number $)' in a book containing (77 pages "hich of the
follo"ing Searching technique should be used to reach the page in minimum time=
a.&inear search
b.2ibonacci search
c.Binary search
d.@andom search
Ans:c
7. >onsider the set of integers given belo".
9$9(9 +9119 1$9 1+ 9119 $9 1
Ao" many comparisons are required to search "hen key value is equal to $ using a
binary search algorithm.
a.1 b. c.$ d.'
Ans:c
2irst comparison identifies middle element 75164'.(
'
th
element is 11.

nd
comparison gives 11 and $
rd
$.
1.<hat kind of search is used in a telephone directory=
a.&inear search
b.Binary search
c.Aashing
d.none
Ans:b
. <hich of the follo"ing statements is6are incorrect in connection "ith the binary
search algorithm=
/a0 !he most efficient method of searching a sequential table "ithout the use of au#iliary
indices or tables is the binary search algorithm.
/b0 Basically9 the argument is compared "ith the key of the middle element of the table.
8f they are equal9 the search is successful; other"ise9 either the upper half or the lo"er
half of the table must be searched in a similar manner.
/c0 Any kind of data set can be used.
/d0 !ime comple#ity is . /n log n0.
Ans: c
$. Binary search algorithm "orks best "ith
a0 Arrays
b0 trees
c0 Binary Search trees
d0 None
Ans:c

'. <hat additional requirement is placed on an array9 so that binary search may be
used to locate an entry=
A. !he array elements must form a heap.
B. !he array must have at least entries.
>. !he array must be sorted.
,. !he arrayBs size must be a po"er of t"o.
Ans:c
(. <hat is the "orst3case time for serial search finding a single item in an array=
A. >onstant time
B. &ogarithmic time
>. &inear time
,. Cuadratic time
Ans:c
). 8f there are 1+ elements in an array9 ho" many ma#imum comparisons are required to
search an element using binary search=
a.$ b.' c.( d.)
Ans:c
+.8f there are $' elements in an array9 ho" many ma#imum comparisons are required to
search an element using binary search=
a.$ b.' c.( d.)
Ans:d

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy