this java! a response as soon as possible would be appreciated. thanks again.
please say a brief statement as to why u chose that answer.
Indicate TRUE OR FALSE for each of the following statements concerning search and sort algorithms
1) Linear search is guranteed to locate 5 in the array [1, 3, 2, 6, 5, 9, 4 ]
2) Binary search is guranteed to locate 5 in the array [1, 3, 2, 6, 5, 9, 4 ]
3) Linear search is guranteed to locate 5 in the array [1, 2, 3, 4, 5, 6, 9]
4) Binary search is guranteed to locate 5 in the array [1, 2, 3, 4, 5, 6, 9]
5) The java standard library only contains searching and sorting algorithms that work for standard java types like int and string. Any new class types require new searching/sorting algorithms to be written
1) TRUE : Linear Search is the searching method for finding the element or value in the list given.It is also known as sequential search where the java program uses the method to search key element by sequentially searching for the number in the list.If the number is not found in first place the counter is increamented and the process goes untill the number has been found. Thus in the above given array 1,3,2,6,5,9,4 the counter is increamented untill the 5 is found.
2) False : Binary Search finds the key element by dividing the array into two and considering the value of mid number. At each step an algorithm finds the input key value with the mid element of the array,if key is found it returns the position ,else if the number is less than the key then it checks to the left of the mid number else if it is greater then checks to the right.
Hence in java the above given array [1, 3, 2, 6, 5, 9, 4 ], 5 is not guaranteed to be found as after dividing the given array 6 is the mid element , so if 5 is searched then according to binary search algorithm it is less than mid element adnd thus should fall to the left side ,but in this case it is located to the right side of mid element.
3)TRUE : As java c will check for the 5 in the given array ,it sequentially searches the whole array untillthe key element is found. Therefore in the arary [1,2,3,4,5,6,9] the 5 is guaranteed to be located at the position a[4].
4)TRUE :In this array [1,2,3,4,5,6,9] ,the 5 is guaranteed to be found. As the mid element here is 4 (i,e a[3] = a[6]/[2]. 5 is greater than 4 located to the right side of the mid element and thus can be found at the right side of the mid element 4.
5) FALSE : As java also supports other types like float for searching and sorting .java.util.Arrays.sort(float[ ]) is dfined in the library for sorting floating type numbers in an array.
this java! a response as soon as possible would be appreciated. thanks again. please say a...
Using Arrays with Sorting and Searching Algorithms 1) This program has six required outputs and involves searching and sorting an array of integers. Write a java application that initializes an array with the following numbers, in this order: 23, 17, 5, 90, 12, 44, 38, 84, 77, 3, 66, 55, 1, 19, 37, 88, 8, 97, 25, 50, 75, 61, and 49. Then display the unsorted values. This is required output #1 of 6 for this program. 2) Using a...
What is the maximum number of comparisons made when searching a 60 element array with Binary Search? 60 30 5 6 Question 3 (3 points) What is the average number of comparisons made when searching a 60 element array with Linear Search? 06 5 A selection sort algorithm is used to sort an array containing the following values into ascending order. Give the order of the elements after each pass of the sorting algorithm. 6 4 7 2 3 5...
For java review please help #2 2. (15 points (-14+1)) Compare the execution complexity of sorting algorithms. Worst Case Average Case Selection Sort (2.1) Bubble Sort (2.2) Insertion Sort (2.3) Radix Sort Merge Sort Quicksort Heap Sort (2.8) (2.9) (2.10) (2.4) (2.5) (2.6) (2.7) (2.12) (2.13) (2.14) 3. (10 points) Answer the following questions for an array based representation of a complete binary tree (say the array name is binTree). (3.1) root of tree bin Tree LoT
please I need it urgent thanks algorithms 2.1 Searching and Sorting- 5 points each 3. What is the worst case for quick sort? What is the worst case time com- plexity for quick sort and why? Explain what modifications we can make to quick sort to make it run faster, and why this helps. 4. Give pseudocode for an algorithm that will solve the following problem. Given an array AlL..n) that contains every number between 1 and n +1 in...
Subject: Algorithm need this urgent please. 2.1 Searching and Sorting- 5 points each 1. Run Heapsort on the following array: A 17, 3, 9, 4, 2,5, 6, 1,8) 2. Run merge sort on the same array 3. What is the worst case for quick sort? What is the worst case time com- plexity for quick sort and why? Explain what modifications we can make to quick sort to make it run faster, and why this helps. 2.1 Searching and Sorting-...
2.1 Searching and Sorting- 5 points each 1. Run Heapsort on the following array: A (7,3, 9, 4, 2,5, 6, 1,8) 2. Run merge sort on the same array. 3. What is the worst case for quick sort? What is the worst case time com- plexity for quick sort and why? Explain what modifications we can make to quick sort to make it run faster, and why this helps. 4. Gi pseudocode for an algorithm that will solve the following...
1. a. Using C++, represent the following graph using adjacency matrix, and implement depth first searching (DFS) by stack (define it with class) to traverse the graph. 6 7 2 4 b. If starting with node 2, when node 7 is printed, what numbers are in the stack (for DFS)? Please draw the stack step by step to show how the numbers are pushed into and popped out of it. 2. a. Given a set of integer numbers as int...
JAVA Programming Add debug statements to the Java code in Question 1 to show the list values after each completing cycle of the sorting process. Run your program with an array of size 10 {27,28,9,6,15,18,33,30,-4,-1} and complete the following tables. Add rows to the tables if you need them. Cycle Bubble Sort 0 27 28 9 6 15 18 33 30 -4 -1 1 27 9 6 15 18 28 30 -4 -1 33 2 3 4 5 6 7...
Step 1: Select any four sorting algorithm and two searching algorithms Step 2: Understand the logic of all the algorithms Step 3: Create java program and use your sorting/searching source codes and integrate it into your main java project. Step 4: Create a separate java class for each algorithm Step 5: Create a random function that generates at least 100000 random integer numbers from 1 to 1 million(No need to print out or store the numbers) Step 6: Insert start...
In Java, write your own methods to do the following: LinearSearch BinarySearch SelectionSort MergeSort InsertionSort BubbleSort On the given array with the following elements ; Array : 87, 39, 3, 5 ,9 ,7 ,27,1 , 8 ,6 (use this Array as data for all methods except the BinarySearch method). All your methods will be in a class. Write a tester program that will call each of the listed methods from the class above using the given Array as data. For...