Sequential
Sequential
BSIT 1-B
#include <iostream>
if (arr[i] == target) {
return i;
return -1;
int main() {
if (result != -1) {
cout << "Element found at index " << result << "." << endl;
} else {
return 0;
#include <iostream>
using namespace std;
int start = 0;
int mid;
if (arr[mid] == target) {
return mid;
start = mid + 1;
} else {
end = mid - 1;
return -1;
int main() {
int target;
if (result != -1) {
cout << "Element found at index " << result << "." << endl;
} else {
cout << "Element not found." << endl;
return 0;
#include <iostream>
int minIndex = i;
minIndex = j;
swap(arr[i], arr[minIndex]);
int main() {
selectionSort(arr, size);
return 0;
#include <iostream>
swapped = false;
swapped = true;
int main() {
bubbleSort(arr, size);
return 0;