Page 1 of 16 Pseudo code Tutorial and Exercises – Teacher's ...
Recommend Documents
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
Funk In Deep Freeze (3:57). 5. Duid Deed (5:12). 6. ... 6. Fun's Theme (3:24). 7.
Sunflowers in My Garden Featuring Wabe… ... Candy Dulfer. 1. Girls Night Out ...
A Bourne Shell Programming/Scripting Tutorial for learning about using the Unix
shell. – Join in on Facebook, at http://facebook.com/shellscript. – Check out the ...
Network Managemnt Tutorial. 1. GET and WALK. To control that your SNMP
installation works: - The backbone router. > snmpstatus -c public -v2c 196.200.
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 ...
An optical isolator is a passive magneto-optic device that only allows light to
travel in ... An optical isolator consists of an input polarizer, a Faraday rotator with
...
And slowly exhaling âI am exhaling, two.â Continue breathing in this way until you reach a count of ten. When you re
See the sample responses for each argument below. 1. Human beings ... Answer
: Plants are part of the food cycle of nature, but plants do not eat meat. It is not.
with exercises. T ... term(s) having the steepest increase in n and specify the
lowest Big-Oh ..... guessing from a few values and using then math induction.
Securities Data Company's (SDC) New Issues database is the primary ... an SEO. Seasoning refers to whether the security being offered is already publicly.
upon the juvenile apparent in the all-night interrogation. ..... for a long period of time. He was then ... yelling at me and saying something happened that night and you know .... sumption that the victim stopped breathing when the juvenile shook.
Electrical D.C motor for Electric Arc Furnace electrode positioning. 14-01- ......
dehyton k. 14-01-00707 euporlan pk 771. 14-01-00708 proten. 14-01-00709.
The software contains a search engine that enables the user to easily ... Key words: qualitative data analysis, conceptual analysis, relational analysis, CADAS for.
CSC104 tutorial exercises, Week #3. Danny Heap. This week you will learn
about event-driven (sometimes called reactive or GUI) programming in the.
18 to 44 years of age) from Bar-Ilan University volunteered to participate in the ... males ranging from 20 to 38 years) from Bar-Ilan University freely reported their.
Oct 7, 2016 - The Executive Order, FAR Rule, and DOL Guidance are .... Mr. Carter, and Ms. Roth are sued in their offici
Jun 30, 2016 - with an outside accounting firm which kept CVOG's books and ... through QuickBooks, an accounting softwar
buying a share from the co-operative society and agreeing to sell milk only to the ... with database software hosting and maintaining the data and the web server ...
patriarchal families (Hagan and colleagues 1987, 2004; McCarthy, Hagan SS ..... Blackwell, Brenda Sims, Christine S. Sellers, and Sheila M. Schlaupitz, 2002.
the systemic fungal colonization of the host plant parts by only one fungal species (see .... recombination and repair gene damage (Schardl and Moon, 2003).
... during locomotion and feeding and foraging postures in the brown capuchin. ... (Robinson. 1986; Terborgh, 1983; J anson, 1988; Gebo, 1992), the sexes were ...
Page 1 of 16 Pseudo code Tutorial and Exercises – Teacher's ...
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.
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