Week 1

This unit will help you to attempt to solve the complex problems by developing a strategy. In your strategy, you have to be able to recognize:

• Input

• Output

• Different type of data structure and use

• Define the strategy and procedure

• Algorithm and documentation of proposed solution

During this course, you will be learning about these topics and apply the method to create a proposed solution in the frame of an algorithm to solve an issue.

To be able to define a well-structured strategy to propose as the solution you need to have a clear understanding of input, output, and algorithm. The documentation also plays a vital role in this process.

Skills to design and develop a logical algorithm regardless of any coding language, which addresses all the issues, is a fundamental principle of this course. So technically, you are required to learn and develop a well-structured algorithm. The course does not require you to be implementing the all the algorithms in a specific language.

As this course is an HCS course, problems and issues are slightly more complicated than a Preliminary course. Problems are required to use the different type of data structure like an array (BOS Syllabus 2010).


Algorithm

An algorithm is a well-structured solution to a specific issue. This well-structured solution conducting a sequence of steps. The algorithm may need some input, and it creates some output. Output can be considered as a final product or a solution to a problem. Khan academy has provided a useful introductory video on the algorithm. Click on the link to see the video.

Also, watch the following video David J. Malan from TED-ED.

To start just thinking you are required to write all the steps to sum-up two numbers, these steps should have two input ‘number’ and one output ‘accumulated amount of two numbers’.

Before reading the algorithm below, on a piece of paper try to write down all the steps, to sum up, two given random, then follow your algorithm to make sure the output is what’s required.

This algorithm will have required two numbers as input, then the output will be summed up on these two numbers.

1- Get a number

2- Stored in variable A

3- Get the second number

4- Stored in variable B

5- C = a + b

6- Print C

How should we represent an algorithm in a standard frame? The standard frame does not refer to coding language here. There are two methods to represent algorithm pseudocode and flowchart. During this week, you will learn how to represent an algorithm in pseudo keywords.


Pseudo

Pseudo is an artificial structured English language to represent the algorithm in an informal language, this text-based helps the programmer to develop the algorithm. It aims to help the designer to focus on logic rather than a distraction for language syntax.

4.jpg

Check the below articles for the better understanding go through the following links:

http://users.csc.calpoly.edu/~jdalbey/SWE/pdl_std.html

http://www.unf.edu/~broggio/cop2221/2221pseu.htm

http://web1.muirfield-h.schools.nsw.edu.au/technology/resources/Resources/sdd/sd&d/algor/pseudo.htm


Variable

A variable is a storage location, which has paired with a symbolic name that references to a data. Technically the variable name presents what data has stored in this storage, e.g.

‘FiestName’ it is easy for others to guess what kind of data has stored in the variable, which you named ‘FiestName’ rather than ‘K’.

FirstName = Peter

So here, ‘FiestName’ indicate to a storage, which stored the data ‘Peter’.

Read the following link for a border knowledge about the variables.

http://www.cs.utah.edu/~germain/PPS/Topics/variables.html

Algorithm Practice: Swap value of variables Following algorithm required two input number, then swap the data from one variable to another variable.

For example:

NumberOne = 1

NumberTwo = 2

Algorithm output will be:

NumberOne = 2

NumberTwo = 1

Now re-write with Pseudo code

1- BEGIN

2- READ NumberOne

3- READ NumberTwo

4- PRINT ‘Number one is =’ NumberOne

5- PRINT ‘Number Two is =’ NumberTwo

6- Temp = NumberOne

7- NumberOne = NumberTwo

8- NumberTwo = Temp

9- PRINT ‘Number one is =’ NumberOne

10- PRINT ‘Number Two is =’ NumberTwo

11- END

This algorithm used a third variable ‘TEMP’ in order to swap the value of variables ‘NumberOne’ and ‘NumberTwo’.

Task: You are required to modify the above algorithm ‘Swapped value of variables’ to swap the value of the variables without using the third variable.


Comments

comments powered by Disqus