Note that CSCirles cannot verify that you applied the correct algorithm. It applies black-box testing and verifies the correctness of output in terms of the given input.
11.1 Bubble Sort
11.2 Insertion sort
Coding Exercise: Insertion sort
Given a sequence of
n
integers. Implement
Insertion-sort algorithm to sort the given sequence.
Output the sorted sequence.
You need to create an account and log in to ask a question.
# delete this comment and enter your code here
11.3 Linear search
Coding Exercise: Linear search
Given a number
m
and a sequence of
n
integers. Implement linear search algorithm to check whether the number
m
is present in the sequence.
If the number is present - output the position of
m
in the sequence. If there are several such positions, output the smallest one. If
m
is not present in the sequence, output
NO
.
You need to create an account and log in to ask a question.
# delete this comment and enter your code here
11.4 Binary Search
Coding Exercise: Binary Search
Given a number
m
and a sequence of
n
distinct integers sorted in increasing order. Implement binary search algorithm to check whether the number
m
is present in the sequence.
If the number is present - output the position of
m
in the sequence. If
m
is not present in the sequence, output
NO
.
You need to create an account and log in to ask a question.
# delete this comment and enter your code here
11.5 Recursive Binary Search
Coding Exercise: Recursive Binary Search
Given a number
m
and a sequence of
n
distinct integers sorted in increasing order. Implement binary search algorithm to check whether the number
m
is present in the sequence.
If the number is present - output the position of
m
in the sequence. If
m
is not present in the sequence, output
NO
.
You need to create an account and log in to ask a question.
# delete this comment and enter your code here
11.6 QuickSort
Coding Exercise: Quick Sort
Given a sequence of non-negative integers that terminates with
-1 (minus one).
Implement
Quick-sort algorithm to sort the given sequence.
Output the sorted sequence.
You need to create an account and log in to ask a question.
# delete this comment and enter your code here