Sorting In Pascal ProgrammingSorting In Pascal Programming

In this article I discuss sorting in Pascal programming language. Sorting is a very useful technique that is used vastly in various programs. This is a programming technique that is used to sort a list of pre-stored data list in a descending or ascending order according to a preset criterion.

There exist various sorting methods in Pascal programming that are used according to a given situation. All of these sorting methods are compared to one another using a time unit measure known as the big-O notation. This technique is for measuring the efficiency of an algorithm that performs a particular function over a collection of items of size p. Take an example, the big-O complexity of both the Bubble sort and Insertion Sort is O (p2). Although both do have the same time complexity, Insertion Sort is slower.

There are many useful sorting methods. Here we will discuss just a few sorting methods in Pascal Programming. The Bubble Sort algorithm is very simple though also inefficient sorting algorithm. It is not usually the best option to use. This is because its performance at sorting a list of items is extremely slow. In Pascal programming, it is best at sorting a small list of items, but not for large items. For the Bubble sort, the sorting time complexity is O (p2).

Another sorting method in Pascal programming is the Insertion Sort algorithm. This one is a bit more efficient algorithm than the Bubble Sort algorithm. As it name implies, the insertion sort algorithm does insert an unsorted item in an item list that is already sorted. This makes one think of the use of two separated arrays - one sorted and the other unsorted. However, to save space one may use the same array and use a pointer to separate the unsorted and sorted elements of the list.

In this algorithm, the sorting time complexity is O (p2). Although this is the same as that of the Bubble Sort's, the Insertion Sort algorithm is twice more efficient, and inefficient for large lists.

Another algorithm in Pascal programming is the Quick Sort algorithm. This algorithm does seem pretty fast in performance, though it's not easy to implement regardless of the fact that getting the gist of how the Quick sort algorithm works is not that hard.

This algorithm does use recursion extensively, so one should ensure he is quite familiar with recursion, and he has used it a lot before he tries to understand this algorithm. The quick sort does work by using a "pivot". This is an index pointer just like the ones that are used in previous sorting algorithms. Its purpose is to divide the list in two halves, one having elements greater than the pivot while the other having elements smaller than the pivot. The pivot is mostly chosen to be the left-most element of the list. However, it is not necessary and one may decide to choose any random element from the list to be his pivot.

by Dewayne Weiss
References and Bibliography

Read more about author in:

exterior french doors

french patio doors

Rated:NR/0 Votes
5 Views
Add To My Article Reading List
Add To My Article Reading List
Print Article
Print
More Article By Dewayne Weiss
More Article by Dewayne Weiss
Share
More Articles From Pascal
More Articles From Pascal
Related Articles and Readings
Stealing the Algorithm By: Christopher Haan
I can feel it. The googlebot is coming to get me. You might say I am insane, but I know for certain that Google is a strange company and that the founders, Larry Page and Sergey Brin, definitely have a master plan for the whole world.Sure, you might say, "They ...
Common Sense Algorithm Chasing By: Stoney DeGeyter
I used to be a strong proponent of common-sense SEO and a detractor from optimization by algorithm chasing.While I still believe strongly in common-sense SEO (now more than ever) my views on algorithm chasing have evolved a certain degree. Many SEOs believe that the two are mutually exclusive, meaning you ...
Building An AlgorithmProof Site Part Three By: Tinu AbayomiPaul
What is an algorithm-proof site? Technically, there's no such thing. Since we don't know exactly what the search engine formulas for ranking are, from that standpoint we can't really be sure that our site won't drop out of the search engines with every update.For our purposes, an algorithm-proof site is ...
The Fraudulent Search Engine Algorithm By: Kristen Owen
Once upon a time optimizing once for all search engines was acceptable. Google reigned supreme across the search fields and others like MSN and Yahoo! held up the rear, Google was everyone's main target. Landing your site on a Google SERP was the ultimate, landing on MSN and Yahoo! was ...
123 Sort By: Eve Abbott
Article excerpted from the new book, "How to Do Space Age Work with a Stone Age Brain" by Eve Abbott1 - 2 - 3?SORT!Every time you start to clean up your office so you can work better instead of harder'that big backlog of information is just too overwhelming. Sorting can ...
The information provided in this article and/or the comments is the sole responsibility of their respective authors and does not necessarily reflect the opinion of ezinepost.com. ezinepost.com  does not endorse any article and/or comments published by our web users unless otherwise noted. 

Member Panel

login to submit articles and more

StatisticsEZINEPOST.COM

  • » Active Categories: 419
  • » Active Articles:252096
  • » Active Authors:32163
  • » Active Members: 35787
  • » Statistics Updated:
    - Sat Aug 11th, 2018 01:04PM EST