Polished essays

Have any queries?  send us an email

Login
Live Chat
  • Home
  • Our services
  • How it works
  • Pricing
  • About us
  • Contact us
Order Now

  • Home
  • Our services
  • How it works
  • Pricing
  • About us
  • Contact us
Order Now

Explain What Is Meant By Divide And Conquer, Give An Example Of How A Divide And Conquer: Algorithm Design & Problem Solving Assignment

Assignment Questions:

Question 1:

1. (a) Explain what is meant by Divide and Conquer, give an example of how a Divide and Conquer algorithm improved the performance of an algorithm you have studied.

(b) i) Using pseudocode, write an iterative algorithm to calculate the sum of numbers in an array.
ii) Draw a flowchart of your algorithm –use your preferred flowcharting tool and insert an image into your answer document or draw by hand and insert the photo.

(c) For the algorithm in (b), use pseudocode to write a recursive algorithm to find the sum of the numbers. What is its time efficiency – explain your answer with reference to the call stack.

Question 2:

2. (a) The mean of a sequence of numbers is the sum of all numbers in a sequence divided by the number of numbers. Using pseudocode write an algorithm to find the mean of a number sequence in an array.

intgetMean (int a[])

(b) The median is the middle value of a list of numbers. To find the median list the numbers from smallest to largest, then find the midpoint. If the number of numbers is even, add the two numbers adjacent to the midpoint and average them.

Using pseudocode, write an algorithm to calculate the median of a list of numbers.

int getMedian (int a[] )

(c) Using pseudocode, write an algorithm to find the kth smallest element of an unsorted array. What is the time complexity of the algorithm? Describe how you would improve it to run in O(Nlog(N)) or better?

Question 3:

3. (a) The following algorithm has a number of errors in it.

for i = 0 to i < N-1 do
min = A[i]
for j = i to j < N do
if A[j] < A[min] then
min = A[j]
temp = A[min]
A[min] = A[i]
A[i] = temp
End for

What is the name of this algorithm?

(b) Outline 4 issues with the algorithm, clearly explaining each one.

(c) Illustrate how the insertion sort algorithm would sort the following sequence:- 9, 3,4,5,7, 8, 6, 2

Your answer should show the state of the array at the end of each processing cycle in the algorithm.

How does the insertion sort compare the algorithm in (a) if the list to be sorted is:- 1,2,4,3,5,6,7,8

Services at a glance
  • Essay writing
  • Dissertation
  • Thesis
  • Research paper
  • Coursework
  • Term Paper
  • Case Study
  • Editing/Profreading
Free assistance
  • Amendments $0
  • Title page $0
  • Outline $0
  • E-mail delivery $0
  • Editing $0
  • Bibliography $0
Customers reviews

Awesome writing service!

Got a clean A. I had the writer revise a few areas and I’m here… Read more “Awesome writing service!”

This service is always on time

When you thought completing  a 4-page in one hour was impossible and bam! your writer… Read more “This service is always on time”

Working and studying at the same time is real trouble.

I have really struggled to work to pay bills and study with all the assignments… Read more “Working and studying at the same time is real trouble.”

Way to go, EssayWriting!

With all the stuff going on, I have been doing doordash to make a living.… Read more “Way to go, EssayWriting!”

About us

We are a leading essay writing platform where quality, confidentiality, reliability, and originality are paramount.

Best essay writers

Our writers have minimum Master degrees, and a vast experience in professional academic writing.

Make your payment from a trusted vendor

 

© 2020 Polishedessays. All Rights Reserved.