subject

This is java programming:

objectives:

1. apply linear search algorithm
2. apply select sort algorithm
3. apply array iteration skill

question:

write the following eight methods and write a main function to test these methods:

// return the index of the first occurrence of key in arr
// if key is not found in arra, return -1
public static int linearsearch(int arr[], int key)
// soert the arr from least to largest by using select sort algorithm
public stati void selectsort(int arr[])
// print out all array elements. 5 elements per line
public static void printarray(int arr[])
// assign each element in array with a random number
// between 1 and 100, inclusive
public static void initializearray(int arr[])
// find the range of all array elements
// the range is defined as the difference between the largest and smallest elements
public static int range(int arr[])
// find the largest element in array
public static int largst(int arr[])
// find the smallest element in array
public static int smallest(int arr[])
// find the average value of all elements in array
public static double average(int arr[])

sample pseudo code for main function

1. declare an int array of size 10
2. initialize the array by calling initializearray function
3. print out the array by calling printarray function
4. print out the largest and smallest value of the array by using system. out. prinln and calling largest and smalles functions
5. print out the range of the array
6. print out the average of the array elements
7. ask user to enter a search key
8. call the linearsearch function with array and key. based on result, print out appropriate message
9. call the selectsort function to sort the array.
10. print out array again to see the sorted array

use online resource: you may search on line to find the linear search and select sort algorithms.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 04:31
Type the correct answer in the box. spell all words correctly. the managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
What provides an array of buttons for quick access to commonly used commands and tools
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
Ramona enjoys her job because she is able to kids in an after school program. the work value ramona feels strongest about is a. leadership b. risk c. independence d. work with people select the best answer from the choices provided a b c d
Answers: 1
question
Computers and Technology, 23.06.2019 20:40
On nba 2k 19, every time i try to join a my park game, it leads ro a website telling my dad that he needs ps plus. i already have ps plus though. how do i fix this?
Answers: 2
You know the right answer?
This is java programming:

objectives:

1. apply linear search algorithm
Questions
question
Mathematics, 14.11.2019 07:31
question
Mathematics, 14.11.2019 07:31
question
Computers and Technology, 14.11.2019 07:31
Questions on the website: 13722362