Given an array A of n + m elements. It is know that the first n elements in A are sorted and the last m elements in A are unsorted. Suggest an algorithm (only pseudo code) to sort A in O(mlogm +n) worst case running time complexity. Justify.

Answers

Answer 1
Answer:

Answer:

Explanation:

We can divide array A into two arrays B , C

B would contain the sorted n elements.

C would contain the unsorted m elements.

Now we can sort C using merge sort with worst time complexity mlogm.

When you will have array C sorted you can concatenate with B and put it back in A.


Related Questions

Describe how the Internet Protocol (IP) allows devices to easily connect and communicate on the Internet.
A computer professional who has access to sensitive information shares this information with a third party. Which professional code of conduct did the person violate? A. diligence in service B. company discipline norms C. confidentiality of information D. conflict of interest
IN PYTHON Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, and output all integers less than or equal to that value. Ex: If the input is: Enter the number of integers in your list: 5 Enter the 5 integers: 50 60 140 200 75 Enter the threshold value: 100 the output is: The integers that are less than or equal to 100 are: 50 60 75The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. Such functionality is common on sites like Amazon, where a user can filter results. Your code must define and call the following two functions: def get_user_values() def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold) Utilizing functions will help to make your main very clean and intuitive.
To define constructors and member functions outside of a class's original scope, the operator can be used.
Conduct research to determine the best network design to ensure security of internal access while retaining public website availability.

Which key do programmers use to end running programs?Num Lock
Scroll Lock
Pause/Break
Backspace

Answers

I would answer backspace because i had some experience with that
Pause/Break   i would say

Before a structure can be used, it must beA.
declared

B.
deallocated

C.
initialized

D.
All of the above

Answers

Answer:

A. declared

Explanation:

Before a structure can be used, it must be  declared.

For example:

// Structure definition

struct s{

int a;

char b;

};

// Structure instantiation

struct s  mystruct;

// This is where a structure instance called mystruct is created whose

// datatype is struct s.

mystruct.a = 10;

mystruct.b = 'c';

As we can see from the example definition precedes use for the structure.

#Write a function called string_finder. string_finder should #take two parameters: a target string and a search string. #The function will look for the search string within the #target string. # #The function should return a string representing where in #the target string the search string was found: # # - If search string is at the very beginning of target # string, then return "Beginning". For example: # string_finder("Georgia Tech", "Georgia") -> "Beginning" # # - If search string is at the very end of target string, # then return "End". For example: # string_finder("Georgia Tech", "Tech") -> "End" # # - If search string is in target string but not at the # very beginning or very end, then return "Middle. For # example: # string_finder("Georgia Tech", "gia") -> "Middle" # # - If search string is not in target string at all, then # return "Not found". For example: # string_finder("Georgia Tech", "Idaho") -> "Not found" # #Assume that we're only interested in the first instance #of the search string if it appears multiple times in the #target string, and that search string is definitely #shorter than target string. # #Hint: Don't be surprised if you find that the "End" case #is the toughest! You'll need to look at the lengths of #both the target string and the search string. #Write your function here!

Answers

Answer:

I am writing a Python program:

def string_finder(target,search): #function that takes two parameters i.e. target string and a search string

   position=(target.find(search))# returns lowest index of search if it is found in target string

   if position==0: # if value of position is 0 means lowers index

       return "Beginning" #the search string in the beginning of target string

   elif position== len(target) - len(search): #if position is equal to the difference between lengths of the target and search strings

       return "End" # returns end

   elif position > 0 and position < len(target) -1: #if value of position is greater than 0 and it is less than length of target -1

       return "Middle" #returns middle        

   else: #if none of above conditions is true return not found

       return "not found"

#you can add an elif condition instead of else for not found condition as:

#elif position==-1    

#returns "not found"

#tests the data for the following cases      

print(string_finder("Georgia Tech", "Georgia"))

print(string_finder("Georgia Tech", "gia"))

print(string_finder("Georgia Tech", "Tech"))

print(string_finder("Georgia Tech", "Idaho"))

Explanation:

The program can also be written in by using string methods.

def string_finder(target,search):  #method definition that takes target string and string to be searched

       if target.startswith(search):  #startswith() method scans the target string and checks if the (substring) search is present at the start of target string

           return "Beginning"  #if above condition it true return Beginning

       elif target.endswith(search):  #endswith() method scans the target string and checks if the (substring) search is present at the end of target string

           return "End"#if above elif condition it true return End

       elif target.find(search) != -1:  #find method returns -1 if the search string is not in target string so if find method does not return -1 then it means that the search string is within the target string and two above conditions evaluated to false so search string must be in the middle of target string

           return "Middle"  #if above elif condition it true return End

       else:  #if none of the above conditions is true then returns Not Found

           return "Not Found"

PLEASE HELP!!!For this activity, you will create two designs for the same project. For example, you might choose to create a CD cover for your favorite band’s newest release, or you might want to design a menu for the local deli. No matter what you decide for your subject matter, the two designs must involve different media. One of these media will be an image-editing program, such as Inkscape. You will learn more about the basic tools available in Inkscape later in this lesson. The two designs should incorporate different techniques. For example, you might make one design abstract, while making the other more realistic. Be sure to save both of your designs. Scan or take a picture of the design that wasn’t created in an image-editing program. You will submit this item later in this lesson as your portfolio item. Select the link to access the Techniques Activity Rubric.

Answers

Answer:

I'm not exactly sure on what the question is, but from reading it, I determined that you'll be creating 2 different designs using Inkscape/Photoshop. I'm leaving 2 of my designs in here for you to use on your project. Unknown on what to do about the design that wasn't created in an image-editing program.

Write a method called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the number consists entirely of odd digits (1, 3, 5, 7, 9) and false if any of its digits are even (0, 2, 4, 6, 8). For example, the call allDigitsOdd(135319) returns true but allDigitsOdd(9145293) returns false.

Answers

Answer:

Sample output:

Enter integer 3232423

true

Enter integer 12131231

false

Explanation:

Above is the output of the program and for the solution check the screenshots attach to understand clearly the program.

Thanks

Andre is finding working in an online group challenging because there are people in the group from many different cultural backgrounds. Which are the three major areas that present challenges to students in such situations?​

Answers

Answer:

When working in multicultural groups, students may find challenges in the areas of language barriers, social behavior expectations, and communication style differences.

Explanation:

Answer:

Different Communication Styles

Different Attitudes Toward Conflict

Different Approaches to Completing Tasks

Different Decision-Making Styles

Different Attitudes Toward Disclosure

Different Approaches to Knowing

Explanation: