how should I implement a parametrized version of mergesort that will allow us to choose how many parts the input array will be divided into. This method has to take an integer array and integer K as inputs and produce one integer array as output. It will sort the input array by dividing it into K parts, recursively sorting those parts. In java language
Q: Exactly what is meant by the phrase "memory void," if it exists at all? How is it that this is even…
A: Introduction: A memory blank is like a method for purposefully changing or erasing unfavorable or…
Q: he following program manages flight reservations for a small airline that has only one plane. This…
A: Your correct C program is given below as you required with an output.
Q: Algorithm for Match in a pyramid tournament. in: set P of players in the pyramid structure; players…
A: Algorithm for Match in a pyramid tournament:
Q: 2. A microcontroller system with 50-KHz system clock is programmed to take a sensor reading every 2…
A: Part a. Minimum Sleep Time: 2 minutes = 120,000 ms Maximum Sleep Time: 4 MB / 500 KB/s = 8,000 ms…
Q: establish and terminate data sharing in multimedia systems
A: The real time protocol works and terminate the data sharing in multimedia systems are as follows:
Q: Please comment all code Using a python editor, write a python script that imports os and does the…
A: I have provided the complete program in step 2 with all the comments and points asked in the…
Q: In the list comprehension [4*i for i in range(10) if i%X ==0] what integer should the X be replaced…
A: Dear Student, The answer to your question is given below -
Q: The question is whether or whether there are any drawbacks to utilizing a WYSIWYG editor, and if so,…
A: Introduction A sort of editing software called WYSIWYG (pronounced wiz-ee-wig) enables users to view…
Q: The CAP theorem in NoSQL. Why can't we use both C and A?
A: Solution:- CAP theorem in NoSQL :- CAP is an acronym for Consistency, Availability, and Partition.…
Q: When redistributing a route into EIGRP, what parameter must be used? Factors like the next hop's IP…
A: The administrative distance must be used when redistributing a route into EIGRP.
Q: Write a VB program that reads the oil prices in a week, stores them in a one dimensional array, and…
A: The required Visual Basic code is as follows Imports System Module VBModule Sub Main()…
Q: otect cloud-based information? How can we strengthen protections in the cloud? If you respond,…
A: Summary What is cloud security?Cloud security is a set of principles, methods, and technologies…
Q: Write a 8051 assembly program to generate a delay of 5 microsecond using Timer 0 mode 1 with XTAL…
A: Write a 8051 assembly program to generate a delay of 5 microsecond using Timer 0 mode 1 with XTAL…
Q: Please describe briefly how the Linux clone OS differs from the default UNIX threads and processes.
A: INTRODUCTION: A Unix-like operating system (OS) for desktops and computers (servers, mainframes,…
Q: 3. Create a Python script that will compare two (2) numbers entered by the user. Refer to the…
A: Dear Student, The source code, implementation and expected output is given below -
Q: How does data visualization tools work?
A: Data visualization enables business users to gain insight into their vast amounts of data.Data…
Q: Making sure that encapsulation is not violated (i.e., instance variables must be private); design an…
A: class Vehicle{ private int year; priavte String make; Vehicle(){} Vehicle(int y,…
Q: 3. Find a Big-O estimate for Σ-1/(j+1).
A: Your answer is given below.
Q: Exactly what makes the Internet such a shining example of ICT? The arguments and examples you…
A: Why is the internet among the best examples of ICT? Each point should be backed up with specific…
Q: count, day, total 6, 1, e label "Predinsone \n" while > 8: label label "Day " + str(day) + ": take "…
A: Dear Student, The completed code is given below you can answer the questions based on it -
Q: In System Analysis, what does the term "model" refer to? You can tell them apart using physical and…
A: Introduction: Information may be connected via the usage of models developed during system…
Q: How are information systems put to use in the business world?
A: Introduction Industries which might create innovative strategies as well as inventive procedures…
Q: Which of the following will help ensure that the most critical software components are included in…
A: Solution :- Ans 1. Risk Analysis will help to ensure that the most critical software components are…
Q: Draw tree Perform the following operations on an empty splay tree insert (3) , insert (9) , insert…
A: Solution: insert (3) insert (9) insert (12) insert (55)
Q: What do operating systems do for a computer?
A: System software and processorsAn operating system is the programme that controls the computer's…
Q: Give an outline of the many SCM concepts that may be used to software configuration.
A: Introduction: The process of tailoring a product to a customer's wants is known as product…
Q: In almost every window command buttons are present. When the user exit the application or begin…
A: INTRODUCTION: In a graphical user interface that allows for several viewing regions, each of these…
Q: In order to demonstrate your competence, you should define the various types of social networking…
A: We are able to quickly disseminate information, exchange images and audio recordings, organize…
Q: The Ubuntu Server Operating System is a server operating system that is based on Linux and is…
A: It is a system programme that manages the hardware and software of a computer system. This server…
Q: Why is Linux partitioning important in OS terms?
A: We need to discuss the importance of Linux partitioning in OS terms.
Q: Suppose program P1 requires T1(n) = n4 operations and P2 requires T2(n) = 2n. Suppose that your…
A: Running time of these pogram with P1 and P2 operations executing 106% /sec has been solved in step2
Q: Is there anything that can be done to stop insiders from wreaking havoc on cloud security?
A: Organizations and associations must use third-party cloud and security administrations to improve…
Q: What, exactly, is a "memory void?" When it happens, how does the operating system handle it, and…
A: Dear Student, The answer to your question is given below -
Q: Q2. Give the implementation of a function that displays elements greater that a given value from a…
A: balance we call a tree balanced if, for all nodes, the difference between the heights of the left…
Q: Ubuntu - what are the commands that use the frequency analysis to figure out the encryption key and…
A: uniq -c [filepath] Command 5:The fifth command needed is 'awk'. This command will allow you to print…
Q: Could you briefly go through the many parts that work together to form the operating system? just a…
A: The operating system consists of a kernel, device drivers, system libraries, user interface, system…
Q: Creating a class involves creating new instancesof objects defining class attributes changing values…
A: The solution is given below for the above given question:
Q: Write the configurations that the below Turing machine enters for the input string 11. 91 1a, R R 1…
A: An abstract machine that manipulates symbols on a strip of tape in accordance with a set of rules is…
Q: Why do you think x86 will not let you run the instruction below : mov [r8], [rax] In order…
A: x86 which refers to the one it is a family of complex instruction set of the computer instruction…
Q: For the next set of questions, consider the following graph Gr= (V,E). B D 6 5 2 B 2 6 F 7 3 2 8
A:
Q: C++ (C plusplus) Requirements: Use the given class “User” (below) All data members must be…
A: Define a new exception class named “BadValueException” class BadValueException : public…
Q: allenge: 12 - Password Verifier Use the string data type. Do not use arrays of type char or…
A: Dear Student, The source code, implementation and expected output is given below -
Q: What is the LU factorisation of the following matrix 1 0 Options 3 -1 7 8 10 3 10 L = - ( ÷ 1) - - (…
A:
Q: Question 19 A table with an index on the attribute 'title' will benefit from the index for the…
A: Solution:- Indexing :- The most common use for an index in SQL Server is to find a record or set of…
Q: 3. Consider the following tasks in a priority-based preemptive real-time OS. The lower priority…
A: A. It is not possible to determine whether all tasks' deadlines can be satisfied with the…
Q: What are the benefits of segmented memory address translation over a straight translation?
A: Using segmentation methods for memory address translation has the following advantages: As a result…
Q: 7. True or False: In general, the size of B(G) is N(n³). 8. True or False: In general, the size of…
A: - We need to talk about the adjacency matrix formed from the undirected graph.
Q: After executing DFS( G2, A), the parent of vertex D is vertex C. True False
A: Graphs in data structures are non-linear data structures made up of a finite number of nodes or…
Q: could you please clarify a little more on why the answer is false I am not understanding
A: Answer:
Q: what is the dev and QA?
A: Dev testing is a software development activity where developers test the code as it is being written…
1
Step by step
Solved in 2 steps with 4 images
- we have proven that the computational time complexity of mergesort is O(n * log2n). Perhaps the time complexity of mergesort can be improved further by separating the array into three parts instead of two. Start by implementing a method called merge3. This method should take three sorted arrays as inputs and return a sorted array consisting of all elements of the three input arrays. public static int[] merge3(int[] a, int[] b, int[] c) { return new int[] {-1}; } * must be done in this format and in javaWrite a program in java for the below given problem statement: Given 2 sorted arrays (in increasing order), find a path through the intersection that produces themaximum sum and return the maximum sum. That is, we can switch from one array to another array only atcommon elements. If no intersection element is present, we need to take the sum of all elements from thearray with greater sum.Sample Input:61 5 10 15 20 2552 4 5 9 15Sample Output :81Explanation :We start from array 2 and take sum till 5 (sum = 11). Then we'll switch to array at element 10 and take till15. So sum = 36. Now, no elements are left in array after 15, so we'll continue in array 1. Hence the sum is81.Write a java code that sorts a list of n items by dividing it into three sublistsof about n/3 items, sorting each sublist recursively and merging the threesorted sublists. Analyze your algorithm, and give the results under ordernotation.
- Java Implement 5 methods given below in MyStringArrayList class // Add a new element, e, at the beginning of this list public void addFront(String e){ } //search for element e, returns true if found, otherwise returns false. public boolean contains(String e){ } //return the element at position i, otherwise returns null public String getElement(int i){ } // remove the element at specified index, returns the element that is being removed. Returns null if specified index is invalid. public String removeElementAt(int i){ } //returns a String representation of this list. public String toString(){ }Which methods/actions in the Sorted Array can be made significantly more efficient compared to the Unsorted Array? Why is this? In other words, what can be done in the Sorted Array implementation to radically improve the efficiency that can't be done in an Unsorted Array?In this assignment, we will extend the solution we developed in PP-chapter 9 to support two more sorting strategies, mergeSort and quickSort. Plugging these two algorithms should not require any changes to the Sorter class public interface. To sort, the client should pass a parameter from the enum to select what algorithm to use, and then call sort with a given list. Do this in python only, import the modules below first before doing anything Sorter.py: import randomimport enumfrom abc import ABC, abstractmethod from priorityqueue.HeapPriorityQueue import HeapPriorityQueue class SortingALgorithm(enum.Enum): PR_Queue = 1 SortedPriorityQueue = 2 UnSortedPriorityQueue =3 class Sorter(ABC): @abstractmethod def sort(self) -> list: """in strategy pattern naming, this is method execute""" pass class PR_queue_sorter(Sorter): """ Heap sort Sorting according to the algorithm on slide #10 using a heap implementation of priority queue""" def…
- Write a Java method that takes two 2 dimensional int arrays (a and b) anda 2 dimensional boolean array (c) where all three arrays have the samesize. Your method should return an array (result) such that, if a particular element in c is true, then the corresponding (same indexed) elementin result must be the multiplication of the the corresponding elements ofa and b. If the element in c is false, then the the corresponding elementin result must be the negative of multiplication of the the correspondingelement in a and b.We will extend the solution we developed in Sorter.py to support two more sorting strategies, mergeSort and quickSort. Plugging these two algorithms should not require any changes to the Sorter class public interface. To sort, the client should pass a parameter from the enum to select what algorithm to use, and then call sort with a given list. Do this in python only, import the modules below first before doing anything Sorter.py: import randomimport enumfrom abc import ABC, abstractmethod from priorityqueue.HeapPriorityQueue import HeapPriorityQueue class SortingALgorithm(enum.Enum): PR_Queue = 1 SortedPriorityQueue = 2 UnSortedPriorityQueue =3 class Sorter(ABC): @abstractmethod def sort(self) -> list: """in strategy pattern naming, this is method execute""" pass class PR_queue_sorter(Sorter): """ Heap sort Sorting according to the algorithm on slide #10 using a heap implementation of priority queue""" def __init__(self): self._q…Create a test program to test this MergeSort Program: package ArraySplit; import java.util.Arrays; public class ArraySplit { public static void mergeSort(int[] a, int n) { if (n < 2) { return; } int mid = n / 2; int[] l = new int[mid]; int[] r = new int[n - mid]; for (int i = 0; i < mid; i++) { l[i] = a[i]; } for (int i = mid; i < n; i++) { r[i - mid] = a[i]; } mergeSort(l, mid); mergeSort(r, n - mid); merge(a, l, r, mid, n - mid); } public static void merge(int[] a, int[] l, int[] r, int left, int right) { int i = 0, j = 0, k = 0; while (i < left && j < right) { if (l[i] <= r[j]) { a[k++] = l[i++]; } else { a[k++] = r[j++]; } } while (i < left) { a[k++] = l[i++]; } while (j < right) { a[k++] = r[j++]; } } }
- For this problem I have a java code: import java.util.Arrays; import java.util.Scanner; public class MergeSortWeightedSumInversion { public static long merge(int arr[], int l, int mid, int r) { long weight = 0; int n1 = mid-l+1; int n2 = r-mid; int[] a = new int[n1]; int[] b = new int[n2]; for(int i = 0; i < n1; i++) { a[i] = arr[l+i]; } for(int i = 0; i < n2; i++) { b[i] = arr[mid+i+1]; } int i = 0, j = 0, k = l; while(i<n1 && j<n2) { if(a[i] <= b[j]) { arr[k] = a[i]; k++; i++; } else { weight += (a[i] + b[j]); arr[k] = b[j]; k++; j++; } } while(i<n1) { arr[k] = a[i]; k++; i++; } while(j<n2) { arr[k] = b[j]; k++; j++; } return weight; } public static long mergeSort(int arr[], int l, int r) { long weight = 0; if(l < r) { int mid = (l+r)/2; weight += mergeSort(arr, l, mid); weight += mergeSort(arr,mid+1,r); weight += merge(arr,l,mid,r); } return weight; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n; n =…Implement an algorithm that returns the X closest items to a value V, for any array of integer elements. V may or may not be present in the array. Its solution must be O(nlogn). (phyton or Java). Note: The proposed solution must use the divide-and-conquer strategy.FOR JAVA Write a Java method that takes two 2 dimensional int arrays (a and b) and a 2 dimensional boolean array (c) where all three arrays have the same size. Your method should return an array (result) such that, if a partic- ular element in c is true, then the corresponding (same indexed) element in result must be the multiplication of the the corresponding elements of a and b. If the element in c is false, then the the corresponding element in result must be the negative of multiplication of the the corresponding element in a and b. For example ifa = {{1,2,3},{4,5}},b = {{1,2,1},{0,2}} andc = {{true,false,true},{false,true}}, then the result should be result={{1, -4, 3}{0, 10}}.