Consider the following data: 100, 8, 75, 85, 7, 10, 20, 1, 5, 65,21 Your task is to sort the data in O(nlogn) time. You also have to avoid using extra memory space ( using additional array/arrays) . Now select and apply the appropriate algorithm to sort those values in this condition showing each step.
Q: Write program in C++ using strings in conjuction with 2D arrays. Allow the user to enter the names o...
A: A required C++ program is as follows, #include <bits/stdc++.h> using namespace std; //Function...
Q: The Barking Lot is a dog day care center. Design a flowchart or pseudocode for the following:a. A pr...
A: Step 1:- Note:-I am giving the solution of part (a),(b) and (c) Introduction:- Pseudocode:-It is def...
Q: “Hamming,” will read in an integer “k” and a bit string “s” from the command line, calculate the “Ha...
A: Programming Approach: (a) First find all the binary string having the length equal to the command li...
Q: Use C++ programming language.. Random Number Guessing Game Write a program that generates a random n...
A: Program:- #include <iostream>#include <cstdlib>#include <ctime>using namespace s...
Q: Write an if statement that assigns 20 to the variable y, and assigns 40 to the variable z if the var...
A: As per policy, only first question is answered. Since, no programming language is mentioned, We will...
Q: Create an arraylist of 10 students. Use the following methods: add, remove, insert, size, capacity, ...
A: Among the methods given above ArrayList has only: add remove size There is no insert method in Arr...
Q: code is in python
A: Program description: The python program prompts the user to enter a number of tasks as input to crea...
Q: What are the different types of encryption? Why do you think its becoming more and more necessary? ...
A: Encryption is a process of converting the plaint text to a ciphertext. There are two types of Encryp...
Q: csc 231
A: import java.time.LocalDate; public class Elapsed_Days{ private long elapsed_days=0; public Elapsed_...
Q: The Barking Lot is a dog day care center. Design a flowchart or pseudocode for the following: d. A...
A: Pseudocode :- start Declaration num idNm String nme String breed num age num weigh num bil num QUIT ...
Q: Write a program that prompts the user to input two POSITIVE numbers — a dividend (numerator) and a d...
A: #include <stdio.h>//The code execution begins from the start of the main() function.int main()...
Q: can you please help me solve this program using C++ language, please try to solve it as simply as po...
A: In the main function, the pointer of type Student is declared. Any size may be assigned to it. In th...
Q: 231 can you please use viual studio thanks and have a great day
A: import java.time.LocalDate; public class Elapsed_Days{ private long elapsed_days=0; ...
Q: Q#03: How Values are stored and accessed in structures?? Also describe the relationship between Stru...
A: Structure is a collection of variables of different data types under a single name. It is similar to...
Q: A new PKI is being built at a company, but the network administrator has concerns about spikes of tr...
A: CRL
Q: Review the IBM history. Describe three distinct phases the company has gone through in reaction to c...
A: Review of the history of the IBM is given below: The full form of the IBM is “International Business...
Q: Problem 1: Write a Bash script that takes the name of a file or directory as an argument, 1. reports...
A: Objective: This program receives an argument and checks if the argument is the name for a file or di...
Q: Please enter all answers as strings of O's and 1's. Consider the 64 bit DES block below. 01000000010...
A: The key : 0100000001000000000100000000000000001000010000000000000000000000 ...
Q: Vehicle Theft DatabaseYou are a participant in an information systems project to design a vehicle th...
A: Hey, since there are multiple questions posted, we will answer first question. If you want any speci...
Q: can I get help writing this program. Everyone I has written gives me no output and I have to have a...
A: C++ program to compute the student's grade for an assignment as a percentage. The percentage is comp...
Q: he Dash Cell Phone Company charges customers a basic rate of $5 per month to send text messages. Add...
A: c)flowchart:-
Q: develop a scenario with a series of logical statements that can be "solved" using kmaps. Once you h...
A: kmap: (Karnaugh-map) is most suitable for minimizing Boolean functions of 2 variables to 5 variables...
Q: CSC 231
A: import java.time.LocalDate; public class Elapsed_Days{ private long elapsed_days=0; public Elapsed_...
Q: Write a program that prints the following diamond shape. You may use printf statements that either a...
A:
Q: What are the possible causes for network congestion? Suggest three possible techniques that can be u...
A: Causes for network congestion: Network congestion is a situation in which there is a increase in da...
Q: Summarise how the convergence between computing, telecommunications and media led to the emergence a...
A: Disruptive technology is one that displaces an established technology and shakes up the industry or ...
Q: Write the body of a function that operates a vending machine according to the problem description an...
A: Depending on the need for code I am not adding a statement that asks user "From selected item, ple...
Q: Please create using C# Develop a form that allows the user to project the population of your city fo...
A:
Q: : DevOps Foundations: Lean and Agile - What is agile?
A: Agile is the iterative approach. It focuses on customer feedback, collaboration and small rapid rele...
Q: How would the objects “use” their respective variables and functions?
A: Step 1:- Given:- The given model is a UML class diagram which is made up of different class and is r...
Q: Using the following chart, write if/elif statements that assigns .10, .15, or .20 to commission, dep...
A: A pictorial representation of steps used to solve a problem is called flowchart. Each symbol used in...
Q: Hi, I need to solve this problem with C++ programming language using Visual Studio. Thank you.
A: Program description: The C++ program that prompts the user to enter the cost of the house, down paym...
Q: Under what circumstances is file downloading through P2P much faster than through a centralized clie...
A: Peer to peer networking is an appropriated application design that allots applications between peers...
Q: You need to answer these questions from the perspective of the it project manager. Q1. What do you ...
A: Q1. The Project Life Cycle refers to the four-step process that is followed by nearly all project ma...
Q: 2. What are the basic elements/steps required for floating point addition? Note, answer with short p...
A: Addition of floating- point numbers S=A+B is more complex than multiplication or division of float...
Q: Which of the following formulas properly produces the string "Income Statemen "Income "Statement "In...
A: The command is Strinh1&""&String2 In that case answer is 2nd option
Q: use python
A:
Q: How do malware authors use social media to spread infection
A: Usage of social media in spreading the malware infection: Malware is defined as the damage that is...
Q: How would the objects “use” their respective variables and functions?
A: How to create class? We declare the class with the “class” keyword. We can write both the data mem...
Q: 7. Is this set finite or infinite? {? ∈ ?| 1 ≤ ? ≤ 2}
A: A set is called finite set if it has a starting point and ending point. A finite set can be counted....
Q: Write a c++ program that requires 5% of the sizeof the array to be reserved as slots for other opera...
A: Program: #include<iostream> #include<cstdlib> using namespace std; //suppose this is siz...
Q: Assume 60 and 34 are signed 8-bit integers. Calculate 60 – 34 in binary. Show your work.
A: Let's convert “60” to two's complement binary. Since this is a positive number, we can directly conv...
Q: 9. Rewrite the following Python code using for loop. count = 100 while count >= 0: print (count) cou...
A: 9. Python code using for loop: for x in range(100,-1,-5): print(x)
Consider the following data: 100, 8, 75, 85, 7, 10, 20, 1, 5, 65,21 Your task is to sort the data in O(nlogn) time. You also have to avoid using extra memory space ( using additional array/arrays) . Now select and apply the appropriate
Step by step
Solved in 2 steps with 12 images
- Please help me the following question Which of the following is true about inserting elements in an unordered array? If you add an element at the beginning of the unsorted array, the performance is O(1) if you first shift all elements and then add the new element at index 0 If you add an element at the beginning of the unsorted array, the performance is O(1) if you move only the first element to the end and then insert the new element at index 0 Because you always have to check to see if the array has room for the new element first, the order will always at least be O(n) None of the above Which of the following is true about deleting elements in an unordered array? The algorithm for deleting an element is to first search for the element to delete and then if found, remove it and fix the hole in the array The reason why we must fix the hole in the array after a delete is to ensure the insert, search, and update algorithms still work as designed Fixing a hole in the array…There is an array with the original content as follows61,12,95,89,65,23,45,78,57,33Now execute Insertion sort, from small to large, please write the contents of the array after Pass 3We have chosen a problem which is locating a number within an array. we'll be working with the following set of nine numbers for binary searches:4, 10, 15, 18, 23, 26, 30, 34, 40Our objective is to pinpoint the number 26 within this array.The segment will explain how to conduct a binary search to locate the number 26 within this array.Can you please write a diagram how to do locate the number 26 using binary search so I can understand I understand more with graphs or boxes. Can you explain why bineary search is better than linear search using the number 26. This does not involve code.
- Sort the following array in decreased manner using insertion sort [12, 2, 5, 10, 15, 27,4], then sort the same array another time in increased manner and compare between the number of swaps in the two casesBelow is how the arrays are represented ARRAY1[] = [1, 5, 6, 6, 9, 9, 9, 11, 11, 21] Here length of ARRAY1 is m. ARRAY2[] = [6, 6, 9, 11, 21, 21, 21] Here length of ARRAY2 is n. Array to be returned would be: ARRAY[] = [6, 9, 11, 21] ATTN : Further, please be reminded that you cannot use library functions to either sort and or perform the de-duplication operation. solve the problem in two ways In a separate implementation, code up a solution in such a way that your solution solves the problem with O(nlog(m)) time complexity 2 or O(mlog(n)) time complexity. Here log means to the base of 2. I’m sure you already know that the hint is to use Binary Search. In the form of sentences, as a comment in your code (at the bottom of your Solution2), you are required to suggest how can Solution2 be improved by leveraging the fact that both the arrays are already sorted. Suggest a solution so that your suggested solution can run linearly with O(m + n) time complexity. Your suggestion should be no…make an algorithm using the procedure to display the contents of a defined array, Array B[10] = (9, 11, 23, 7, 8, 20, 77, 22, 10, 6)
- Every time it has to identify two arrays to combine, perform the following to create a bottom-up mergesort that benefits from array order: Locate the first entry in a sorted subarray, then the second, and finally merge them (by increasing a pointer until it finds an element in the array that is smaller than its predecessor). Consider the array size and the number of maximal ascending sequences in the array when calculating the algorithm's execution time.1a) Insertion sort is chosen to sort this array, write the contents of the array each time that the sort algorithm changes it. How many comparison operations and how many swaps are performed in the sorting? b) Usually, one swap operation equals seven comparison operations in terms of their executing time. By comparing the number of swap and comparison operations of each of the above sort algorithms, which of these sort methods is most efficient in sorting this array?Below is the exercise for unsorted arrays. True or False: For each statement below, indicate whether you think it is True or False 3) For the insert function, if the array is empty, there are no comparison operations that need to be performed and you can immediately add the new element 5) Because the update algorithm depends on using linear search, its performance is O(1) in the worst case scenario 6) If you search for and delete an element in an unsorted array and then shift the rest of the elements to fill the hole, the worst case performance is O(n) 7) If you search for and delete an element in an unsorted array and then move the last element to fill the hole, the worst case performance is O(n)
- Given the following array: 65, 15, 129, 22, 12, 10, 239, 334, 10, 111, 180, 1, 2 What will be the array contents looking like in the following situations: 1) after calling the partition method three times in quick sort if pivot is the last element. 2) after the third iteration of the outer loop in insertion sort. 3) after the third iteration of the outer loop in Selection sort.Wap Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Clarification: Confused why the returned value is an integer but your answer is an array? Note that the input array is passed in by reference, which means a modification to the input array will be known to the caller as well. Internally you can think of this: // nums is passed in by reference. (i.e., without making a copy) int len = removeDuplicates(nums); // any modification to nums in your function would be known by the caller. // using the length returned by your function, it prints the first len elements. for (int i = 0; i < len; i++) { print(nums[i]); } Example 1: Input: nums = [1,1,2] Output: 2, nums = [1,2] Explanation: Your function should return length = 2, with the first two elements of nums being 1 and 2…Question 5 The following array of integers are to be sorted into ascending order: 4 2 10 8 6 12 If selection sort is chosen to sort this array, write the contents of the array each time that the sort algorithm changes it. How many comparison operations and how many swaps are performed in the sorting?