0% found this document useful (0 votes)
55 views

High-Level Description:: Pseudocode Pidgin Code

The document describes an algorithm to find the largest number in an unsorted list. It does this by assuming the first number is largest, comparing each remaining number to the current largest, and updating the largest if a larger number is found. When complete, the last number recorded as largest is the true largest number in the list.

Uploaded by

Sathish
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

High-Level Description:: Pseudocode Pidgin Code

The document describes an algorithm to find the largest number in an unsorted list. It does this by assuming the first number is largest, comparing each remaining number to the current largest, and updating the largest if a larger number is found. When complete, the last number recorded as largest is the true largest number in the list.

Uploaded by

Sathish
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

One of the simplest algorithms is to find the largest number in an (unsorted) list of numbers.

The solution necessarily requires looking at every number in the list, but only once at each. From this follows a simple algorithm, which can be stated in a high-level description English prose, as: High-level description: 1. Assume the first item is largest. 2. Look at each of the remaining items in the list and if it is larger than the largest item so far, make a note of it. 3. The last noted item is the largest in the list when the process is complete. (Quasi-)formal description: Written in prose but much closer to the high-level language of a computer program, the following is the more formal coding of the algorithm in pseudocodeor pidgin code: Algorithm LargestNumber Input: A non-empty list of numbers L. Output: The largest number in the list L. largest L0 for each item in the list (Length(L)1), do if the item > largest, then largest the item return largest

You might also like