0 Up votes0 Down votes

13 views3 pagesAug 06, 2011

© Attribution Non-Commercial (BY-NC)

TXT, PDF, TXT or read online from Scribd

Attribution Non-Commercial (BY-NC)

13 views

Attribution Non-Commercial (BY-NC)

- ISC Class XII Computer Science Project JAVA Programs
- Chunk Sort
- SORTING AND SEARCHING
- Sorting Article
- AI
- c
- SDA2_ern.ppt
- Asm Fundamentals
- Image Encryption Based on Inter-Pixel Displacement
- chap09
- Binary Search
- Cpds Previous Papers Questions 2012 Harsha
- IT AUG-11
- UT Dallas Syllabus for cs3345.081 06u taught by Ovidiu Daescu (daescu)
- BigOhBruteForceDivideConq
- Data Structures And Algorithms
- UT Dallas Syllabus for se3345.081.06u taught by Ovidiu Daescu (daescu)
- Chapter7.ans.doc
- Chapter7.ans.doc
- Merge Sort

You are on page 1of 3

In a selectionsort of n elements, how many times is the swap function called in the complete execution of the algorithm? A. B. C. D. 1 n - 1 n log n n^2

2 .Selectionsort and quicksort both fall into the same category of sorting algor ithms. What is this category? * * * * A. B. C. D. O(n log n) sorts Divide-and-conquer sorts Interchange sorts Average time is quadratic.

3 . Suppose that a selectionsort of 100 items has completed 42 iterations of the main loop. How many items are now guaranteed to be in their final spot (never t o be moved again)? * * * * A. B. C. D. 21 41 42 43

4 .Suppose we are sorting an array of ten integers using a some quadratic sortin g algorithm. After four iterations of the algorithm's main loop, the array eleme nts are ordered as shown here: 1 2 3 4 5 0 6 7 8 9 Which statement is correct? (Note: Our selectionsort picks largest items first.) * * * * A. B. C. D. The The The The algorithm algorithm algorithm algorithm might be either selectionsort or insertionsort. might be selectionsort, but could not be insertionsort. might be insertionsort, but could not be selectionsort. is neither selectionsort nor insertionsort.

5 .Suppose we are sorting an array of eight integers using a some quadratic sort ing algorithm. After four iterations of the algorithm's main loop, the array ele ments are ordered as shown here: 2 4 5 7 8 1 3 6 Which statement is correct? (Note: Our selectionsort picks largest items first.) * * * * A. B. C. D. The The The The algorithm algorithm algorithm algorithm might be either selectionsort or insertionsort. might be selectionsort, but it is not insertionsort. is not selectionsort, but it might be insertionsort. is neither selectionsort nor insertionsort.

6 .When is insertionsort a good choice for sorting an array? * * * * A. B. C. D. Each component of the array requires a large amount of memory. Each component of the array requires a small amount of memory. The array has only a few items out of place. The processor speed is fast.

7 What is the worst-case time for mergesort to sort an array of n elements? * * * * A. B. C. D. O(log n) O(n) O(n log n) O(n^2)

8 What is the worst-case time for quicksort to sort an array of n elements? * * * * A. B. C. D. O(log n) O(n) O(n log n) O(n^2)

9 .Mergesort makes two recursive calls. Which statement is true after these recu rsive calls finish, but before the merge step? * A. The array elements form a heap. * B. Elements in each half of the array are sorted amongst themselves. * C. Elements in the first half of the array are less than or equal to elements in the second half of the array. * D. None of the above. 10 .Suppose we are sorting an array of eight integers using quicksort, and we ha ve just finished the first partitioning with the array looking like this: 2 5 1 7 9 12 11 10 Which statement is correct? * * * * A. B. C. D. The pivot could be either the 7 or the 9. The pivot could be the 7, but it is not the 9. The pivot is not the 7, but it could be the 9. Neither the 7 nor the 9 is the pivot.

11 .What is the worst-case time for heapsort to sort an array of n elements? * * * * A. B. C. D. O(log n) O(n) O(n log n) O(n^2)

12.Suppose you are given a sorted list of N elements followed by f(N) randomly o rdered elements.How would you sort the entire list if * A. f(N)=O(1) * B. f(N)=O(logN) * C. f(N)=O(N^1/2) * D. How large can f(N) be for the entire list still to be sortable in O(N) time ? 13.Prove that any algorithm that find an element X in a sorted list of N element s requires Omega(log N) comparisons. 14.Prove that sorting N elements with integer keys in the range 1 < Key < M takes O(M + N) time using bucket sort. 15.Suppose you have an array of N elements,containing only 2 distinct keys, true and false.Give an O(N) algorithm to sort the array.

16.Prove that any comparison based algorithm to sort 4 elements requires atleast 5 comparisons 17. In how many ways can 2 sorted arrays of combined size N be merged? 18.Show that binary insertion may reasonably be expected to be an O(n log n) sor t. 19.You are given two sets of numbers Xi and Yj , where i and j run from 1 to N. Devise an algorithm to find the M largest values of Xi -Yj . This algorithm shou ld not be quadratic in N, though it is permitted to be quadratic in M. You should regard N as being of the order of 20,000 and M as being of the order of 1,000. 20.If 1024 numbers are drawn randomly in the range 0 127 and sorted by binary insertion, about how many compares would you expect?

- ISC Class XII Computer Science Project JAVA ProgramsUploaded byTed
- Chunk SortUploaded byijcsis
- SORTING AND SEARCHINGUploaded byᗬᗴᐻ ᔤᗩᕼᕢᖆᘍ
- Sorting ArticleUploaded byAyanChatterjee
- AIUploaded bylight66
- cUploaded byHarsha Vardhan
- SDA2_ern.pptUploaded byToni Tabi Seunghyun
- Asm FundamentalsUploaded byrasromeo
- Image Encryption Based on Inter-Pixel DisplacementUploaded byijsret
- chap09Uploaded byalpanasingh_jecrc
- Binary SearchUploaded byVarun Burman
- Cpds Previous Papers Questions 2012 HarshaUploaded byHarsha Vardhan
- IT AUG-11Uploaded byPatel Punit
- UT Dallas Syllabus for cs3345.081 06u taught by Ovidiu Daescu (daescu)Uploaded byUT Dallas Provost's Technology Group
- BigOhBruteForceDivideConqUploaded byDudley Williams
- Data Structures And AlgorithmsUploaded byGirish Kumar Nistala
- UT Dallas Syllabus for se3345.081.06u taught by Ovidiu Daescu (daescu)Uploaded byUT Dallas Provost's Technology Group
- Chapter7.ans.docUploaded byBlasta45
- Chapter7.ans.docUploaded byabdullah badawi
- Merge SortUploaded bytushar006
- c Lection15Uploaded byAjla Puhalo
- COMPR2Uploaded byMatthew John Sino Cruz
- Assignment 3Uploaded bym.aadil.rehman3312
- ArraysUploaded byGaneshBalaji Katuri
- Table of Contents [Data Structure and Algorithmic Thinking With Python]Uploaded byraj06740
- c++ questions.docUploaded byVikas Ps
- Bubble Sort AlgorithmUploaded byMouseManX
- L13-HeapSortUploaded bysolanki06
- UntitledUploaded byNisha Soms
- CPC_2Uploaded byRaj Goyal

- Factors Influncing Quality of Mobile Apps- Role of Mobile App Development Life CycleUploaded byijsea
- Automobiles January 2018Uploaded byJayesh Mahajan
- 05 MBV4230 05 ChromatinUploaded bySri Natha Desikan
- Will Endeavour Spec GAUploaded byAstrid Montero
- ElectricalRequirements (1)Uploaded bygiessen01
- AVH 01-30-2017 Lake Street UpdateUploaded byMonsoon
- A. D. Kaminker et al- Magnetars as cooling neutron stars with internal heatingUploaded byTuoma2
- 30 Usability Issues to Be Aware of - Smashing MagazineUploaded byJeff Swartz
- Pocketbook 2008Uploaded bySudipta Ranjan
- Area Moment of Inertia Section Properties Half Tube Calculator _ Engineers Edge _ Www.engineersedgeUploaded bydane05
- info_iec60068-2-1{ed6.0}en_dUploaded byWilliam Salgado
- [Carl L. Bankston, Sarah Hilbert, Kevin M. Mitchel(B-ok.xyz)Uploaded bygoot
- ProductRegistrationUploaded byRajesh Ramakrishnan
- 320D2 Troubleshooting4Uploaded byevan
- VSS03 GPS Tracking DeviceUploaded byVoxTrail GPS
- 10Uploaded byMariel Angeli Chan
- Chapter 2 - NoteUploaded bySelineYee
- LogoUploaded bypaulo
- DocumentDispatch (Schematics) 010Uploaded byGleison Prateado
- davis piper resumeUploaded byapi-355716539
- final evaluationUploaded byapi-284056276
- Petri NetsUploaded byAnonymous QM0NLqZO
- Evidence Take a Break Ingles 4Uploaded byAna Milenitha Salcedo Puerta
- Outotec Corporate BrochureUploaded bybetojulio
- Juice FeasibilityUploaded byPrudhvinath Reddy
- Thesis TopicUploaded byViji Ramesh
- [Fabio Vighi] on Zizek's Dialectics SurplusUploaded byLuis Hernandez
- 247778373-Botulinum-Toxin-Injection-Guid.pdfUploaded byAccount Account
- B133-8_R2001_E1977.pdfUploaded byMyo Kyaw Kyaw
- East AfricaUploaded bysidik

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.