Question 1)
START
METHOD boolean TrueFalse(parameter number)
IF(number % 5 is equal to 0)
RETURN TRUE
ELSE
RETURN FALSE
STOP
Question 2)
START
INITIALIZE variable sum
FOR( i = 1 to 10)
FOR( j = 1 to 10)
IF(array[i][j] is less than 0)
add array[i][j] to sum;
PRINT sum;
END
Question 3)
The GIRAFFES need care and feeding.
The HIPPOPOTOMI need care and feeding.
all in pseudocode Question 1) Warmup question: Write a function named True False() (only the function,...
Question 27 (Mandatory) (1 point) Which sorting algorithm uses the following pseudocode: For each new, unsorted value v in an array, search backward through already sorted values in the array. Move values until a proper position is found for v. Place v in its correct position. Bogo Sort Selection Sort Insertion Sort Ascending Sort Bubble Sort
?PLEASE READ CAREFULLY
QUESTION #1
I’m doing a project which requires you to implement 4 sorting
algorithms. Bubble sort pair-wise, Bubble sort list-wise a.k.a
selection sort, merge sort, and quick sort. These 4 sorting methods
takes in an array of strings and sorts them alphabetically from
a-z.
I have all 4 sorting algorithms working fine, but I still need
to fill out the table. There’s only one section I need help filling
out.
I basically need help filling out the...
Need help with program. I'm stuck
Objectives: In this assignment, we will
practice manipulating lists of data and arranging items in an
ascending/descending order. you will also explore storing
lists/arrays using different sorting algorithms including, the
selection sort, bubble sort, and insertion sort algorithm.
Comparison between the three algorithms are made based on the
number of comparisons and item assignments (basic operations) each
algorithms executes.
Background: Ordering the elements of a list is
a problem that occurs in many computer...
1. Which is the best sorting algorithm for larger arrays if all the items can not fit in main memory? selection sort insertion sort quicksort Merge sort 2. Which sorting algorithm sorts items without comparing them? quick sort radix sort merge sort Insertion sort 3 What is the average running time for quicksort? O(n2) O(logn) O(nlogn) O(n) O(n2logn) 4. Examine the steps of the following algorithm and write the name of the algorithm described in the blank provided: Recursively divide...
Problem 2. Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[1]. Then find the second smallest element of A, and exchange it with A[2]. Continue in this manner for the first n − 1 elements of A. a. Write pseudocode for this algorithm, which is known as selection sort. b. Why does it need to run for only the first n−1 elements, rather than for...
Write a JAVA Program: Compare the performance of bubble sort and selection sort over several arrays. - Write two methods that sort arrays of doubles. One method should use selection sort, and the other should use bubble sort. - In each of the sort methods, add code that counts the total number of comparisons and total number of swaps performed while sorting the entire array (be careful; don't count each pass through the array separately) - Each time an array...
C++ Sorting and Searching 1. Mark the following statements as true or false. a. A sequential search of a list assumes that the list elements are sorted in ascending order. b. A binary search of a list assumes that the list is sorted. 2. Consider the following list: 63 45 32 98 46 57 28 100 Using a sequential search, how many comparisons are required to determine whether the following items are in the list or not? (Recall that comparisons...
. Shell sort is a sorting algorithm similar to insertion sort. Research shell sort and apply that to the following array. Show your work in Detail. [15 points] 45 20 50 10 80 30 60 70 40 90 2. Is Shell sort a stable sorting algorithm? Answer this with an example. [10 points] 3. Apply Merge Sort to sort the following list. Show your work in Detail. [15 Points] 45 20 50 10 80 30 60 70 40 90 4....
1. What is the minimum number of locations a binary search algorithm will have to examine when looking for a particular value in a sorted array of 200 elements? (2 points) 1 6 7 8 200 2. In general, which of the following sorting algorithms is the MOST efficient? (2 points) Bubble sort Insertion sort Heap sort Merge sort Selection sort 3. Which of the following are quadratic-sorting algorithms? (2 points) I. insertion sort II. selection sort III. merge sort...
Write pseudocode to solve the following problem: You are given an array A[1...n] whose each element is a point of the plane (x,y). You need to sort the array so that points with lower x-coordinates come earlier, but among points with the same x-coordinate, the ones with larger y-coordinate come earlier. So, for example, if the array contains: (1,2), (1,4), (7,10), (11,3), (14,1), (7,2) The output, in this case, should be: (1,4), (1,2), (7,10), (7,2), (11,3), (14,1) Analyze the running...