cs 284 - Set 1: 2.3-? tr Describe a Btnlgnj—time...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Set 1: 2.3-? tr Describe a Btnlgnj—time algorithm that. given a set S of n integera and another integer .x. determines whether or not the-re exist two elements in 3 whose stun is etttt-zttl},r .t. $.54 Give an UEnlgkj—tim': algmiliun [a merge I: sorted lists it'ttn one sorted list. where fl is the total number of elements in all the input lists. (Hint; Use a min- heap for lit-way merging.) Set 2: 2-4 Int-anions LetAll..nlhea.nurrayufndistint:tmntbers. Il'i {jlntliilt'l :- Aljl.tl'tetttlte pairtt'Jliscnlledanhwrflnnofrl. fl. List the five inversions uffl'le my {2. 3. 3. I5. I}. b. What array with elatttents [mu-tenet [l.2.....n} handle must imrersium? How manydeeeithaue‘? e. Wtisflwmhfimtflphetwuenflrmnningfimeufinseninnmflandthe number of inversion: in the input my? Justify your answer. ti. Givenn algofithttt ttmtdetennimthenumberut‘irmium in any pennutntiut't en rt elements in at» Ign] wast-else time. (Hint: Modify merge tart} 5-2 AWL: qf d-my heaps A dwarf Jump is like a binary hup. but. [will]. one possible :xczptiml] nun-leaf nodes have d cl'lfldmn instead of! childml. a. Haw Will-dd you mprcscnl a.de hupin manly? b. Whmisfltcheightufad-uyhupud'nclcmlsinmrmsufnandth c. Uh: an effiniem implemenmim ufEX'l‘RACT—MAX in a d—fly max-lump. An- alyze immingtimc in tumsul'dmfln. d. Give an cfficicnt implemutim of INSERT in I d-uy nun-limp. Analyze its running til-n: in Imus of d and n. a. Gm. an effican implcmnminn of INCREASfivKEY'IA. i. k]. which first sets Ali] «— maxmli]. Jr] and Ihcn nil-dams the d-IIJI' [rm-heap 5mm appropri- ately. Analyze its running time in lermsufd' and n. ...
View Full Document

This note was uploaded on 12/13/2010 for the course CS 284 taught by Professor Jamess. during the Spring '10 term at Jordan University of Science & Tech.

Page1 / 2

cs 284 - Set 1: 2.3-? tr Describe a Btnlgnj—time...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online