0% found this document useful (0 votes)
168 views8 pages

Cos 102

It's related to computer science courses
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
168 views8 pages

Cos 102

It's related to computer science courses
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

CSC 112 lecture room:

Introduction to Core Concepts of Computing and Problem-Solving:

- Computing is the process of using technology to manipulate and analyze data.


- Problem-solving is the process of identifying and finding solutions to problems.

Different types of problems can be classified as routine or non-routine.


- Routine problems are well-defined and have a clear set of steps to follow for a solution.
- Non-routine problems are more complex and may require more creativity and critical
thinking to solve.

Examples of routine problems:

Sorting a list of names alphabetically.


Calculating the area of a circle using the formula pi*r^2.
Finding the largest number in a set of numbers.
Converting temperatures between Celsius and Fahrenheit.
Counting the number of words in a document.

Examples of non-routine problems:

Designing a new product that meets specific requirements and customer needs.
Finding ways to reduce costs in a business without compromising on quality.
Developing a new marketing strategy for a company.
Creating a plan to address climate change and its effects on a region.
Solving a crime or finding a missing person.

Identification of Different Types of Problems:

Routine problems can be solved by following a set of established procedures or algorithms.


Examples include simple mathematical calculations or sorting a list of items.

Non-routine problems may require more creativity and critical thinking. Examples include
designing a new product or finding a way to reduce costs in a business.

It's important to correctly identify the type of problem in order to choose the appropriate
approach to solving it.

Routine problems can be automated and solved by a computer program while non-routine
problems need human intelligence and creativity.

The ability to correctly identify the type of problem will be important in the later stages of the
problem-solving process, including solution formulation and design.

What about weather forecast problems?

On the one hand, weather forecasting relies on mathematical models and computer
simulations that use a set of established procedures and algorithms to predict weather
conditions. This can be considered a routine problem as it follows a set of established
procedures to arrive at a solution.

On the other hand, weather forecasting is also a non-routine problem in that it requires a
significant amount of data analysis, interpretation and integration. Weather forecasting also
requires a degree of creativity and critical thinking as meteorologist not only needs to
consider the data but also historical patterns and other factors like air pressure, wind
direction, and temperature changes and also needs to consider the uncertainty and errors in
the data and models. Therefore, weather forecasting can be considered a non-routine
problem as it requires a significant amount of human intelligence and creativity to accurately
predict weather conditions.

Unemployment can be considered a non-routine problem as it typically requires a significant


amount of analysis, interpretation, and integration of various factors in order to find a
solution.

Unemployment is a complex issue that can be caused by various factors such as economic
downturns, changes in technology and automation, shifts in global trade, and more.
Identifying the root causes of unemployment and developing effective solutions requires a
significant amount of research and analysis, as well as creativity and critical thinking.

For example, to solve unemployment problem, economist need to analyze the data and
statistics on the labor market, the performance of different sectors of the economy, the
education and skills of the workforce, the impact of government policies, etc. Also, finding
solutions to unemployment may require a multidisciplinary approach, involving experts from
fields such as economics, sociology, labor law, and education. Therefore, unemployment is a
non-routine problem that requires a significant amount of human intelligence and creativity to
solve.

What about budget allocation?

Budget allocation can be considered a non-routine problem as it typically requires a


significant amount of analysis, interpretation, and integration of various factors in order to
find a solution.

Budget allocation is the process of deciding how to divide a set budget among different
projects, programs or areas. It requires careful consideration of the goals and objectives of
the organization, the resources available, the potential benefits and risks of different
projects, and the trade-offs that need to be made.

For example, budget allocation for a government agency may require balancing competing
priorities such as education, healthcare, infrastructure, and public safety. It requires
analyzing the data and statistics on the performance of different sectors, the impact of past
budgets and policies, the availability of resources and funding, etc. It also requires a degree
of creativity and critical thinking, as budget allocation is also a political process that involves
balancing the needs and wants of different stakeholders. Therefore, budget allocation is a
non-routine problem that requires a significant amount of human intelligence and creativity to
solve.
Methods of solving computing problems (introduction to algorithms and heuristics)

Algorithms:
An algorithm is a step-by-step procedure for solving a problem or performing a task.
Algorithms are a fundamental concept in computing, as they provide a way to automate the
solution of problems and perform repetitive tasks.
Algorithms are usually expressed in a clear and precise language, such as pseudocode or a
programming language, and can be implemented on a computer to automate the solution of
a problem.

The characteristics of an algorithm are as follows:

Clear and unambiguous: An algorithm must be clear and unambiguous, with each step
defined in a way that is easy to understand and follow.

Input and output: An algorithm takes input and produces an output. It should be clear what
the input is and what the expected output is.

Finiteness: An algorithm must terminate after a finite number of steps. It should not go into
an infinite loop or continue running forever.

Well-defined: Each step of an algorithm should be well-defined, meaning it can be precisely


executed and understood.

Effectiveness: An algorithm must be effective, meaning it must solve the problem or task for
which it was designed. It should also be efficient, using the fewest possible steps and
resources.

Generalization: An algorithm should be generalizable, meaning it can be applied to a variety


of similar problems or tasks.

Modularity: An algorithm should be modular, meaning it can be broken down into smaller
parts that can be individually tested and debugged.

Optimization: An algorithm should be optimized, meaning it should be designed to use the


fewest possible resources and take the least amount of time to execute while still producing
the correct output.

What are the limitations of an algorithm?

While algorithms are a powerful tool for problem-solving, they do have certain limitations.
Some of the limitations of algorithms are:

Limited applicability: Algorithms are designed to solve specific problems or perform specific
tasks. They may not be suitable for solving problems that are outside their scope or that
require a different approach.
Time and space complexity: The time and space required to execute an algorithm can be a
limiting factor. Some algorithms may be very slow or require a large amount of memory to
execute, making them impractical for certain applications.

Deterministic: Algorithms are deterministic, meaning they will always produce the same
output given the same input. This can be a limitation in cases where randomness or
variability is required.

Limited creativity: Algorithms are designed to follow a set of rules and procedures. They do
not have the creativity or intuition that humans possess, which can limit their ability to solve
complex or novel problems.

Dependence on input quality: The quality of the input data can significantly impact the
effectiveness of an algorithm. Poor quality input can lead to incorrect or suboptimal results.

Inability to handle subjective or ambiguous problems: Algorithms rely on clear, unambiguous


inputs and objective criteria for evaluating solutions. They are not well-suited for handling
subjective or ambiguous problems that may require a more qualitative approach.

Compare an algorithm with a program.

An algorithm is a step-by-step procedure for solving a problem or performing a task, while a


program is a set of instructions that can be executed by a computer to perform a specific
task or solve a problem.

Here are some key differences between an algorithm and a program:

Purpose: An algorithm is a conceptual solution to a problem or task, while a program is a


specific implementation of that solution that can be executed by a computer.

Expressions: Algorithms are usually expressed in a clear and precise language, such as
pseudocode or a programming language, while programs are written in a specific
programming language that can be understood by the computer.

Execution: Algorithms are not executed directly, they need to be translated into a program
before they can be executed by a computer. A program is a set of instructions that can be
executed by a computer to perform a specific task or solve a problem

Flexibility: Algorithms can be implemented in different programming languages, which makes


them more flexible than programs.

Debugging: Programs can contain bugs and errors, which need to be debugged before they
can be executed. Algorithm don't have bugs, the problem is only with the implementation.

Therefore, an algorithm is a problem-solving strategy, while a program is a specific


implementation of that strategy that can be executed by a computer.

Compare an algorithm with flowchart.


An algorithm is a step-by-step procedure for solving a problem or performing a task, while a
flowchart is a graphical representation of an algorithm or process.

Key differences between an algorithm and a flowchart:

Purpose: An algorithm is a conceptual solution to a problem or task, while a flowchart is a


visual representation of that solution.

Expressions: Algorithms are usually expressed in a clear and precise language, such as
pseudocode or a programming language, while flowcharts use standard symbols and
shapes to represent different types of actions or decisions.

Execution: Algorithms are not executed directly, they need to be translated into a program
before they can be executed by a computer. A flowchart is a visual representation of an
algorithm, it is not executed by a computer.

Understanding: Flowcharts are useful for understanding the logic of an algorithm and can be
used to communicate the algorithm to others. Algorithms are written in a clear and precise
language but flowcharts make it visually easier for others to understand.

Debugging: Flowcharts can be used to identify errors or bugs in an algorithm, making it


easier to debug the algorithm. Algorithms can be translated into a flowchart to identify
potential issues before they are implemented.

Hence, an algorithm is a problem-solving strategy, while a flowchart is a visual


representation of that strategy, which makes it easier to understand and communicate.

Compare algorithm with pseudocode.

An algorithm is a step-by-step procedure for solving a problem or performing a task, while


pseudocode is a type of informal, high-level programming language that is used to express
algorithms.

Key differences between an algorithm and pseudocode:

Purpose: An algorithm is a conceptual solution to a problem or task, while pseudocode is a


tool used to express that solution in a way that is easy for humans to understand.

Expressions: Algorithms are usually expressed in a clear and precise language, such as
pseudocode or a programming language, while pseudocode is a simplified version of
programming language.

Execution: Algorithms are not executed directly, they need to be translated into a program
before they can be executed by a computer. Pseudocode is not executed by a computer, it is
a tool to express algorithm in human-readable language.
Understanding: Pseudocode is useful for understanding the logic of an algorithm and can be
used to communicate the algorithm to others. Algorithms are written in a clear and precise
language but pseudocode makes it easier for others to understand.

Syntax: Pseudocode does not have a strict syntax, it does not follow the rules of any specific
programming language. Algorithm can be expressed in pseudocode, but it can also be
expressed in other languages such as natural language or programming languages.

And so, an algorithm is a problem-solving strategy, while pseudocode is a tool used to


express that strategy in a way that is easy for humans to understand. Pseudocode is a
simplified version of programming language, it is not executed by a computer, but it can be
used to express algorithm and make it easy for people to understand.

Compare an algorithm with a program and programming language.

An algorithm is a step-by-step procedure for solving a problem or performing a task, while a


program is a set of instructions for a computer to execute. A programming language is a
language used to write programs.

key differences between an algorithm, a program, and a programming language:

Purpose: An algorithm is a conceptual solution to a problem or task, while a program is a set


of instructions that can be executed by a computer to perform a specific task, and a
programming language is a tool used to write those instructions.

Expressions: Algorithms are usually expressed in a clear and precise language, such as
pseudocode or a programming language, while a program is a set of instructions written in a
specific programming language that can be executed by a computer. Programming
languages are designed to be understood and used by computers, not humans.

Execution: Algorithms are not executed directly, they need to be translated into a program
before they can be executed by a computer. A program is a set of instructions that can be
executed by a computer, and a programming language is used to write those instructions.

Understanding: Algorithms are written in a clear and precise language, but they can be
difficult for people to understand. Programs are written in a specific programming language
and can be difficult for people to understand, while a programming language is designed to
be understood and used by computers, not humans.

Syntax: Algorithms can be expressed in pseudocode or a programming language. Programs


are written in a specific programming language, and the syntax of a programming language
must be followed to write a correct program that can be executed by a computer.

In summary, an algorithm is a problem-solving strategy, a program is a set of instructions


that can be executed by a computer to perform a specific task, and a programming language
is a tool used to write those instructions. Algorithms are not executed directly and they need
to be translated into a program before they can be executed by a computer. Programs are
written in a specific programming language, and the syntax of a programming language must
be followed to write a correct program that can be executed by a computer.

Heuristics:

Heuristics are general problem-solving strategies or "rules of thumb" that can be used to find
approximate solutions to problems.

Heuristics are often used to solve problems for which no exact algorithm exists, or when the
exact solution is too time-consuming or expensive to compute.

Heuristics are often used in fields such as artificial intelligence and operations research to
solve difficult problems.

Here are some examples of heuristics in action:

Traveling Salesman Problem: The traveling salesman problem involves finding the shortest
possible route that visits each of a set of cities and returns to the starting city. One heuristic
approach to solving this problem is to use a nearest neighbor algorithm, which starts at a
random city and chooses the nearest unvisited city as the next destination.

Maze solving: When solving a maze, a heuristic approach could involve always choosing the
direction that brings you closer to the exit. For example, if you are at a junction in the maze
and can choose to go left or right, you would choose the direction that brings you closer to
the exit.

Chess game: In chess, one popular heuristic approach is the minimax algorithm, which
assumes that the opponent will always make the best possible move and tries to minimize
the maximum possible loss. This algorithm searches through possible moves and chooses
the one that leads to the best outcome, based on a heuristic evaluation function that assigns
a score to each possible move.

Resource allocation: When allocating resources, such as assigning employees to projects, a


heuristic approach could involve assigning the employee with the most relevant skills or the
employee with the least amount of work on their plate.

Route optimization: Heuristic algorithms can also be used to optimize routing in logistics and
transportation industries. For example, a heuristic approach could involve optimizing a
delivery route by choosing the order in which to visit customers based on proximity, traffic
conditions, and delivery deadlines.

Solvable and Unsolvable Problems:

A solvable problem is a problem for which an algorithm or heuristic exists that can be used
to find a solution in a reasonable amount of time.

An unsolvable problem is a problem for which no algorithm or heuristic exists that can be
used to find a solution in a reasonable amount of time.
Unsolvable problems can be either theoretically unsolvable (e.g. halting problem) or
practically unsolvable (e.g. given the current technology, it's impossible to solve it within a
reasonable time frame)

Here are some examples of solvable problems:

Sorting a list of numbers in ascending or descending order using sorting algorithms such as
bubble sort, quick sort, and merge sort.

Searching for a specific value in a list of values using searching algorithms such as linear
search, binary search, and hash tables.

Finding the shortest path between two points in a graph using algorithms such as Dijkstra's
algorithm, Bellman-Ford algorithm, or A* search algorithm.

Encrypting and decrypting messages using algorithms such as RSA or AES encryption.

Generating prime numbers using algorithms such as the Sieve of Eratosthenes.

Calculating the factorial of a number or solving equations using algorithms such as recursive
functions or numerical methods like Newton-Raphson method.

Finding the maximum or minimum value in a list of values using algorithms such as selection
sort or searching algorithms.

Optimizing a process or system by using algorithms such as simulated annealing or genetic


algorithms.

Predicting the weather using algorithms such as numerical weather prediction models.

Recommending products to customers based on their purchase history using algorithms


such as collaborative filtering or content-based filtering.

Example of theoretical unsolvable problem:

The halting problem is an example of a theoretically unsolvable problem. It is a decision


problem in computer science that asks whether, given a program and an input, the program
eventually halts when run with that input, or whether it will run forever. Alan Turing proved in
1936 that there is no general algorithm that can solve this problem for all possible
program-input pairs.

Example of a practically unsolvable problem:


One example of a practically unsolvable problem is breaking modern encryption schemes
using brute force. Cryptographic algorithms such as AES or RSA use key sizes that are so
large that it would take an impractical amount of time and comput

You might also like