0% found this document useful (0 votes)
14 views

Java 1

java questions

Uploaded by

yswami112
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
14 views

Java 1

java questions

Uploaded by

yswami112
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 31
DSA o +2 fat mal] = $2,3,4}5 Sy0 (rump iTS 5 -~=——S > annoy rene en, 3 [ss J F_Arsays 194 type gp Ost Fe stone clake Staking with 0,',2.. - ts diva and C14 inden shod With O al Deginatian fo eee eines ab poate / A List off clements of the same type — placed fy, Conbiguans peer lecatven, O conti rane alts after another ex — — ma 0 N54 Sig A Seze of 2 fee 77. ditpieve os | TALS i abet HFS a vokble which have So Sub- Vasitbles we Operations an pues See + Cuealt. on Aviary. ; “Take Tye nay tlmeL ] = new callypel steels s ve. e tat make LT = new tot [So] - | 3 So talegeres ex- int oumber Ll] = men 11,2, 5 > 3 tegers fat cum J = fad, ots 3 iaeqes Shing forests ET fete “saoge'p|> 2. sbrtegs . Wane clemenb ane glened henit . automalic ancl Sex store ; He | BAF we made an aiay in maa fuurtton oo Arc weed tein analber gmalt farcion ound update ft thene, then 41s value ane charges fn main fuvckion. * UA update tat masts EDS for(eatP =o ¥ dane otevgth iw f Vaid enctin CBateg aglDg fk mack C] nee 11,99,99) » f he te “Tinse Conelesty > Coe token by the algortthen tO execuje Cach get ot inglswelfan , He Space Complectty > THis he amaunt ot oe i etesepndlt A taken wget, Ie of “en lene of the Input. x They both one fake O50 meaauier fo choose tre. beat” algorithm to Solve a porltoulast Problem | # Linea Eeauch dis a type ob teaneh to a = search a alemeril in an ex~ @ 2 AS c ee Gara 9 suites Pica Key = 10 key =te 6 al index 4 “thed mearn 10 gek xeon no. 4 2) that cseuny on = f Q foncion —(nambows J, key) f 4 for(int P= oF PZ rumberes length 5 raf i 16 (Key == swab }) {noha 15? : setunn —1 5 main (sting a rt) $ Trt numbers [J = §24,52 Jo, 12,4 \6)- F tok bade 4 on 89 , Healing the purckion Ob index = @q Ui near geatth Cmumnbors , key) t¢ [index = - )$ Supe “Net found "h; mise i spe " “The Mee Gat "+ Fader D F io get at java ORTox j = y =e9 (ésrabest no.) 3 Frteqex. min VALE 3) 4 oo Cesigest ro) Trtegene MAX_ VALUE Si L est Number fn an a o Peewcle Code. 3 Coe € @eth no. zi Yt mate a fnteq en Tange aoe give value Sea | fn a for loop Atk a Y eee F else and campare each me number ad nen charge the dasygest tat te the Aovges t ho. in toneey: PX Asked en Gale euun aad Peosicl ead’, is Binary OOO “4 teats. ly 1B a seach that we clo fo geanch worcls ° in dice enary i “4 b Prenequiste > Sented, Aroiay [ae Eisai order, TP ee wa Pee as oe end ah then éind md, d: i) dh xequoted Key fs greater than mid key > mil > take gus Mite Key < mich ih “ ls End & Same, Stor = mide Find the neo meal take LHS ae Hs $5 ts Same. Erd 3 mtd =t sj i) ict a and Find the nes fal ancl then Same prtocear pepeat ard then game Pserclo cle > ae bed = 0-1 he (Stat 2= end) 4 4 2 te mid = > 3) Compare mid & = 4) _ kex >. Found Miah seas ta > Ry le mag end & PK take Left cide wecegl i Ae Iopartect | x wWle a ay tathe paxameley oudgtt 't watte/cy Se aE Minas Sate Cinh nam [5 key) ¢ / (© Tine Coast oh Binary Seas THeution 4 > n 3 4 n PE au ron \5 oh 3k Sn=2 ne Nee loa rit te [ks der : TO% leg. n yead j e Rie ones SY Poius 8-8 Cres, / | Gieeesrsenes\ > [3.9] fod example => n=3 wt Ls Bes nee L L Ad nd osx | OCs) > oC*) tn a HF Revewne an Duss y We wlll soverse The ever Suman’, thes Valuer - “d ‘ J A take stad and and ti) Sup Hedy valten iil) glade +4, end] id) susap thesdt value YORU gods end Po Ses on Asse (24,6, 2h gp SS LAP TR, eS (2.4) ,[2.6], (2, 9)02 0] fs Cea G63, C48], Cavs = SD Nested Loops. | 6/8), Cb; 1 § ; (4) 7 {0) | forlot ao Jo f (8,19) ; A pwkd i Cor (tot } = te fo i favs 0 Rme. Coupleecity 5 O(a") balled = Seb quays 5A continoeug fort of suiar. | & (Baier) 3 8.8 EME clam . . ° Pseudo cade. oe eke ind Jz tee ton) ys a wy © e__ complent hy (ema) Sn —— 3 Eos, (ema) = 78 3[ 00-9) , ee ey San (a reser] —» [Ts [eTule] ee. ee . ee cusnmulad Pe soem FNow te get any adding alk te behind “ ae ‘Bd tou eeX- gnaw FD toedie a} treba] Fixe bx [enaj- pxebis] stank —1] > fai \ tai) 7 [ee o} = 93 -\ FD+ SBtrG is J a3 puebx [oJ = =m Gor(int 121 5 TA prebirdength 5 Te) f eset 1} = che (| + ram (FT j + (nd) aw] (+e) sega tax _Jub KADANE 's) Lie Sthanit (karan aes Peet Gen ey (+e) + Cv) « ZA \ So take th Od. Zestal # Wigner Be > Hg ag bests givens On co 04 [2.20,6, 32,5] Sheet | Ant IS non -nec etive & in elevalian meant ) waddh af each boot e¢ 4), Comput por much taker ft can tmp e sere An | eae D> Volume of > a agalen sa >> or 21+ orzisro= U Faal sage water > FH esome Cxtseme CAKES eS pa: : WW. wale, bie Ey @ vi bars ane tn atcencliing ee Aeceencli? ng orwley | ar . 7 Posie Awa Ss Helper Asay = >) ake com of (obt max howrdiey > Mrut Sy C618 | U Meke asia Plght max bound 2 wi) “They dare the moh ef pom Hight and Lege boundiey, VW) Mines the height from the min b . vy) And you will get Yor water ( 4 ve s [ayeleitemel) uid FE we uslll cqlutate night Max fuom stight aruscaxichs | * Samemenneplenrs = Of) ‘ Most opH mum wumy to solve ts a ons & Sold stocks profeh = aplty ~ iy pate, vor max Me = 0; Vast pruce = +00) Fan! was pool : - er the lowest buyfag (" = Selling pute — ts fot pute = MOK tle } Cht=0 Ain of =) ie 5 ae eC bay Palice Selling price) £ coreg |? Time Complen FY a ene 2] be. P= SP pp i Ondy ane foo p beds g puchit mad Bar pt n el ° Belse Cay price 5 saling pudf O(n) Bud Pate = sellicg price | CH sent putee Case 2. | A Rome_cwarck ; aah tal = Avey nom [1 2,8,1] Byuche fon Uakt=0 , tak 2 nam-tenghn , Tee) BC iat BE LS pam | Hime Com ples length, 7 » P Cocan’)) if Crumes| = aun OS) ¢ HOHWOT Ege 5 dee retin Gosee; t 2 We just need to check Haat "som nuurbe se] sepealecd , 2 5 saat fake co number ancl see's tutepegbedlaheat, oe furclians Trbuit — o <— te udvole ainay wil} 5 Ares. Lait Cespe, 7 D3 7 be filled PROS. -_ o 6 ei xh, Fe Sroscltag. > anrgiag Tore be 2 poglen - oD Thi mudt be any aunarging onder o4 1b must be alecreass ng © | Bubble seit Satany a Mash. — * Selechion Seat | ames ‘al Hine comely ~S- Olat) = ae Bobbie, Sot $514,143 ,24 eaasees onl wey Tue 45t Poets aie PLZ 5 4h 3 2y oy ay, ° | ons : £5.48 is Seek orga 2A tuin ais sth rus "Hen bor 4 Btton [P Bat dA) uses \ x thes oar Sasa 2 ee Same = . will 4 | Pg Aisae | - 2345 = 4325 re TS deve wh eet compaxe | ws We 7 | knows Fes loge * ee a ate we will tied need er f we atl nee os fe lion > box (twos te 0-2) enema BP Cink foe © n—2-tasuns) Fass HE Palection dont pes! CFiete the Sma test (Pron, it fr Pet the G mn UNSos fed] arg) 3 Gee Bapp)a Be ) nas 9 saa] —e Pelton ce ened * eee Olid ee * | > \2,3164)] ee “4 L 2,3, 4(E] hl oa Santi >> Foak? loop 3 peck. ONO ~ ne Plement : BSecondiar> check aeh’le ucth ovens next : 5 : Plemen tS Smaller pr greater > Aod grven Hal’s clement a place Ard Puch te emedlest: one. Geeucasel. 7 3 Pex(P=o > re asus length iy vat pene rj ool italy j cetoeg-teayth i444 che cl, men = FO AAT s, 2 ohay Cay= 5 sel G4) £ 4 Ss] ae. a ni) Vantaa & re US test min Y BA) 4 gee min BL ake SS swore 3 secs tay they = ae Tay | S erautfne] = ~([auiy Ci] = Nexo oserausy ee Ld 1,45 34] A Ort = cub He puecesds goes on, s OO # Tnsention, Sout S Hose ase ust dake the GBiivst—elemend eb out any and falke et OS sosded -& then we will take. “= Home > tt BA Amen ter * sds then push it tn onward of 5 & 3 place fb in last pee iff No aucl then plase the Aebronty Morays, sort (ars) ~<— syntax Of logn) a= Yee Comp leacty } | | ee | Tero been & Se less Han coy atlas. me tr cont up to a dedicated fader cea [ Rove, coat lon, st, Ny — fedex nde but the ending fadex Paclusi ve "be sod Gb xot 2 knderos then Yau reed " seach oul thins F D> Aswery , So. 4 Ten % ull’ sot Hell a SpE CH pe Peale Mumba rus, © Qucenhi hi, ears be fasige: bub Pima a, foxx) ore CASE Le hci 2 apt us rake on #84 Hee null canals erection of the elermesd- oc Line peated / c ae cal a Fs ue / ese ft fades Scasang an te ror then Cann eran the element how many Linen efeabed, | Heplace | 9 “Theo, we urill pot -bael< the Clements \ io oH csugne) ils \ RED a 4 & HE Time Complen'hy O feorlat & 29 40 0) > Oln+ 1-99) fg (2 for(ize te maxno.[heoge)) Sadfing | 4 KN tte Conal » J aa Conta’ re fee epeeespicds ny Must sat camels ftom se > @ Came it ebocset) 5 Rage > qt wat be the Longest Whee — Sou POD Aas. Uefa There ane = tat OU CIL] = neo tat [3] [s]- 50,40 Doserays & metas. [eng th m™ Koved dromus Pot Tals ~ luna He 20° ruray> _ 19 memes ea > How major melhor re | ened No.of Cobiey 101 04 10g Se | os? (ray | ne né rZ20 aes > Colima maton So Maen Ferg Tate Cages es Dy (Baal PB TL stores ab tHuee Uffuert astiory on Tt - + ly Jz) lee GT 3] — | WEE Ast] _ = FH Seah Mabe, (oon) iz sees > A mabe ull be given Ger need to pote (Eta gpthal warp - ex - prasptliany 29 00 That clement | feet PE ( shot tow - ethen)g] break; bolo (2 ° = L'2\1@ (steer Col = End@J) £ bsegk - 4 J legd 3 > (2,3, 4, F,12, 16, 1S) 14,13, Gy $,6, 7, Wo Ap eecer , MDedue 4 varibles. - For outeridemenis Fox fanex tatend | fant ou(e 6 ; ges) setnas ° Ending sasolt (e-) 3 7 ere ° Stasi colony } ‘ ° End Esloawre? et ce9 [p-i) 3 B.. ton a = aE furontle( > {) beret —> sR be > End Colum] Aa — (SR+1- BEY Ecw | bottom parte ——> cP aS Sty ERW [—sc | a) lefk poet §_5 sev — ‘ae —> Rt | | 3 tron we urill update bouduaie,, ade again while loop wahele(” stent ( Excl Column! AP Ress Enclhey) gee iim Tk so << — Tis Spctthed, snanycqane {wood Ha fag matotir . Le 3x3 FEEL niddle matytx shauld not be leper’ Shald not be Pinted nepetedly . 2 tal, sum Sais "A i“ hod HE Paboreoty Ai goal FOALS OF Pe maker, lergth ; fee) § for, - Oj PA mabstic Lo]. derg tes 44 § eC ef) £ Somes Sum + Mabie IEA # Seeanclary dfarnk fort (\ - JY CHEM, +t (f= 0-)E te (taj) featine2 | Sum = sume abe LIC] 2 te eeceplion -; ps 3 Add a condfhion t secondary medstir if (=s)f Po atte ¢ 3 Company oXecka HE Seach fa sosclecl Mater Gs) fe, >. pen=t) | “O key < cell value = iMectton —S Le a0 tO > coll velit > Bottom ee Gora ely in How wise. and column uctee_ Sostech met Hite Hien ever there will be Some extsa 9a lounetio Nn will be given en Question 2 100 1 fou “Apt roach _ ee OD Bute force Fox examphe bene > ©( 4) > Herne tr thls guest's, if sate thot the matrix is soled How and cal beth alge {ype of to fasonadion soo") fot some use to Heduce the Kine a SBRER. complenct fy ® Roni iuitsé, - ae, seasch) Oseagh Key Sous ~he > Ol») Tela Rone Comp loxley ) dinectfon 5 RY Fos seco Hew poe & FThan pase of malty Cho Staings ane “IMuTABLE y, Thee Coreen Hiatal, : Changen Can not ie male in them onee & Sliag ts Rxeate ch. 9 We abuses neecl te: ‘cHeate New, | meke a change tn stoaiag S Sten-ey-~ge-z new Seannes; (Bishi sto), 7 fy Sting name , output: Sic F Teng Stowe Lea a Wame ; Tony Name Ente 4 long Stevi ae) “Tous shuk. @ Stating a class Steg abs = ing 1 Oto take out lng a stocky toe Str. lengin) as f= (G& fed o Joining tees ‘e ex Stila OS estNare = "wanda" - Shug — = "Tole"; , Stsding fall BiswstName + oN GalWlame ; sept titlin Babpal ? Mandaw “Tole FEF, exe pein single aifonk a Stodig CL om Sh = Nabed yj | : N ay £ Check aldadanme.. >exoree- A Guportout| pacecan 3 Cemnpare fap (P and of] - void boolean) S fos = (R=) bo od ae e(t -Ls nt D) foen ~ m e tt ts not Zann zw. Sioturn ae oo 3 Mehuey Cals a, 2 SA es ee tame Q.. Bharbest Fath > Roukeodaing 4 staat (Ew), 8) Df (Uwe ENEoF NAW" | Ww f E : s , NT yet +} Cede disloce 3 oadd] § y ¥-- [CRG BF eee > Joe Ee a Jatt i fee Cee a ol > “am BialtGa oll alnags be" zee we know % padrssnst (2192) —> Flo fon (tar © to paths login) chat _atsechon = = path» schox ht U3 # Tine Geely » Liver Gor top boro ees 3 Ot). He Cupena Basing Funelion op fide Bei = en v : owe tak Stung 62 = “Tong! . c o < tak tating S3= new Ststbay ( Tary"’) » ef Ig (5: = 82 3 Syse(si= se) 2 SSN 6 . Tt ( Ss) 3 sso ( 8, =S3) 5 § elses Sypo(si#59);) Bubp gis, - Si FS O new place Gor ster othey vfse TE > became ashen we use ew strung ig makes | j only painh tonords “She old al Ging . | — + Te see one they touely equal. ule ‘ase, ene tx F( st equalal’d)§ eyso(s,-a0) 2 Quudput 5 9, 55 Es Gundion che | the value Crsidle. he thdags Cn Boge! Helle, woxlel A Sebsttag. tx fox (7-0 0 2) skal Usa Sips clon ati) ) ; z Output >. 3 Hel # Question $3 Pairk Largest p Stoting Lexicoguaphic Ondex > 8 Akash, actil, Mandar & adi[a] hee as‘ a trexe ts ol # F651, akash } ster a arc tl. compare To(‘stxe) Manday d& smaller heve. ok AF 4q ve 6 a thy = i en sbetig Sh l< sy 2 # [sm Cor pane lo Trove cone /“Sto2) | here A And q toeatecl Same | . Aes eh Time completly 5 Compari’san (Lefer to letter) X= 10: of tellers FH drat ane stutngs 7 Sites sty 4d = Stoxtng Sh 2 = | Stoieg pool faleun poof Stated gly = Tony fon Chaneh =a ; ch a= 2 5 chit) $ stit=ch 5 hee new sithrg uf be Heated Cael fine ancl ow st name. aul Pott the new sttding ¢ fo Cach dey 3 é > ese the Hme complerty Ys $0 bad because in Stern Mee ded bs Copsey fem the. Pate Shing wae = Obnren) Reap 2 (0?) fe ESB Se) Stotlng hutloley HE Sthifng butlden > “es sheng but mane gaat / 4 Convex serena aa ; Integer a= toy A Go foSI 91g by 3 4 hn eb class ** te fn — ve have b= mop Se elise Sb = ney Stotbog Butldey (1 By rE + Pont 10 PCM salabupe) 4, fs adil Siecle b on oO ex Sb apped (1) 5 chine a ettiog DP] StAfng Bully Tre _complerity =) Ot) © (29) this fess then the stsetag. # Bucerdfor— Codle Kaban | SD For a given Ststug conved each Set clellex of each tod fo sppercare, U pe ° et am marday ! oxi : hello World 7 DS HL Am Mandan" 3 Helle Wasdel” Ys a Chaxackex, to UpperCane (ch) 5 Feueat dvand start 4am P=o ard each new urdu eta ono ae ee next stretng after one a Time complatty 3 (,, AE Sur Neskion Example 3 “aaa bb ccald " “Sate Gogitrd a3 bs cade but 6 abede Sai ble CV Sar ai ti fe a clans of Toleget dada Lye ft gan be ured am sbding, decarnps ese x Lime compleyit = 4 we we She apperd | re dé vot then Ole) TH neplace Gurchion Cx- Sbiyrst, = " Ae Manele t a ee Pstx.seplace ("a Z ty) L3 Capa > mrs Mondo, & Converts Stalag fe chaneckex HRD © | Asay. Sosct(atayt) ¢] 5 sod the ox F Aoagsasn 3 ex-G earth , hear G srace 7 COHE. 304 2 Covet the stafngs fo lowen Cone + ® chede £0 the lengita axe come Cotton) © @ charge the tp e meese Lo eeaO) o &) Sout the both © ©) Compre the g Ob some ptee(4p, o ongten) Tarstg sina “atede # Ge aes abede 2 i ez ef wit)) ms spe TABCO 5 oe ve ane net Padises Substitieg FanPost ee leat | (Tyee 43. shy cm oaain( a8) 3! AB? Mat frcuclec (x. PE 2 > ott substiiug {) SD ’Bc DE! oh 7 "4 € Titexe atomahital Mi bb} elemecd % Sbies under ae aS 9 { Sl. Concat su sees epreee | wily + Beam behind PFE 6 > “a ball fs cphece ” 3) [s. conkdna() 2S thee Deakbe all deemed of $2 ee Ovdilable & gy Slarnol,

You might also like