Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
bartleby
Concept explainers
Question
Please written by computer source
Attached is the pseudocode for the Merge
Transcribed Image Text:MERGE(A, p, q, r)
1
2
3 let L[0:n
4
5
12
13
14
15
16
6 for j = 0 to nR-1 // copy Alq +1:r] into R[0:nR - 1]
R[j] = A[q+j+1]
7
8
nL = q-p+1
nR = r-q
i=0
9 j = 0
// i indexes the smallest remaining element in L
//j indexes the smallest remaining element in R
// k indexes the location in A to fill
10 k
P
11
// As long as each of the arrays L and R contains an unmerged element,
// copy the smallest unmerged element back into A[p:r].
while i <n and j<nr
if L[i] ≤ R[j]
A[k] = L[i]
i=i+1
else A[k] = R[j]
j=j+1
20
21
22
23
24
25
// length of A[p:q]
// length of Alq +1:r]
1] and R[0:nR - 1] be new arrays
for i = 0 to n-1 // copy A[p:q] into L[0:n1 - 1]
L[i] = A[p + i]
17
18
k=k+1
19 // Having gone through one of L and R entirely, copy the
remainder of the other to the end of A[p:r].
//
26
27
while i <nL
A[k] = L[i]
i=i+1
k=k+1
while j<nR
A[k] = R[j]
j=j+1
k=k+1
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
This is a popular solution
bartleby
Trending nowThis is a popular solution!
bartleby
Step by stepSolved in 3 steps
Knowledge Booster
Background pattern image
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Try switching the joins pthread_join(tid2, NULL); pthread_join(tid1, NULL); Do you see any difference? Please report if and why you do or do not see any difference in terms of the randomness in the result of the shared resource. In the inc_dec_resource() function, implement mutual exclusion (pthread_mutex_lock) to ensure that the result becomes 0 every time when you execute your program. Put your updated code in the report (highlighted) and show your screenshot of the execution by running the script three time using $ time ./shared_resource_mutex. Hint: Your loop is incrementing/decrementing the resource which should be protected by each thread while it is executing that portion. #include <stdio.h> #include <pthread.h> #define iterations 300000000 long long shared_resource = 0; pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; // Thread function to modify shared resource void* inc_dec_resource(void* arg){ //get the pointer from main thread and dereference it...arrow_forwardUse a merge sort to sort 3,6,9,4,2,10, 8, 1,7,5 into increasing order. Show all steps used by the algorithmarrow_forward6. Below is a table that shows the timing of three different algorithms using an array of integers as input. Explain which of the algorithms is most likely the selection sort and which is the merge sort, explain in details your answer. Algorithm 1 Algorithm 2 Algorithm 3 time to process 2000 integers 0.1431 sec 0.8011 sec 0.0132 sec time to process 4000 integers 0.5722 sec 1.4300 sec 0.0304 sec time to process 8000 integers 2.2989 sec 2.4512 sec 0.0634 secarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education