Showing posts with label Basics. Show all posts
Showing posts with label Basics. Show all posts

Wednesday, 16 July 2014

Is hacking always bad?

Initially, Hacking was used to describe an activity done as a hobby, usually in a sophisticated manner. It basically had no relations with doing anything with computers (Harvey, n.d.), and only after the discovery of computers, the term “Computer Hacking” came into use. In actual sense, computer hacking meant doing anything using the computer as a pastime, which included making computers do almost anything that they are normally not made for.

However, at present, people generally refer to computer hacking as a criminal offence that consists of activities like breaking into computer systems, stealing people’s or organizations’ data, and doing some sort of damage, using computers or computer-like devices. Quite easily, the list can go on. Historically, many illegal activities done using computers have been recorded as the acts of hacking. Hacking has mostly been perceived as doing illicit things with computers though the hackers (and their communities) have disagreed with all of it and labeled such people with unethical intents as “crackers” and/or “phreaks” (BBC News, 2000).

Wednesday, 10 April 2013

Flowchart Vs Pseudocode

A flowchart is a diagram showing an overview of the problem. It is a pictorial representation of how the program will work, and it follows a standard format. It uses different kinds of shapes to signify different processes involved in the problem. It is capable of showing:
-tasks to be carried out, manually or automatically
-the type of task being carried out
-the flow of instructions or steps
-the devices used for input, output, and storage
-the files used in the process

Similarly, a pseudocode is a means of expressing the stepwise instructions for solving a problem without worrying about the syntax of a particular programming language. Unlike a flowchart, it uses a written format which requires no absolute rules for writing. It can be written in ordinary English, and we can use some keywords in it too. For instance, to assign the value 5 to a variable y, we can write the pseudocode in any of the ways shown below.

Assign 5 to y
y ← 5  
y = 5
put 5 in y

The advantage of pseudocode over flowchart is that it is very much similar to the final program code. It requires less time and space to develop, and we can write it in our own way as there are no fixed rules.

However, flowchart is capable of showing the overall flow of instructions from one process to another and even files and devices involved in the process. We can see the individual processes just at a glance (like the number of decision making operations). In terms of a conceptual model, it is easier to show iteration (loops) and conditional statements using flowchart, which in case of pseudocode, can easily be as complex as the program code. Furthermore, flowcharts follow a standard format which makes it easy to explain to other programmers. Therefore, I prefer flowcharts to pseudocode.   

Reference:

Heathcote, P.M. (2000), More on Selection and Iteration, Systems Design, Development, ‘A’ Level Computing (4th Edition), pp. 42, 43, 305 and 306.

Tuesday, 9 April 2013

Advantages and Disadvantages of Recursion (Recursive Algorithm)

A procedure or subroutine is recursive if it calls itself, and this process is known as recursion. Commonly, a non-recursive solution to a programming problem is more efficient in both runtime and memory space basis than a recursive one. It is due to the need of making multiple function calls. The function is called each time of the recursive step until the stopping condition is satisfied. Also, every time it goes through a recursive step, it has to store the return addresses and copies of local variables, all of which makes it consume a lot of time as well as memory.

Another fact we need to consider is that if the number of recursive steps is very large, we can actually run out of memory space causing the memory stack overflow, and the program to crash. Say if we want to recursively display the Fibonacci series up to 2000th number, the program would have to handle 2000 return addresses, and a lots of local variables, which is very inefficient than a simple iteration using a for-loop.

However, recursive functions are relatively shorter, and hence easier to write and debug. For some complex problems, they could present a very easy and straightforward solution, like Binary Search and Quick Sort. Basically, if recursive algorithm is not much shorter than the non-recursive one, we should always go for the non-recursive one. A well written iteration can be far more effective and efficient in such cases.

Reference:

Heathcote, P. M. (2000), Recursion, ‘A’ Level Computing (pp. 235- 237), Ipswich, UK: Payne-Gallway Publishers