Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Convert pseudo code to java code using List ls Problem 1- n
Convert pseudo code to java code using List
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started