The assignment is to implement a C++ program that performs various operations on an array list. The tasks include filling the array with random integers, printing the array, performing sequential search and sorting algorithms (Bubble Sort, Binary Search, Selection Sort), and testing each operation in the main function.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
By using C++ We use arrays to implement lists and perform different searching and sorting algorithms on those lists. Your program should include one function for each of the operations, as well as a main function for testing each. Part A: 1.Fill Array _ fill an array list with random integers 2.Print Array- 3.segSearch- part B: 1. BubbleSort 2. BinarySearch 3. SelectionSort N.Byou can edit and follow this code // squential searching and sorting C++programe #include <iostream> using namespace std; int seqSearchItem (int list [], int length, int item) { int loc; bool found = false; for (loc = 0; loc < length; loc++) { if (list [loc] == item) { found = true; break; } } if (found) return loc; else return -1; }
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
int main() { int intlist[]= {2,16,34,45,53}; int pos; pos= seqSearchItem(intlist,10,45); if (pos!=-1) cout<<" line5:"<<45<<"found at position"<<pos<<endl; print(intlist,45); else cout<<"line7:"<<45<<"is not in inlist"<<endl; system("pause"); return 0; }