Describing algorithm: In some problems you may be asked to describe an algorithm
ID: 3682509 • Letter: D
Question
Describing algorithm: In some problems you may be asked to describe an algorithm. Your descript should be in the form of a short essay. The essay should include the following: A description of the algorithm in pseudo code How your algorithm works? Demonstrate your algorithm using one worked example or diagram A proof (or indication) of the correctness of the algorithm An analysis of the running time of the algorithm Given n files fl, f2,..., f3 of length ml, m2,...m3, the optimal tape-storage problem is to find which order is the best to store them on a tape to get minimum cost of total retrieval time, assuming that each retrieval starts with the tape rewound, each retrieval takes time equal to the length of the preceding files in the tape plus the length of the retrieval file, and that files are to be retrieved in reverse order. The greedy algorithm put the files on the tape in ascending order of size. Prove that this is the best order.Explanation / Answer
An algorithm is a set of step-by-step instructions used for solving a problem. Algorithms can be expressed in many kinds of notation, including natural languages, pseudocode, flowcharts, drakon-charts, programming languages or control tables.The best way to describe an algorithm is using a pseudocode. A pseudocode is a high-level description of a computer program or any algorithm. It uses the structural conventions of a programming language. Pseudocode typically omits details that are essential for machine understanding of the algorithm, such as variable declarations, system-specific code and some subroutines. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications that are documenting various algorithms, and also in planning of computer program development, for sketching out the structure of the program before the actual coding takes place. pseudocode generally does not actually obey the syntax rules of any particular language; there is no systematic standard form, although any particular writer will generally borrow style and syntax; for example, control structures from some conventional programming language. Popular syntax sources include Fortran, Pascal, BASIC, C, C++, Java, Lisp, and ALGOL. Variable declarations are typically omitted. Function calls and blocks of code, such as code contained within a loop, are often replaced by a one-line natural language sentence.
A basic example for pseudo code is:
. If student's grade is greater than or equal to 60
Print "passed"
else
Print "failed"