2. Simulate the Sort_Arr procedure using the given below and give the output. (Use a space to separate each element of the array) * Sort_Arr (Arr1, N) { N= 4 Arr1 Set Ctr1 to 0 100 While (Ctr1 < N-1) { 1 45 75

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter10: Pointers
Section10.4: Passing Addresses
Problem 4E
icon
Related questions
Question

c++ language 

2. Simulate the Sort_Arr procedure using the given below and give the
output. (Use a space to separate each element of the array) *
Sort_Arr (Arr1, N)
{
Arr1
N = 4
Set Ctri to 0
100
While (Ctrl < N-1)
{
1
45
2
75
Set Ctr2 to Ctr1 +1
3
90
While (Ctr2 >N)
{
If (Arr1[Ctr1] < Arr1[Ctr2] ) then
{
Set Temp to Arr1[Ctr1]
Set Arr1[Ctr1] to Arr1[Ctr2]
Set Arri[Ctr2] to Temp
}
Increment Ctr2
}
Increment Ctr1
}
}
Transcribed Image Text:2. Simulate the Sort_Arr procedure using the given below and give the output. (Use a space to separate each element of the array) * Sort_Arr (Arr1, N) { Arr1 N = 4 Set Ctri to 0 100 While (Ctrl < N-1) { 1 45 2 75 Set Ctr2 to Ctr1 +1 3 90 While (Ctr2 >N) { If (Arr1[Ctr1] < Arr1[Ctr2] ) then { Set Temp to Arr1[Ctr1] Set Arr1[Ctr1] to Arr1[Ctr2] Set Arri[Ctr2] to Temp } Increment Ctr2 } Increment Ctr1 } }
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Quicksort
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning