Assignment2 SDA Section B
Assignment2 SDA Section B
Assignment 2
1. Write a program to initialize an array with 10 random integers between 1 to 100. Sort them in an
ascending order using selection sort technique. Display the sorted array.
2. Write a program to store 15 double numbers in an array. Arrange these numbers in descending
order by Bubble sort. Print the sorted list.
3. Write a java program to accept an integer array SDA[ ] of size n . Also accept an integer findnum.
Use Linear Search technique to check if findnum is present in array SDA[ ]. If found display “Search
successful” else display “Number is missing”.
4. Define a class to declare an array Marks[ ] of size n of double datatype, accept the marks of
students into the array and perform the following:
5. Write a program to accept 10 phone numbers in an array in ascending order. Accept a phone
number and search if it is already present in the entered list using binary search method. Display
appropriate messages when search is successful or unsuccessful.
6. Write a program to perform linear search on a list of integers given below, to search for an
element input by the user. If it is found display the element along with its position, otherwise display
the message "Search element not found".