Premium Essay

Sort

In:

Submitted By fahadm
Words 1753
Pages 8
2010 Fourth Asia International Conference on Mathematical/Analytical Modelling and Computer Simulation

Clump Sort: A Stable Alternative To Heap Sort For Sorting
Medical Data
Visvasuresh Victor Govindaswamy

Matthew Caudill

Jeff Wilson

Computer Science
Texas A&M University-Texarkana
Texarkana, USA lovebat814@yahoo.com Computer Science
Texas A&M University-Texarkana
Texarkana, USA

Computer Science
Texas A&M University-Texarkana
Texarkana, USA

Daniel Brower

G. Balasekaran, FACSM

Computer Science
Texas A&M University-Texarkana
Texarkana, USA

Medical and Sports Science
Nanyang Technology University
Singapore

Abstract—Sorting data sets are a thoroughly researched field.
Several sorting algorithms have been introduced and these include Bubble, Insertion, Selection, Shell, Quick, Merge and
Heap. In this paper, we present a novel sorting algorithm, named Clump Sort, to take advantage of ordered segments already present in medical data sets. It succeeds in sorting the medical data considerably better than all the sorts except when using totally non-clumped data. In this test using totally nonclumped data, Heap sort does only slightly better than Clump sort. However, Clump sort has the advantage of being a stable sort as the original order of equal elements is preserved whereas in Heap sort, it is not since it does not guarantee that equal elements will appear in their original order after sorting.
As such, Clump Sort will have considerably better data cache performance with both clumped and non-clumped data, outperforming Heap Sort on a modern desktop PC, because it accesses the elements in order. Sorting equal elements in the correct order is essential for sorting medical data.

competitive for world situations, especially dealing with large unsorted data sets. On the other hand, Shell sort, a modification of the Insertion sort algorithm, employs more
efficient

Similar Documents

Premium Essay

Clump Sort

...Computer Simulation Clump Sort: A Stable Alternative To Heap Sort For Sorting Medical Data Visvasuresh Victor Govindaswamy Computer Science Texas A&M University-Texarkana Texarkana, USA lovebat814@yahoo.com Matthew Caudill Computer Science Texas A&M University-Texarkana Texarkana, USA Jeff Wilson Computer Science Texas A&M University-Texarkana Texarkana, USA Daniel Brower Computer Science Texas A&M University-Texarkana Texarkana, USA G. Balasekaran, FACSM Medical and Sports Science Nanyang Technology University Singapore Abstract—Sorting data sets are a thoroughly researched field. Several sorting algorithms have been introduced and these include Bubble, Insertion, Selection, Shell, Quick, Merge and Heap. In this paper, we present a novel sorting algorithm, named Clump Sort, to take advantage of ordered segments already present in medical data sets. It succeeds in sorting the medical data considerably better than all the sorts except when using totally non-clumped data. In this test using totally nonclumped data, Heap sort does only slightly better than Clump sort. However, Clump sort has the advantage of being a stable sort as the original order of equal elements is preserved whereas in Heap sort, it is not since it does not guarantee that equal elements will appear in their original order after sorting. As such, Clump Sort will have considerably better data cache performance with both clumped and non-clumped data, outperforming Heap Sort on a modern desktop PC...

Words: 1753 - Pages: 8

Free Essay

Quick Sort Algorithm

... Quick Sort Implementation Next, recall that our goal is to partition all remaining elements based on whether they are smaller than or greater than the pivot We will find two entries: – One larger than the pivot (staring from the front) – One smaller than the pivot (starting from the back) which are out of order and then correct the ordering – I.e., swap them 1 7.6.5 Quick Sort Implementation Continue doing so until the appropriate entries you find are actually in order The index to the larger entry we found would be the first large entry in the list (as seen from the left) Therefore, we could move this entry into the last entry of the list We can fill this spot with the pivot 2 7.6.5 Quick Sort Quick Sort Example First, we examine the first, middle, and last entries of the full list The span below will indicate which list we are currently sorting 3 7.6.5 Quick Sort Quick Sort Example We select 57 to be our pivot – We move 24 into the first location 4 7.6.5 Quick Sort Quick Sort Example Starting at the 2nd and 2nd-last locations: – we search forward until we find 70 > 57 – we search backward until we find 49 < 57 5 7.6.5 Quick Sort Quick Sort Example We swap 70 and 49, placing them in order with respect to eachother 6 7.6.5 Quick Sort Quick Sort Example We search forward until we find 97 > 57 We search backward until we find 16 < 57 7 7.6.5 Quick Sort Quick Sort Example ...

Words: 1243 - Pages: 5

Premium Essay

Sort Ofs

...Lovely R. Esguerra Mica Ysabelle C. Fernando Sonieper B. Gaspar Rose Ann B. Landicho Rizza Mae Y. Medina Angelica Rose P. Morelos Mark Alfred Pajarillo Mikelle Justin L. Raiz Aicon R. Villanueva BSBA 1-7 What is climate change? Climate change is a long-term shift in the statistics of the weather (including its averages). For example, it could show up as a change in climate normal’s (expected average values for temperature and precipitation) for a given place and time of year, from one decade to the next. We know that the global climate is currently changing. The last decade of the 20th Century and the beginning of the 21st have been the warmest period in the entire global instrumental temperature record, starting in the mid-19th century. Climate change, also called global warming, refers to the rise in average surface temperatures on Earth. An overwhelming scientific consensus maintains that climate change is due primarily to the human use of fossil fuels, which releases carbon dioxide and other greenhouse gases into the air. The gases trap heat within the atmosphere, which can have a range of effects on ecosystems, including rising sea levels, severe weather events, and droughts that render landscapes more susceptible to wildfires. Climate change is a large-scale, long-term shift in the planet's weather patterns or average temperatures. Earth has had tropical climates and ice ages many times in its 4.5 billion...

Words: 8168 - Pages: 33

Premium Essay

Sort Paper

...Short Paper At the creation of the United States, the states were assumed to have the power and authority of self-governing nations. Each state has the general power to protect the health of its population within its geographic borders as long as the laws do not obstruct the rights of individuals guaranteed by the constitution. The federal government regulates health matters through the powers granted to the federal government in the federal constitution. This allows the federal government to create benefit programs and to indirectly regulate local activities that it would not have the authority to regulate directly. For example, the federal government created the Medicare program to pay for health care for the elderly and disabled, and Medicaid to pay for health care for the poor. Health care institutions that receive federal money in payment for services to Medicare and Medicaid recipients have to abide by federal regulations in order to keep receiving federal funds. According to Pozgar (2012), “a tort law is a civil wrong, other than a breach of contract, committed against a person or property for which a court provides a remedy in the form of an action for damages”. Within the general field of health care there is a good deal of discussion of tort law and health care because tort actions comprise what are more commonly known as medical malpractice or medical negligence actions. A medical malpractice or medical negligence suit can be raised against a physician or health...

Words: 892 - Pages: 4

Free Essay

Reserch Paper on Sorting and Dictionaries

...dronacharya.info, Ashish Gupta Department of Information and technology Dronacharya College of Engineering, Gurgaon-122001, India Email:ashish.16907@ggnindia.dronacharya.info Abstract-Arrays and linked lists are two basic data structures used to store information. We may wish to search, insert or delete records in a database based on a key value. This section examines the performance of these operations on arrays and linked lists. In this research paper we studied about the sorting and types of sorting. This is followed by techniques for implementing dictionaries, structures that allow efficient search, insert, and delete operations. We have also illustrated algorithms that sort data and implement dictionaries for very large files Keywords-insertion sort, quick sort, sort ,binary search tree, skip list. 1. Introduction Arrays and linked lists are two basic data structures used to store information. We may wish to search, insert or delete records in a database based on a key value. This section examines the performance of these operations on arrays and linked lists. 1.1 Arrays Figure 1-1 shows an array, seven elements long, containing numeric values. To search the array sequentially, we may use the algorithm in Figure 1-2. The maximum number of comparisons is 7, and occurs when the key we are searching for is in A[6]. Figure 1-1: An Array int function SequentialSearch(Array A , int Lb, int Ub, int Key ); begin for i= Lbto Ub do ...

Words: 2248 - Pages: 9

Free Essay

Blah

...LIST OF PRACTICALS OF C++ (CLASS XII) 1. WRITE MENU DRIVEN PROGRAM TO SHOW FOLLOWING OPERATIONS IN A 1-D ARRAY (USING USER DEFINED FUNCTION) MENU 1. CREATION OF AN ARRAY 2. SEARCHING ARRAY USING - 3. LINEAR SEARCH METHOD. BINARY SEARCH METHOD. SORTING ARRAY USING - SELECTION SORT - BUBBLE SORT - INSERTION SORT - MERGE SORT 4. INSERTING AN ELEMENT AT iTH POSITION 6. DELETING AN ELEMENT FROM AN ARRAY 7. 2. MERGE TWO ARRAYS OF INTEGERS IN ASCENDING OR DESCENDING ORDER 5. QUIT WRITE MENU DRIVEN PROGRAM TO SHOW FOLLOWING OPERATIONS IN A 2-D ARRAY (USING USER DEFINED FUNCTION) MENU 1. ADDING TWO 2-D ARRAYS 2. SUBSTRACTING TWO 2-D ARRAYS 3. MULTIPLYING TWO 2-D ARRAYS 4. CHECK WHETHER TWO 2-D ARRAYS ARE EQUIVALENT OR NOT 5. DISPLAY UPPER TRIANGULAR MATRIX 6. DISPLAY LOWER TRIANGULAR MATRIX 7. DISPLAY AND FIND SUM OF DIAGONAL ELEMENTS OF A 2-D ARRAY 8. DISPLAY AND FIND THE ROW-WISE SUM OF A 2-D ARRAY 9. DISPLAY AND FIND THE COLUMN-WISE SUM OF A 2-D ARRAY 10. QUIT 3. USING STRUCTURES WRITE A MENU DRIVEN PROGRAM TO ADD, SUBTRACT AND MULTIPLY AND DIVIDE TWO COMPLEX NUMBERS 4. USING STRUCTURES WAP TO CHECK THE VALIDY OF DATE 5. WRITE A PROGRAM TO DEFINE THE CLASS WORKER SHOWN BELOW CLASS WORKER ( PRIVATE : WNAME CHARACTER (20), WNO INTEGER, WGRATE FLOAT, HOURLYWAGERATE FLOAT, TOTWAGE FLOAT, CALCWAGE(HRWG,WGRATE) PUBLIC...

Words: 944 - Pages: 4

Free Essay

Systems

...Component 01 - Computing Principles | AS-Level (H046) | A-Level (H446) | 1 The characteristics of contemporary processors, input, output and storage devices | Structure and function of the processor | The Arithmetic and Logic Unit (ALU), Control Unit and registers: Program Counter (PC), Accumulator (ACC), Memory Address Register (MAR), Memory Data Register (MDR), Current Instruction Register (CIR).Buses: data, address and control: How this relates to assembly language programs.The fetch-decode-execute cycle, including its effect on registers.The factors affecting the performance of the CPU, clock speed, number of cores, cache.Von Neumann, Harvard and contemporary processor architecture. | The use of pipelining in a processor to improve efficiency. | Types of processor | The differences between, and uses of, CISC and RISC processors.Multicore and parallel systems. | GPUs and their uses (including those not related to graphics). | Input, output and storage | How different input output and storage devices can be applied as a solution of different problems.The uses of magnetic, flash and optical storage devices.RAM and ROM.Virtual storage. | | 2 Software and software development | Operating systems | The need for, function and purpose of operating systems.Memory management (paging, segmentation and virtual memory).Interrupts, the role of interrupts and Interrupt Service Routines (ISR), role within the fetch decode execute cycle.Scheduling: round robin, first come...

Words: 1302 - Pages: 6

Free Essay

Thesis

...1. Factorial program in cFactorial program in c: c code to find and print factorial of a number, three methods are given, first one uses for loop, second uses a function to find factorial and third using recursion. Factorial is represented using '!', so five factorial will be written as (5!), n factorial as (n!). Alson! = n*(n-1)*(n-2)*(n-3)...3.2.1 and zero factorial is defined as one i.e. 0! = 1. #include <stdio.h>   int main() { int c, n, fact = 1;   printf("Enter a number to calculate it's factorial\n"); scanf("%d", &n);   for (c = 1; c <= n; c++) fact = fact * c;   printf("Factorial of %d = %d\n", n, fact);   return 0; } 2. c program to check odd or evenc program to check odd or even: We will determine whether a number is odd or even by using different methods all are provided with a code in c language. As you have study in mathematics that in decimal number system even numbers are divisible by 2 while odd are not so we may use modulus operator(%) which returns remainder, For example 4%3 gives 1 ( remainder when four is divided by three). Even numbers are of the form 2*p and odd are of the form (2*p+1) where p is is an integer. #include<stdio.h>   main() { int n;   printf("Enter an integer\n"); scanf("%d",&n);   if ( n%2 == 0 ) printf("Even\n"); else printf("Odd\n");   return 0; } 3. C program to check whether input alphabet is a vowel or notThis code checks whether an input alphabet is a vowel...

Words: 7510 - Pages: 31

Free Essay

Sorting

...1. Use class Sort.java provided in class, the dual-pivot Quicksort of Java 8 (Arrays.sort), and RadixSort.java provided in class.  2. Do the following for Mergesort, Quicksort, Heapsort and dual-pivot Quicksort: a. Create 100,000 random keys (of type long) and sort them. Repeat this 100 times. b. Compute the average CPU time taken to sort the keys for the four methods. c. Comment on the results and compare them to the average-case complexities discussed in class.  As we discussed in the class, all these sorting algorithms I used for testing have the same average-case complexities with O (n log n). But the data I got which shows in the upper diagram illustrate that Quick sort is the most fast sorting method especially when you need to sort a large amount of data. Dual-pivot quicksort is also fast than merge sort and Heap sort. Heap sort can be used when the pending data between 1000-1000, 000, and for Merge sort is the first choice when there are more than 1M data. 3. Do the following for the four sorting methods of #2, and for Radix sort: a. Create 100,000 random strings of length 4 and sort them using the five sorting methods. b. Repeat (a) 10 times Compute the average CPU time taken to sort the keys for the five methods. c. Repeat (a) and (b) with strings of length 6, 8, 10. d. Create a table with the results and compare the times with the average-case and worstcase complexities as studied in class.  The length of string is 4: The length of string...

Words: 910 - Pages: 4

Free Essay

Quick Sort Analysis

...Here is an analysis of the time complexity of quick-sort in detail. In quick sort, we pick an element called the pivot in each step and re-arrange the array in such a way that all elements less than the pivot now appear to the left of the pivot, and all elements larger than the pivot appear on the right side of the pivot. In all subsequent iterations of the sorting algorithm, the position of this pivot will remain unchanged, because it has been put in its correct place. The total time taken to re-arrange the array as just described, is always O(n)1 , or αn where α is some constant [see footnote]. Let us suppose that the pivot we just chose has divided the array into two parts - one of size k and the other of size n − k. Notice that both these parts still need to be sorted. This gives us the following relation: T (n) = T (k) + T (n − k) + αn where T (n) refers to the time taken by the algorithm to sort n elements. WORST CASE ANALYSIS: Now consider the case, when the pivot happened to be the least element of the array, so that we had k = 1 and n − k = n − 1. In such a case, we have: T (n) = T (1) + T (n − 1) + αn Now let us analyse the time complexity of quick sort in such a case in detail by solving the recurrence as follows: T (n) = T (n − 1) + T (1) + αn = [T (n − 2) + T (1) + α(n − 1)] + T (1) + αn (Note: I have written T (n − 1) = T (1) + T (n − 2) + α(n − 1) by just substituting n − 1 instead of n. Note the implicit assumption that the pivot that was chosen divided the original...

Words: 1014 - Pages: 5

Free Essay

The Final Touch

...INDUSTRIAL TRAINING FROM TATA CMC, JAMMU ON EMBEDDED SYSTEMS. Submitted in the partial fulfilment of requirement for the award of degree of Bachelor of Engineering In Electronics and Communication Engineering Submitted By Ashish Gupta 258/12 Under the guidance of Ms. Sonika Mahajan IT Guide Department of Electronics & Communication Engineering Mahant Bachittar Singh College of Engineering and Technology, Jammu 2015 CERTIFICATE i DECLARATION I hereby declare that the Seminar Report entitled “EMBEDDED SYSTEMS” is an authentic record of my own work carried out as requirement for the award of degree of B.E. (E&C) of Mahant Bachittar Singh College of Engineering & Technology, Jammu. Date: ................ Ashish Gupta 258/12 Certified that the above statement made by the student is correct to the best of my knowledge and belief. Ms. Sonika Mahajan Ms. Neha Gupta Ms. Shalini Sharma IT Guide ...

Words: 998 - Pages: 4

Premium Essay

It 265 Data Structures Phase 5

...Stacks, and Queues 6 Stacks 6 Queues 10 Section 2: Hashing, Heaps and Trees 14 Section 3: Sorting Algorithms 20 Insertion sort 20 Bubble Sort 20 Selection sort 21 Section 4: Searching 22 Array 22 Linked Lists 23 Section 5: Recursion 30 References 33 Executive Summary Phase 1          A list is a collection of items in which the items have a position (Weiss, 2010).  A linked list allows data to be input or removed easily because each of the data items in the list is connected to its neighbor by a pointer that can be quickly and easily modified to accommodate new or removed items (CTU M.U.S.E. 2014). The Phase 1 portion of this document will be demonstrating the implementation of Stacks and Queues. Phase 2 Hash tables can be viewed as an array of lists and are used to speed up a search for data by creating a situation that does not require the search to start at the beginning and go through every item. The identifying value is the key and the associated record is the data, thus a hash table is a collection of (key, value) pairs. Phase 3 In order to efficiently use a database, the data must be stored in some sort of order. There are a number of different sorting algorithms; a programmer would choose which one to use depending on the amount and type of data being sorted. Insertion sort, Bubble sort, and Selection sort are described with examples. Phase 4 A binary tree, is a node-based data structure where each node has a comparable key (and...

Words: 3704 - Pages: 15

Free Essay

Doc, Docx, Pdf, Wps, Rtf, Odt

...INDEX s.no | Name of program | Page no. | Remarks | SORTING PROGRAMS | 1 | program of merge sort | | | 2 | program of quick sort | | | 3 | program of bubble sort | | | 4 | program of insertion sort | | | 5 | program of selection sort | | | SEARCHING PROGRAMS | 6 | program of binary search iterative method | | | 7 | Program of binary search by recursive method | | | MULTIPLICATION PROGRAMS | 8 | program to multiply two matrices using direct method | | | 9 | program to multiply two matrices using recursion | | | 10 | program to multiply two matrices using strassen's method | | | //program of merge sort #include<stdio.h> #include<conio.h> #define MAX 50 void mergeSort(int arr[],int low,int mid,int high); void partition(int arr[],int low,int high); int main() { int merge[MAX],i,n; clrscr(); printf("Enter the total number of elements: "); scanf("%d",&n); printf("Enter the elements which to be sort: "); for(i=0;i<n;i++) { scanf("%d",&merge[i]); } partition(merge,0,n-1); printf("After merge sorting elements are: "); for(i=0;i<n;i++) { printf("%d ",merge[i]); } getch(); } void partition(int arr[],int low,int high) { int mid; if(low<high) { mid=(low+high)/2; partition(arr,low,mid); partition(arr,mid+1,high); mergeSort(arr,low,mid,high); } } void mergeSort(int arr[],int low,int mid,int high) { int i,m,k,l,temp[MAX]; l=low; i=low; m=mid+1; while((l<=mid)&&(m<=high))...

Words: 1948 - Pages: 8

Free Essay

Video Conference

...solving the sorting problem? Reasonable people may disagree on the answer. Selection Sort or Bubble Sort Brute-Force Sorting Algorithm Selection Sort :  Scan the array to find its smallest element and swap it with the first element.  Then, starting with the second element, scan the elements to the right of it to find the smallest among them and swap it with the second elements. Generally, on pass i (0  i  n-2), find the smallest element in A[i..n-1] and swap it with A[i]: A[0]  . . .  A[i-1] | A[i], . . . , A[min], . . ., A[n-1] in their final positions  Example: 7 3 2 5 Selection Sort : Example 1 ) |89 45 68 90 29 34 17 2 ) 17 | 45 68 90 29 34 89 3 ) 17 29 | 68 90 45 34 89 4 ) 17 29 34 | 90 45 68 89 5 ) 17 29 34 45 | 90 68 89 6 ) 17 29 34 45 68 | 90 89 7 ) 17 29 34 45 68 89 | 90 Analysis of Selection Sort Time efficiency: Space efficiency: Stability: Θ(n^2) Θ(1), so in place yes Bubble Sort     Compare adjacent elements of the list and exchange them if they are out of order. By doing this repeatedly, we end up “bubbling up” the largest element to the last position The next pass bubbles up the second largest element and so on. After n-1 pass the list is sorted. A0,….,Aj ↔ Aj+1,…, An-i-1, | An-i ≤ … ≤ An in their final positions Example : 89 45 68 90 29 34 17 Bubble Sort : The Algorithm Algorithm : BubbleSort(A[0..n-1]) //Sort given array...

Words: 1552 - Pages: 7

Free Essay

Hostel

...UCCC2063 Analysis Algorithm Assignment Lecturer / Tutor : Mr. Wong Chee Siang Course: CS Name | ID | Cheng Shong Wei | 1103771 | Er Siang Chiang | 1203122 | Ng Yuan Wen | 1201733 | Question 1 : Fibonacci a. Iterative Fibonacci 1. Code: #include <iostream> #include <time.h> using namespace std; int main() { //loop until 80th Fibonacci long long count =10; while (count<=10000000000) { //variables time_t start,end; unsigned long long a = 1, b = 1; //prompt start = clock(); //start timer for(unsigned long long n = 3; n <= count; ++n) //calculated by iterative { unsigned long long fib = a + b; a = b; b = fib; if (n==count) cout<<"Fibonacci Number: "<<fib<<endl; } //end timer show Runtime end=clock(); double diff ((double)(end - start)); double time = diff / CLOCKS_PER_SEC; cout<<"Runtime ("<< count <<"th) : "<< time <<" seconds"<<endl; cout<<"------------------------------------------------------"<<endl; count = count *10; } system ("pause"); return 0; } 2. Analysis: n=3count1=count-3+1 T(n) =count-2 =O(count) =O(n) 3. Table n-th Fibonacci no. | Time 1(sec) | Time 2(sec) | Time 3(sec) | Average(sec) | 10 | 0.001 | 0.001 | 0.001 | 0.001 | 100 | 0.001 | 0.001 | 0.001 | 0.001 | 1’000 | 0.002 | 0.001 | 0.001 | 0.0013 | 10’000 | 0.003 | 0.002 | 0.001 | 0.0020 | 100’000 |...

Words: 4123 - Pages: 17