6 views

Uploaded by sanchit-abrol-3458

- Analysis
- DAA NEW1
- ps1
- EECS Undergrad Manual
- Aflv 01 Introduction
- A Class of Single Machine Central Tendency-Arif Rana
- 1 Introduction
- MELJUN CORTES JEDI Slides Intro2 Chapter06 Sorting Algorithms
- paper_7
- Gawl Itza 09 Games
- Brochure
- Top 18 Java Design Pattern Interview Questions Answers for Experienced
- A Concise Introduction to Languages and Machines (Undergraduate Topics in Computer Science)
- Errata JCraig 3rdEd.060116
- ited.5.2.25.pdf
- UG Semester Syllabus Mathematics
- 01220054
- Full Text
- Control Engineering13
- 11simpmat2B

You are on page 1of 1

Problem Sheet 1

1. List the functions below from lowest order to highest order. If any two (or more) are of the same order,

indicate which.

n n − n3 + 7n5 n2 + lg n n3

2n lg

√n n2 (lg n)2

n lg n n 2n−1 n!

ln n en lg lg n n1+

n

X

3. Prove or disprove: i2 = θ(n2 ).

i=1

4. Prove the following. There are at most 2` nodes at level ` of a binary tree. A binary tree with depth

d has at most 2d+1 − 1 nodes. A binary tree with n nodes has depth at least blg nc.

5. Consider the following variant of Insertion Sort: for 2 ≤ i ≤ n, to insert the key L[i] among L[1] ≤

L[2] ≤ · · · ≤ L[i − 1], do a binary search to find the correct position for L[i].

• How many key comparisons would be done in the worst case? (using big-Oh.)

• What is the total number of times keys are moved in the worst case? (using big-Oh)

• What is the order of the worst case running time?

6. The first n cells of an array L of size N (much bigger than n) contain integers sorted in increasing

order. The remaining cells all contain some very large integer that we may think of as ∞. The array

may be arbitrarily large, and you don’t know n. Give an algorithm to find the position of a given

integer x < ∞ in the array in O(lg n) time.

7. We observed that a worst case for Insertion Sort occurs when the keys are initially in decreasing order.

Describe some other initial arrangements of the keys that are also worst cases.

8. Solve the following recurrences. Assume that T (1) = 1.

√ √

(b) T (n) = nT ( n) + n. (e) T (n) = 2T (n/2) + cn lg n.

(c) T (n) = T (n/2) + cn. (f) T (n) = 2T (n/2) + cn2 .

9. T (n) = T (n/3) + T (2n/3) + n; T (1) = 1. Show that T (n) is Ω(n lg n) using the recursion tree.

10. M is an n × n integer matrix in which the entries of each row are in increasing order (reading from

left to right) and the entries in each column are in increasing order (reading top to bottom). Give an

efficient algorithm to find the position of an integer x in M , or determine that x is not there. Say how

many (3-way) comparisons of x with matrix entries your algorithm does in the worst case. Is your

method optimal?

11. M is an n × m integer matrix. Suppose you sort each row of M in ascending order, and then sort each

column of M in ascending order. Show that after this the rows remain sorted.

- AnalysisUploaded byMADDY
- DAA NEW1Uploaded byManukumar
- ps1Uploaded byAndrew Adkins
- EECS Undergrad ManualUploaded bykliouliou
- Aflv 01 IntroductionUploaded byAbdelrahman Moharib
- A Class of Single Machine Central Tendency-Arif RanaUploaded byKhawaja Khurram Naeem
- 1 IntroductionUploaded byinfotecg
- MELJUN CORTES JEDI Slides Intro2 Chapter06 Sorting AlgorithmsUploaded byMELJUN CORTES, MBA,MPA
- paper_7Uploaded byDimas Benasulin
- Gawl Itza 09 GamesUploaded byKernel5
- BrochureUploaded byAtulya
- Top 18 Java Design Pattern Interview Questions Answers for ExperiencedUploaded byDenny Arshan
- A Concise Introduction to Languages and Machines (Undergraduate Topics in Computer Science)Uploaded byPaul George
- Errata JCraig 3rdEd.060116Uploaded bylinuxsoon
- ited.5.2.25.pdfUploaded byLê Thị Phương Viên
- UG Semester Syllabus MathematicsUploaded bykaais
- 01220054Uploaded bynvoronka
- Full TextUploaded bydglorifier
- Control Engineering13Uploaded byPisicuta Lavinia
- 11simpmat2BUploaded byPotnuru Vinay
- Scilab WindowsUploaded bysilpasivaram
- Intoduction to MATLABUploaded byiamarvik
- 16S-ME507-TH1Uploaded byulasates
- 22 NPUploaded bysazzad
- MATLAB Guide CompleteUploaded byOcelotBubbles123
- advt_135.pdfUploaded bySasidharan
- 1-s2.0-S0888327012000702-mainUploaded bygorot1
- Intro to MatlabUploaded byHesham Fadl-Allah Mohamad
- NewUploaded byinduraj_20
- Notes for Cive1620 Large Type Part 1&2 Full2008 4upUploaded bysjeyarajah21

- Syllabus CSE I-VUploaded byKhuram Wani
- Exam2Uploaded byhamz56787298
- Essbase DbUploaded byaparna
- COA UNIT 6Uploaded byAkash Agrawal
- Backtracking - Pass & Phase of CompilerUploaded byJoinKing
- Arm InterruptsUploaded bysampath
- Tutorial Bose Abstract BioUploaded byAdip Chy
- Machine Structure and Instruction Format MC68000]Uploaded byStessa
- Dehdari, Jon (2014) – Statistical Language Modeling-syllabusUploaded byDaniel Alva León
- lec01-intro (1).pptUploaded bydoomachaley
- Porting to ARM 64-BitUploaded byk_ij9658
- What is the Difference Between Model and MethodologyUploaded byRadhika Domal
- CH5Uploaded bysara_lolo
- FDP_Cryptography & Network Security BrochureUploaded byaishuvc1822
- jse6_ch1Uploaded byanandjassneet
- Threads Concurrency 7599599Uploaded bypermasa
- AI artificial intelligence.pptxUploaded byRohit Kumar
- CA 10 HomeworkUploaded byHadi Montakhabi
- Operating System TimelineUploaded byJean Ramos
- Software Engineering With Alm ToolsUploaded bycse.amran6583
- Characteristics of Virtualized EnvironmentUploaded byAnshul Pandey
- MeshingUploaded byGoutam Acharjee
- Analysis of Various Algorithms to Solve Vertex Cover ProblemUploaded bySergiu Pușcaș
- Introduction to ProgrammingUploaded byA. M. Anisul Huq
- Masroor Resume_NCSU (1)Uploaded byMasroor Hafeez Mohammed
- Lecture 6 Dynamic ProgrammingUploaded byBhaskar Mitra
- PRNG CA Pasqualoni asmUploaded byRickey Bowers Jr.
- software engineering at ETH ZurichUploaded byeunaosoudesleal7223
- Super Scalar ArchitectureUploaded byrboy1993
- Interview Questions for Engineering Final YearUploaded byVinoth Rajaguru