Question

In: Computer Science

Choice 1. You are the new software developer at work. You are brought into a meeting...

Choice 1. You are the new software developer at work. You are brought into a meeting with clients that do not understand the idea of sorting data. Now you know, that you cannot use complex math to explain, but you can illustrate in diagrams. Basically, this group has been working with unsorted data and you must explain why their searches and reports will be so much faster with sorted data. You do not know anything specific about their data, but you want to sell them on the idea that their data should get sorted to quickly fulfill their current demands.

Illustrate how quicksort, insertion sort, and merge sort work. The idea of this is to show the clients that sorting is very common and beneficial.

Explain the following:

  • Why sorting is beneficial to searching?
  • How each sort works? What data type or structure does it work best on?
  • The benefits or possible issues when the number of items being sorted increases (big 0, for non Big 0 people).
  • Use for each sort a set of 9 numbers and diagram each set for each sort. So....that means you would have 3 sets of diagrams.
  • Attach your files when you are finished.

Remember, you want to explain but not make it too complicated.

Solutions

Expert Solution

Insertion sort

Insertion sort is a simple sorting algorithm that works similar to the way you sort playing cards in your hands. The array is virtually split into a sorted and an unsorted part. Values from the unsorted part are picked and placed at the correct position in the sorted part.

Algorithm
To sort an array of size n in ascending order:
1: Iterate from arr[1] to arr[n] over the array.
2: Compare the current element (key) to its predecessor.
3: If the key element is smaller than its predecessor, compare it to the elements before. Move the greater elements one position up to make space for the swapped element.

Merge Sort

Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The "merge" function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.

Quick Sort

Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. There are many different versions of quickSort that pick pivot in different ways.

  1. Always pick first element as pivot.
  2. Always pick last element as pivot (implemented below)
  3. Pick a random element as pivot.
  4. Pick median as pivot.

The key process in quickSort is partition(). Target of partitions is, given an array and an element x of array as pivot, put x at its correct position in sorted array and put all smaller elements (smaller than x) before x, and put all greater elements (greater than x) after x. All this should be done in linear time.


Related Solutions

Andrew, a highly qualified and experienced software developer, has just started work with a government health...
Andrew, a highly qualified and experienced software developer, has just started work with a government health department on a project that has been underway for about 9 months. He is replacing a novice developer who has decided to move on to a new project with another organisation. Even though the current system is incomplete, it has is being used with 'live' data. On analysing what's been done so far, Andrew discovers that the system is poorly designed and is riddled...
Andrew, a highly qualified and experienced software developer, has just started work with a government health...
Andrew, a highly qualified and experienced software developer, has just started work with a government health department on a project that has been underway for about 9 months. He is replacing a novice developer who has decided to move on to a new project with another organisation. Even though the current system is incomplete, it has is being used with 'live' data. On analysing what's been done so far, Andrew discovers that the system is poorly designed and is riddled...
You are working as the software developer and need to identify the best sorting algorithm. You...
You are working as the software developer and need to identify the best sorting algorithm. You can pick any two-sorting algorithm. You need to determine which sorting algorithm is the best to sort the array of 10k elements. Use the following steps to help with your solution: Create C++ functions for any two-sorting algorithm. Write down the random array generation function to generate at least 10k elements. Pass the same array into both the sorting algorithm. Calculate the end transactiontime-start...
You are working as a software developer for a large insurancecompany. Your company is planning...
You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score.Your Java program should perform the following things:Take the input from the user about the patient name, weight, birthdate, and height.Calculate Body Mass Index.Display person name and BMI Category.If the BMI Score...
You are a renowned software developer and you have been hired by an old British boyband...
You are a renowned software developer and you have been hired by an old British boyband that wants to make a comeback in the industry. They ask you to make an app to showcase their new music and events. In your implementation, you have a class for each of the 5 group members, but you find that compiling each band member’s class takes more time than you currently have. Luckily, you remember that you learned about Makefiles in your favorite...
You are working as a software developer for a large insurance company. Your company is planning...
You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score. Your Java program should perform the following things: Take the input from the user about the patient name, weight, birthdate, and height. Calculate Body Mass Index. Display person name and BMI...
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a...
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a Company to implement a prototype for its payroll system. You receive the following specifications: If an employee works more than its regular hours, it is considered overtime and it will be paid based on the employee’s experience. All employees are paid biweekly (80 hours) Employee taxes: 1% This company manages three categories of workers based on employee’s experience. Group 1 (Silver) o Pay rate:...
A software developer has created a new dating app that she thinks users will prefer over...
A software developer has created a new dating app that she thinks users will prefer over current options. She samples 260 millennials, and randomly splits them into 2 evenly-sized separate samples: the New Dating App Group and the Tinder Group. The dependent variable is self-reported satisfaction of the app on a 1-10 scale. Choose the best statistical test for this research design. A. Repeated Measures ANOVA B. Correlation C. Independent measures t-test D. Regression
16. A developer of video game software has seven proposals for new games. Unfortunately, the company...
16. A developer of video game software has seven proposals for new games. Unfortunately, the company cannot develop all the proposals because its budget for new projects is limited to $950,000, and it has only 20 programmers to assign to new projects. The financial requirements, returns, and the number of programmers required by each project are summarized in the following table. Projects 2 and 6 require specialized programming knowledge that only one of the programmers has. Both of these projects...
1. Suppose that a software developer is creating a program to store lists of supermarket products....
1. Suppose that a software developer is creating a program to store lists of supermarket products. Each product has a code made up of the digits 0 and 1, for example 010011010000, and an availability, either yes or no. Further suppose that the software developer decides to store the lists in base-10, believing that base-10 will simplify calculations. Briefly explain why this is a bad idea.  
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT