Comprehensive Viva Voce

download Comprehensive Viva Voce

of 78

Transcript of Comprehensive Viva Voce

  • 7/24/2019 Comprehensive Viva Voce

    1/78

    COMPREHENSIVE VIVA VOCE

    Design And AnalysisOf Algorithm

  • 7/24/2019 Comprehensive Viva Voce

    2/78

    Divide And Conqer

    Divide"ro#lem into several smaller s#"ro#lems Normally$ the s#"ro#lems are similar to the original

    Conquerthe s#"ro#lems #y solving them re%rsively &ase %ase' solve small enogh "ro#lems #y #rte for%e

    Combinethe soltions to get a soltion to thes#"ro#lems

    And (nally a soltion to the orginal "ro#lem

    Divide and Conqer algorithms are normally re%rsive

  • 7/24/2019 Comprehensive Viva Voce

    3/78

    )* Divide and Conqer +or,s ona- .o" do+n a""roa%h

    #- &ottom " a""roa%h

    %- &othd- None of these

  • 7/24/2019 Comprehensive Viva Voce

    4/78

    Ans is A

    .he soltion to ato" level instan%e ofa "ro#lem is o#tained #y going do+nand o#taining soltions to smaller"ro#lems*

  • 7/24/2019 Comprehensive Viva Voce

    5/78

    /* Divide and %onqer is e0%ient fora- Sorting ,ind of "ro#lems

    #- Mlti"lying large nm#ers

    %- Synta%ti% analysisd- All the a#ove

  • 7/24/2019 Comprehensive Viva Voce

    6/78

    Ans is D

    Sorting 1 merge sort$ qi%,sort

    Mlti"li%ation 2 3arats#a algorithm isa fast mlti"li%ation algorithm$Strassen4s mlti"li%ation

    Synta%ti% analysis 1 to" do+n "arsersAll the a#ove algorithms are designedsing d5% a""roa%h

  • 7/24/2019 Comprehensive Viva Voce

    7/78

    6* .he nm#er of %om"arisons made inan array %ontaining )7/8 entries sing#inary sear%h algorithm in the +orst%ase is

    a- /9:

    #- 9)/

    %- )7d- )/

  • 7/24/2019 Comprehensive Viva Voce

    8/78

    Ans is )7

    i- Co;$ at ea%h iteration half thenm#er of in"t is ignored* So it ta,esatmost )7 %om"arisons for the #inarysear%h algorithm to (nd the vale inan array of si;e )7/8

    ii- i*e*$

    log>)7/8-?)7-

  • 7/24/2019 Comprehensive Viva Voce

    9/78

    8* @hat are the %orre%t intermediateste"s of the follo+ing data set +hen itis #eing sorted +ith the Merge sort

    a- )9$)B$)7$/7 22 )7$)B$)9$/7 22 )7$)9$)B$/7

    #- )9$)7$/7$)B 22 )9$)7$)B$/7 22 )7$)9$)B$/7

    %- )9$/7$)7$)B 22 )7$)9$/7$)B 22 )7$)9$)B$/7

    d- )9$/7$)7$)B 22 )9$)7$/7$)B 22 )7$)9$/7$)B

  • 7/24/2019 Comprehensive Viva Voce

    10/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    11/78

    9* @hi%h of the follo+ing is alse a#otmerge sort algorithm

    a- It is a %om"arison sorting algorithm*

    #- .he nsorted array is divided into s#lists$+hi%h are in trn divided into mores#lists*

    %- .he nsorted array is divided into s#lists$

    ea%h s#list is then sorted re%rsively #yre2a""lying the algorithm*

    d- All of the a#ove statements are false

  • 7/24/2019 Comprehensive Viva Voce

    12/78

    Ans is #

  • 7/24/2019 Comprehensive Viva Voce

    13/78

    :* An array has indi%es ranging from =to =n the merge sort +old #ea""lied from % to =n$ +here % is

    a- is the remainder of =F/$ if = is an oddnm#er

    #- is the the non2integer "art of =F/

    %- is the integer "art of =F/

    d- is an integer %hosen ar#itrarily$ so long thatit is smaller than =n

  • 7/24/2019 Comprehensive Viva Voce

    14/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    15/78

    G* In this seqen%e$ )) 8 /7 89 6/ :7B G7$ +hi%h element seems to #e the"ivot

    a- G7

    #- /7

    %- B

    d- 8

  • 7/24/2019 Comprehensive Viva Voce

    16/78

    Ans is &

  • 7/24/2019 Comprehensive Viva Voce

    17/78

    B* .he time %om"le=ity of Strassen4smlti"li%ation algorithm is

    a- O>n/*B7G-

    #- O>n/*6G6G-%- O>n6-

    d- None of these

  • 7/24/2019 Comprehensive Viva Voce

    18/78

    Ans is A

  • 7/24/2019 Comprehensive Viva Voce

    19/78

    Jreedy Method

    In a greedy method +e attem"t to%onstr%t an o"timal soltion instages* At ea%h stage +e ma,e a de%ision

    that a""ears to #e the #est >nder some%riterion- at the time*

    A de%ision made at one stage is not%hanged in a later stage$ so ea%hde%ision shold assre feasi#ility*

  • 7/24/2019 Comprehensive Viva Voce

    20/78

    A method that do not garantee ano"timal soltion #t hel" ma,ede%ision on lo%al o"timm at ea%h

    stage ho"ing to lead to glo#alo"timm is

    a- &a%, .ra%,ing

    #- 3na"sa%,

    %- Jreedy Method

    d- Divide and Conqer

  • 7/24/2019 Comprehensive Viva Voce

    21/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    22/78

    * or 7F) 3NAPSAC3 "ro#lem$ the algorithmta,es KKKKKKKK amont of time for memoryta#le$ and KKKKKKtime to determine the

    o"timal load$ for N o#Le%ts and @ as the%a"a%ity of 3NAPSAC3*

    a- O>N@-$ O>N@-

    ) >N@-$ O>N@-

    %- O>N-$ O>N@-

    d- O>N@-$ O>N-

    e- O>N@-$ O>N@-*

  • 7/24/2019 Comprehensive Viva Voce

    23/78

    Ans+er ' >#-

    i- the memory ta#le > / 1D matri= -%ontains N ro+s and @ %olmns$hen%e it is N@

    ii- the %om"osition of the o"timal loadta,es " to N@ time

  • 7/24/2019 Comprehensive Viva Voce

    24/78

    )7* .he o"timality %ondition for 7F),na"sa%, "ro#lem is

    a- "i =i 1 is ma=imm

    #- +i =i %%- &oth

    d- Only A

  • 7/24/2019 Comprehensive Viva Voce

    25/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    26/78

    ))* Identify the MS. o#tained sing "rims algorithm

    a- >)$:-$>:$9-$ >9$8-$ >8$6-$ >6$/-$ >/$ G-

    #- >)$:-$>:$9-$ >9$G-$ >G$/-$ >/$6-$ >6$ 8-

    %- >)$:-$>:$9-$ >9$G-$ >G$8-$ >8$6-$ >6$ /-

    d- >)$:-$>:$9-$ >9$8-$ >8$G-$ >G$/-$ >/$ 6-

  • 7/24/2019 Comprehensive Viva Voce

    27/78

    Ans is A

  • 7/24/2019 Comprehensive Viva Voce

    28/78

    )/* Identify the MS. o#tained sing 3rs,al4s algorithm

    a- >)$:-$ >:$9-$ >9$8-$ >8$6-$ >6$/-$ >/$ G-

    #- >)$:-$ >:$9-$ >/$G-$ >G$6-$ >6$8-$ >8$ 9-

    %- >)$:-$ >6$8-$ >/$G-$ >/$6-$ >8$9-$ >9$:-*

    d- >)$:-$ >:$9-$ >9$8-$ >8$G-$ >G$/-$ >/$ 6-

  • 7/24/2019 Comprehensive Viva Voce

    29/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    30/78

    )6* DiL,stra4s algorithm may notterminate if the gra"h %ontainsnegative2+eight edges

    .re

    alse

  • 7/24/2019 Comprehensive Viva Voce

    31/78

    Ans is alse

    It al+ays terminates$ #t may"rod%e in%orre%t reslts*

  • 7/24/2019 Comprehensive Viva Voce

    32/78

    )6* &ellman1ord algorithm %om"tesshortest "ath for gra"hs +ith only non2negative edges

    a- .re

    #- alse

  • 7/24/2019 Comprehensive Viva Voce

    33/78

    Ans is alse

    &ellman1ord is sed "rimarily forgra"hs +ith negative edge +eights

  • 7/24/2019 Comprehensive Viva Voce

    34/78

    )8* @hi%h one is tre

    I* In the 3rs,al4s algorithm$ for the %onstr%tion of minimals"anning tree for a gra"h$ the sele%ted edges al+ays form aforest*

    II* In Prim4s algorithm$ for the %onstr%tion of minimal s"anning

    tree for a gra"h$ the sele%ted edges al+ays form an or%hard*

    III* DS$ &S algorithms al+ays ma,e se of a qee$ and sta%,res"e%tively*

    >a- Only >I-

    >#- Only >II-

    >%- Only >III-

    >d- &oth >I- and >III-

    >e- &oth >II- and >III-

  • 7/24/2019 Comprehensive Viva Voce

    35/78

    Ans+er ' >a-

    Reason' In the 3rs,al4s algorithm$for the %onstr%tion of minimals"anning tree for a gra"h$ thesele%ted edges al+ays form a forest*

  • 7/24/2019 Comprehensive Viva Voce

    36/78

    )9* Hmann tree are sed ina- niform length en%oding

    #- Varia#le length en%oding

    %- Com"ression algorithmsd- &oth # and %

  • 7/24/2019 Comprehensive Viva Voce

    37/78

    Ans is D

  • 7/24/2019 Comprehensive Viva Voce

    38/78

    Dynami% Programming

    Dynamic programmingis a method forsolving %om"le= "ro#lems #y #rea,ing themdo+n into sim"ler s#"ro#lems*

    a""li%a#le to "ro#lems e=hi#iting the"ro"erties of overla""ing s#"ro#lems ando"timal s#str%tre

    overla""ing s#"ro#lems means those

    "ro#lems that %an #e #ro,en do+n into s#2"ro#lems and the soltions for +hi%h are re2sed several times eg*$ i#ona%%i series

  • 7/24/2019 Comprehensive Viva Voce

    39/78

    O"timal S#Str%tre means o"timalsoltion to a "ro#lem is o#tained #ythe %om#ination of o"timal soltion

    to its s# "ro#lem eg*$ .he shortest "ath #et+een t+o

    verti%es also im"lies the shortest

    "ath #et+een the intermediateverti%es too

  • 7/24/2019 Comprehensive Viva Voce

    40/78

    ):* .he "ro#lem solving strategy that(nds the o"timal soltion #y ,ee"ingthe #est soltion fond " to the "oint

    is %alled a- Divide and Conqer

    #- Jreedy Methods

    %- &a%,tra%,ing

    d- Dynami% Programming

  • 7/24/2019 Comprehensive Viva Voce

    41/78

    Ans is D

  • 7/24/2019 Comprehensive Viva Voce

    42/78

    )G* Ho+ the Dynami% "rogrammingmethod diers from greedy method

    a- De%ision seqen%e that hasgenerated

    #- Prin%i"le of o"timality

    %- #oth a 5 #

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    43/78

    Ans is A

  • 7/24/2019 Comprehensive Viva Voce

    44/78

    )B* @hi%h among the follo+ingalgorithm is sed to dete%t +hether areglar e="ression is a%%e"ted #y a

    (nite ma%hine atomataa- Prim4s algorithm

    #- 3rs,al4s algorithm

    %- &ellmann and ord algorithm

    d- @arshall4s and loyd algorithm

  • 7/24/2019 Comprehensive Viva Voce

    45/78

    Ans is D

    @arshall and loyd algorithm is a,a all"air shortest "ath algorithm

  • 7/24/2019 Comprehensive Viva Voce

    46/78

    )* .he time %om"le=ity of o"timal#inary sear%h tree %onstr%ted singdynami% "rogramming is

    a- O>n-

    #- O>n/-

    %- O>n6-

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    47/78

    Ans is C

    O&S. is an algorithm that is sed forthe %onstr%tion of a tree +hi%h hasminimm sear%h %ost for ea%h ,eynode in the tree

  • 7/24/2019 Comprehensive Viva Voce

    48/78

    /7* An O>n/ /n- dynami%"rogramming is for +hi%h Pro#lem

    a- &ran%h and #ond

    #- 7F) 3na"sa%, "ro#lem

    %- .ravelling Salesman "ro#lem

    d- None

  • 7/24/2019 Comprehensive Viva Voce

    49/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    50/78

    &a%,tra%,ing

    &a%,tra%,ing is a general algorithmfor (nding all >or some- soltions tosome %om"tational "ro#lem$ that

    in%rementally #ilds %andidates to thesoltions$ and a#andons ea%h "artial%andidate % >Q#a%,tra%,sQ- as soon as

    it determines that % %annot "ossi#ly #e%om"leted to a valid soltion

  • 7/24/2019 Comprehensive Viva Voce

    51/78

    /)* Rles that restri%t ea%h i to ta,eon vales only from a given set is

    a- Im"li%it %onstraint

    #- E="li%it %onstraint

    %- #oth

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    52/78

    Ans is &

  • 7/24/2019 Comprehensive Viva Voce

    53/78

    //* @hi%h algorithm determinessoltion #y systemati%ally sear%hingthe soltion s"a%e for the given

    "ro#lem of instan%ea- &a%,tra%,ing

    #- Dynami% "rogramming

    %- &ran%h and #ondd- none

  • 7/24/2019 Comprehensive Viva Voce

    54/78

    Ans is A

  • 7/24/2019 Comprehensive Viva Voce

    55/78

    /6* .he sear%h for #a%,tra%,ing isfa%ilitated #y sing 2222222222 for soltions"a%e

    a- leaf organi;ation

    #- node organi;ation

    %- tree organi;ation

    d- s"a%e organi;ation

  • 7/24/2019 Comprehensive Viva Voce

    56/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    57/78

    /8* B t"les is a soltion to +hi%h ofthe "ro#lem

    a- 8 qeens

    #- traveling salesman

    %- B qeens

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    58/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    59/78

    /9* @hi%h "ro#lem does the follo+ingline #elong to

    Jiven n distin%t "ositive nm#ers and

    +e desire to (nd all %om#ination ofthese nm#ers +hose sm is N

    a- #a%,tra%,ing

    #- traveling salesman%- sm of s#sets

    d- gra"h %oloring

  • 7/24/2019 Comprehensive Viva Voce

    60/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    61/78

    /:* @hen a gra"h J %an #e %olored ins%h a +ay no adLa%ent nodes havesame %olor yet only M %olors are sed*

    @hat "ro#lem does the a#ove linerefer

    a- %olora#ility de%ision

    #- %olora#ility o"timi;ation%- #oth a and #

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    62/78

    Ans is A

  • 7/24/2019 Comprehensive Viva Voce

    63/78

    /G* @hi%h "ro#lem as,s for smallestinteger m for +hi%h the gra"h %an #e%olored

    a- %olora#ility de%ision#- %olora#ility o"timi;ation

    %- #oth a and #

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    64/78

    Ans is &

  • 7/24/2019 Comprehensive Viva Voce

    65/78

    /B* @hat is the smallest integerreferred to as in gra"h %oloring

    a- %olora#ility de%ision

    #- %olora#ility o"timi;ation%- %hromati% nm#er

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    66/78

    Ans is C

  • 7/24/2019 Comprehensive Viva Voce

    67/78

    /* .he soltion s"a%e for ,na"sa%,"ro#lem is

    a-//

    #-/:

    %-/B

    d-/n

  • 7/24/2019 Comprehensive Viva Voce

    68/78

    Ans is D

  • 7/24/2019 Comprehensive Viva Voce

    69/78

    &ran%h and &ond

    ive node is a node that has #eengenerated #t +hose %hildren havenot yet #een generated*

    E2node is a live node +hose %hildrenare %rrently #eing e="lored* In other

    +ords$ an E2node is a node %rrently#eing e="anded*

  • 7/24/2019 Comprehensive Viva Voce

    70/78

    Dead node is a generated node that is notto #e e="anded or e="lored any frther*

    All %hildren of a dead node have already#een e="anded*

    &ran%h2and2#ond refers to all state s"a%esear%h methods in +hi%h all %hildren of an

    E2node are generated #efore any otherlive node %an #e%ome the E2node*

  • 7/24/2019 Comprehensive Viva Voce

    71/78

    67* In a 82qeen "ro#lem the nodesnot leading to the soltion are ,illedsing +hi%h fn%tion

    a- &ran%hing#- &a%,tra%,ing

    %- Ran,ing

    d- &onding

  • 7/24/2019 Comprehensive Viva Voce

    72/78

    Ans is D

  • 7/24/2019 Comprehensive Viva Voce

    73/78

    6)* 3na"sa%, "ro#lem is +hat ty"e of"ro#lem

    a- Minimisation "ro#lem

    #- Ma=imisation "ro#lem%- O"timal "ro#lem

    d- None

  • 7/24/2019 Comprehensive Viva Voce

    74/78

    Ans is &

  • 7/24/2019 Comprehensive Viva Voce

    75/78

    66* In order to se "ro%edre C&& tosolve 3na"sa%, "ro#lem +e need tosatisfy +hi%h of the follo+ing %onditions

    a- the str%tre of nodes in the states"a%e tree

    #- ho+ to generate the %hildren node

    %- ho+ to re%ogni;e a soltion noded- all the a#ove

  • 7/24/2019 Comprehensive Viva Voce

    76/78

    Ans is D

  • 7/24/2019 Comprehensive Viva Voce

    77/78

    68* In 7F) 3na"sa%, "ro#lem %>- isre%rsively de(ned to #eminT%>CHID>--$ %TRCHID>--U

    a- feasi#le leaf node#- infeasi#le leaf node

    %- nonleaf node

    d- none

  • 7/24/2019 Comprehensive Viva Voce

    78/78

    Ans is C