Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions

Question

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

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago