Question

Need help to better understand this and how it works... What do you consider to be...

Need help to better understand this and how it works...

What do you consider to be the first and second priority in a sorting algorithm; and justify a key word or phrase to place in the string that is crucial. Provide a short pseudocode example in your discussion post to defend your thoughts. Explain your reasoning for selecting your first and second priorities.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Algorithm: It is a step by step process to solve a particular problem or Task.

Sorting: Arrange the elements either in ascending or descending order.

Priority: Very Important. It will look like as some VIP person/Urgent/Emergency.

Sorting can be classified as two types.

1. Internal Sorting- Bubble sort, Insertion sort, Quick sort1

2. External sorting- Radix/Bucket sort, Merge sort

One of the operation in data structure which plays a role in processing of data is “Sorting” which organizes the records in some logical order, i.e. either in ascending order or in descending order.The main advantage of sorting application is that it requires less time to search for a particular element compared to unsorted list of elements.

We have to perform many attempts made to analyze and reduce the complexity of various algorithm. Also improved sorting algorithms have been proposed to get better efficiency in terms of time and memory. The performance of each sorting algorithm is based on the data being sorted and the machine used for sorting.

The sorting algorithm performs two operations: 1. Compare 2. Swap

The sorting of elements can be done on the basis of priority which we want to display the element first and then remaining list of elements. But the problem arises here is that they are displaying all the records on the basis of priorities, which consumes same amount of time. We are proposing an algorithm which will display required records only as per user’s choice on the basis of priorities and attributes. So, that we can save time.

Advantages:

- Apply priority based sorting on multiple attributes of records.

- Save time on the basis of number of operations.

Algorithm:

1. Insert the List of Elements which you want to sort and assign the priority to each element.

2. Sort the elements on the basis of the Elements order

3. Displays the sorted list of elements.

4. Exit

Pseudo Code:

Input: a collection S storing n elements

Output: the collection S

sorted P = new PQueue()

while !S.isEmpty()

do e = S.removeFirst()

P.insert(e)

while !P.isEmpty()

e = P.removeMin()

S.addLast(e)

INSERTION-SORT(A)

for j ←2 to length[A]

do

key ← A[j]

Insert A[j] into the sorted sequence

A[1 j- 1]. i ← j- 1

while i> 0 and A[i] > key

do

A[i+ 1] ← A[i]

i ← i- 1

A[i+ 1] ← key

The Best example to use this type is Priority Queue with the help of Insertion sort.

Add a comment
Know the answer?
Add Answer to:
Need help to better understand this and how it works... What do you consider to be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • So I'm not sure what I'm trying to do here. I don't understand how *adr works,...

    So I'm not sure what I'm trying to do here. I don't understand how *adr works, I guess it's a pointer to the struct Address. How do I complete this function? And how would I have it just return the zip code or one element if I wanted to? I have two structs: struct Address {    int number; // street number    string street; // street Name    string city; // city    short zip; // zip code   ...

  • Background: For this assignment, you will write a small encryption utility that implements a simple encryption...

    Background: For this assignment, you will write a small encryption utility that implements a simple encryption algorithm described below. The program will take one command line argument as an input; this will represent the word which is to be encrypted. As an output, your program will print the encrypted version of the word to the console using a simple printf() statement. This is the only output your program needs to produce. There is an important catch, however: your program is...

  • I need help in C++ implementing binary search tree. I have the .h file for the...

    I need help in C++ implementing binary search tree. I have the .h file for the binary search tree class. I have 4 classic texts, and 2 different dictionaries. Classic Texts: Alice In Wonderland.txt A Tale of Two Cities.txt Pride And Prejudice.txt War and Peace.txt 2 different dictionaries: Dictionary.txt Dictionary-brit.txt The data structures from the standard template library can not be used.The main program should open the text file, read in the words, remove the punctuation and change all the...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • 1 Overview The goal of this assignment is to help you understand caches better. You are...

    1 Overview The goal of this assignment is to help you understand caches better. You are required to write a cache simulator using the C programming language. The programs have to run on iLab machines. We are providing real program memory traces as input to your cache simulator. The format and structure of the memory traces are described below. We will not give you improperly formatted files. You can assume all your input files will be in proper format as...

  • Have you ever considered how we come to understand the world around us? Think about that question for a minute. What is...

    Have you ever considered how we come to understand the world around us? Think about that question for a minute. What is science, and how do we use it to solve real-world problems? In our first discussion, I want to delve into thinking about the nature of biology. This includes what it is, the major themes, and how we come to form claims or knowledge. You should spend approximately 3 hours on this assignment. Instructions Use the text readings and...

  • PLEASE HELP WITH A RESPONSE TO MY CLASSMATES DISCUSSION POST BELOW.... I DO NOT NEED ANSWERS...

    PLEASE HELP WITH A RESPONSE TO MY CLASSMATES DISCUSSION POST BELOW.... I DO NOT NEED ANSWERS TO THE QUESTIONS BELOW, JUST A RESPONSE TO HER POST LIKE AN OPINION ON HER ANSWERS........ THANK YOU! How to communicate an impending company-wide layoff Wide layoffs need a painstaking plan ahead of time in view of the fact that it will affect people’s lives especially their finances. The best channel to convey this type of communication is a vital part to avoid conflicts...

  • Hey guys I need help with this assignment. However it contains 7 sub-problems to solve but I figured only 4 of them can...

    Hey guys I need help with this assignment. However it contains 7 sub-problems to solve but I figured only 4 of them can be solved in one post so I posted the other on another question so please check them out as well :) Here is the questions in this assignment: Note: Two helper functions Some of the testing codes for the functions in this assignment makes use of the print_dict in_key_order (a dict) function which prints dictionary keyvalue pairs...

  • **DO IT AS PYTHON PLEASE** The Trifid Cipher General Problem Description The Trifid cipher (not to be confused with the...

    **DO IT AS PYTHON PLEASE** The Trifid Cipher General Problem Description The Trifid cipher (not to be confused with the creatures from the classic science-fiction film "The Day of the Triffids") is an algorithm that enciphers a plaintext message by encoding each letter as a three-digit number and then breaking up and rearranging the digits from each letter's encoded form. For this assignment, you will create a set of Python functions that can encode messages using this cipher (these functions...

  • My topic is diabetes 597690/viewContent/7888874/View The Science of Popular Diets The Impact of Nutrition Practices on...

    My topic is diabetes 597690/viewContent/7888874/View The Science of Popular Diets The Impact of Nutrition Practices on Human Wellness Understanding the Dietary Needs of Special Populations Consider that up until this point in Module 2, we have been focused on the nutritional needs and diet plans for healthy, adult individuals. The AMDRS used to calculate caloric needs have been determined to fit a general population of these individuals. In addition, there has been little need to consider deficiencies or toxicities of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT