Computer Basics | Algorithms and Problem Solving

Computer Basics, Algorithms and Problem Solving

Problem Solving and Computer Science

The main purpose of computer science and programming is to solve problems. Problem solving can be defined as the the process of finding solutions to difficult or complex issues.

In computer science, we use algorithms. An algorithm is a sequence of instructions that is used to find a solution. Problem solving is about understanding the problem at hand and figuring out how to translate the problem into a solution suitable for the computer. 

Implementation and IDEs

Once we understand the problem and devise a plan, we can begin implementing the solution. Implementation involves writing in a language that can be understood by both the computer and the human programmer. Testing is another important part of problem solving that includes verifying that your solution solves the original problem.

There are hundreds of programming languages, each with their pros and cons. Examples of programming languages are Java, Ruby and c++. 

IDEs are Integrated Development Environments. They combine various useful programming tools into one software program. Examples of IDEs are BlueJ, Eclipse and Oracle Developer Studio.

Programming Language Levels and the CPU

There are four programming language levels:

  • machine language
  • assembly language
  • high-level language
  • fourth-generation language

All programs must be translated to a particular CPU's machine language in order to be executed (called compiling).

The CPU is the central processing unit. It is the hardware within a computer that carries out the instructions of a program by performing the basic arithmetical, logical and input/output operations of the system.

The CPU is on a chip called the microprocessor and it continuously follow the fetch-decode-execute cycle. Let's look at those 3 steps. Fetch means the CPU retrieves an instruction from main memory. Decode is when the CPU determines what the instruction is, and Execute is when the CPU carries out the instruction.

The main memory (or RAM) is the primary storage area for programs and data that are still in use. Main memory is volatile, and this means the information that's stored there is maintained only as long as electric power is supplied. Secondary memory devices such as a USB flash drive or hard drive provide long-term storage.

How is the Information Represented?

Information is stored on a computer digitally. It is broken down into pieces and represented as numbers. Every character is stored as a number, as well as digits, spaces and punctuation. This is called binary representation. A single binary digit is a 1 or 0, called a bit. 

Syntax, Semantics and Programming Errors

The syntax rules of a language determine how the vocabulary elements of a computer language can be combined to form statements. 

The semantics of a program statement refers to the purpose and meaning of a statement - what will actually happen when a statement is executed. 

A program that is syntactically correct is not always semantically correct, but remember that a program will always do what you tell it to do, not what you intended to tell it to do. 

A program can have three types of errors:

Compiler errors. Compiler errors are errors that prevent your program from running. They are syntax errors picked up by the compiler. Most compiler errors are caused by mistakes you make when typing code.

Run-time errors. Run-time errors are errors that occur while your program runs. Run-time errors will cause your program to terminate abnormally. An example of this type of error occurs when you try to divide by zero.

Logical errors. Logical errors occur when the program runs but produces incorrect results. Your program did not do what you intended it to do, for example, you might have used an incorrect formula.

Thanks for reading this summary on computer basics, algorithms and other bits of programming information!

New! Comments

Have your say about what you just read! Leave me a comment in the box below.

For You...

Like this article?

Join the newsletter for more interesting reads, blog updates and weekly inspiration for free. 

Follow me on:  Twitter |  Facebook  | Bloglovin

If you can see this, share this post with the buttons below :)