Question: Convert pseudo code to java code using List ls Problem 1- n

Convert pseudo code to java code using List ls

Problem 1-

n <-- length(A)

for i = 0 to n-1 exclusive do

min <-- i

for j = i+1 to n exclusive do

if A[j] < A[min]

min <-- j

end if

end for

if min != i

swap(A[i], A[min])

Problem 2

n <-- length(A)

while n > 0

nn <-- 0

for i = 1 to n-1 inclusive do

if A[i-1] > A[i] then

swap(A[i-1], A[i])

nn <-- i

end if

end for

n <-- nn

Problem 3

i <-- 1

while i < length(A)

x <-- A[i]

j <-- i - 1

while j >= 0 and A[j] > x

A[j+1] <-- A[j]

j <-- j - 1

end while

A[j+1] <-- x

i <-- i + 1

end while

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!