Pseudo code Tutorial and Exercises Teacher s Version
Recommend Documents
Page 1 of 16. Pseudo code Tutorial and Exercises – Teacher's Version .....
Exercise 3: Caesar Cipher- it is an encryption technique for sending secret
messages.
letter alphabet code system provide enough codes for protein synthesis? ...
Codon analogy. WS.cwk. KEW 01/02 after Reifel. KEY start Wa t s o n a n d C
r i c k.
CSC104 tutorial exercises # 4. This tutorial will give you a chance to focus on
how you come up with an algorithm, and how to manipulate all the colours in an ...
training day in CAT in Norwich, led by integrative psychotherapist and trainer Margaret Landale, in October 2007. Take y
CSC104 tutorial exercises, Week #3. Danny Heap. This week you will learn
about event-driven (sometimes called reactive or GUI) programming in the.
AJAX is a web development technique for creating interactive web applications.
... Tutorials Point (I) Pvt. Ltd. The user of this e-book is prohibited to reuse, retain,.
This tutorial is prepared for the beginners to help them understand basic ASP.
NET programming. After completing this tutorial, you will .... The Visual Studio IDE
.
CodeIgniter is a powerful PHP framework with a very small footprint, built for
developers who need a ...... This is your user guide to CodeIgniter. It is basically,
the ...
end your matcont session, choose 'Select' in the matcont window and then 'Exit'. .... Activate the parameter II and the period by clicking on the buttons in the ...
3.4 Changing legend options: text and logo to show or hide . .... The 'a.subset' parameter recognizes also a vector of accession id's; e.g. c("sample.1", ...
Oct 7, 2013 ... developed by Microsoft that is modeled on Visual Basic. ... This tutorial has been
prepared for the beginners to help them understand basic-to- ...
This tutorial will teach you basic C# programming and will also take you ... This
tutorial has been prepared for the beginners to help them understand basic C# ...
Android was developed by the Open Handset Alliance, led by Google, and other
companies. ... concepts related to Android application development. Audience.
1.1 Starting Matcont. 1. Please let Matlab be installed, and download matcont (latest version ... MAC: If at mex -setup you can select gcc without problems, proceed. Otherwise you have to install the XCode package. 4. Linux: this has its gcc ...
Extract it and in matlab change your working directory to the newly cre- ...
Windows 7: You will need to install Visual Studio 2010 Express and SDK 7, ...
so, fields are defined to be mutable so that their values, but not their field names, may be reset after construction. T
Feb 2, 2006 - Unix and Python tutorial with exercises for computational & systems biology. Sampsa Hautaniemi [email protected]. Modified by Sabrina L.
Drury, C, Management and Cost Accounting, 6 th. Edition, Thomson Press 2007.
Other texts may be used to supplement as an alternative to the above book.
Network Managemnt Tutorial. 1. GET and WALK. To control that your SNMP
installation works: - The backbone router. > snmpstatus -c public -v2c 196.200.
May 16, 2006 - arXiv:astro-ph/0605400v1 16 May 2006. Proceedings Title IAU Symposium. Proceedings IAU Symposium No. 234, 2006. A.C. Editor, B.D. ...
Supplementary Exercises for Math 218. Version I written (except where indicated)
and compiled by Cymra Haskell. Please note: These exercises are meant to ...
The graph can be generated from the data table using the chart wizard and ..... 36
Exercise: Interpretation of the nuclear magnetic resonance (nmr) spectra of a.
Pseudo code Tutorial and Exercises Teacher s Version
Page 1 of 16 Pseudo code Tutorial and Exercises – Teacher’s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in
Pseudo code Tutorial and Exercises – Teacher’s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy to read without details. It is like a young child putting sentences together without any grammar. There are several ways of writing pseudo-code; there are no strict rules. But to reduce ambiguity between what you are required to do and what you express let’s base the pseudo code on the few defined conventions and carry out the exercises. Pseudo-code Examples
Repeatedly steps through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.
Let’s see few examples that can be used to write pseudo-code. 1.
Sort
Taking the sorting example; let’s sort an array using the Bubble sort technique. This sorting algorithm could be implemented in all programming languages but let’s see the C implementation. void ArraySort(int This[], CMPFUN fun_ptr, uint32 ub) { /* bubble sort */ uint32 indx; uint32 indx2; int temp; int temp2; int flipped; if (ub = indx; --indx2) { temp = This[indx2]; temp2 = This[indx2 - 1]; if ((*fun_ptr)(temp2, temp) > 0) { This[indx2 - 1] = temp; This[indx2] = temp2; flipped = 1; } } } while ((++indx < ub) && flipped);
What’s your impression? Is it easy to understand at once this C implementation?
Bubble sort is mostly used in teaching. However, its performance is slow and in 2.44 the students will discover that there are better algorithms.
}
Page 1 of 16
Here is some pseudo code for this algorithm. What’s easier to understand, the implementation in C or pseudo-code?
Set n to number of records to be sorted repeat flag = false; for counter = 1 to n-1 do if key[counter] > key[counter+1] then swap the records; set flag = true; end if end do n = n-1; until flag = false or n=1
OR the same can be expressed more concisely in words as below
repeat set a flag to False for each pair of keys if the keys are in the wrong order then swap the keys set the flag to True end if next pair until flag is not set. OR even as follows
Keep swapping items until array is in order
This is easier than the programming language but is not so precise. Hence the above pseudo code examples are more useful for implementing purposes. This one-line version may raise questions such as “on what basis do I swap the items?” Therefore, it is important to be precise too.
The main part is that it is important to provide easy to read but precise instructions; this will keep the design simple and unambiguous. Taking a practical example, if I gave you the following instructions: (a) Take a left, then take a right, go down the stairs, on your right enter the kitchen, pick a cup and pour some hot water and add some hot chocolate…. OR (b) Please make me a hot chocolate. The above line of instruction depends on the reader, some prefer to (a) if not experienced while others prefer (b) because it nails it to the point. It is pretty concise too.
Page 2 of 16
Let us take Example 1 and divide the algorithm implementation in stages and conquer.
Example 1: Compute Fibonacci numbers till 50. int main( ) { int n, k, f1, f2, f; if ( n < 2 ) return n; else { f1 = f2 = 1; for(k=2;k