Overview of the Computer System ➢ Identify the Problem: carefully to try to identify what qualifies ❖ What is a computer? as a solution Computer: a digital electronic machine that can be programmed to carry out sequences of arithmetic ➢ Design a Solution: or logical operations (computation) automatically work out just how you're going to turn that specification into a working program. ❖ Computer Basic Components ➢ Write the Program: ➢ Input Unit: devices use to enter data to be Programming- is then the task of processed describing your design to the computer: ➢ Output Unit: devices used to display teaching it your way of solving the information result problem ➢ Central Processing Unit: the core/brain of any computer device • Memory Unit: temporary storage of data 3 stages to writing a program: • Control Unit: manages the entire ▪ Coding functions of a computer. ▪ Compiling • Arithmetical and Logical Unit: used for ▪ Debugging mathematical calculations and arithmetic operation • Coding: the act of translating the design into an actual program, written in some Computer programming- is the process of designing and writing computer programs. form of programming language. -practical skills to help you understand and write computer code that reflects things you see and use • Compiling: is the process of turning the in the real world. program written in some programming language into instructions made up of 0's Basic Means in Programming: and 1's that the computer can follow.
✓ Computer basic skills • Debugging: the task of looking at the
✓ Internet basic skills original program, identifying the mistakes, correcting the code, and recompiling it. ✓ Problem-solving skills ✓ Critical thinking skills ➢ Check the Solution: the final step in the ✓ Problem analysis grand programming process is that of testing your creation to check that it does what you wanted it to do CSC01- PROGRAMMING 1 ❖ What is Algorithms? ➢ Backtracking algorithm: finds a solution to a given problem in incremental Algorithms- process or set of rules to be approaches and solves it one piece at a followed in calculations or other problem- time solving operations, especially by a computer. ➢ Divide-and-conquer algorithm: common -act as an exact list of instructions that algorithm is divided into two parts. conduct specified actions step by step in -divide the problem into smaller either hardware- or software-based routines. subproblems -is a set of rules or instructions used to solve -solve these problems and then combine complex problems. them together to produce a solution.
➢ Dynamic programming algorithm: solves
How do algorithms work? problems by dividing them into Algorithms can be expressed as: subproblems. The results are then stored ▪ natural languages to be applied for future corresponding ▪ programming languages problems. ▪ pseudocode ▪ flowcharts ➢ Brute-force algorithm: iterates all possible ▪ control tables solutions to a problem blindly, searching for one or more solutions to a function. What are the different types of algorithms? ➢ Sorting algorithm: are used to rearrange ➢ Search engine algorithm: it takes search data structure based on a comparison strings of keywords and operators as operator, which is used to decide a new input, searches its associated database for order for data relevant web pages, and returns results.
➢ Hashing algorithm: takes data and
➢ Encryption algorithm: transforms data converts it into a uniform message with a according to specified actions to protect it hashing
➢ Greedy algorithm: solves optimization
➢ Randomized algorithm: reduces running problems by finding the locally optimal times and time-based complexities. It uses solution, hoping it is the optimal solution random elements as part of its logic. at the global level
➢ Recursive algorithm: calls itself
repeatedly until it solves a problem. Recursive algorithms call themselves with a smaller value every time a recursive function is invoked. CSC01- PROGRAMMING 1 6 Examples of Real-World Algorithms ➢ Bus Schedules: The schedule busses follow to make on-time arrivals and ➢ Sorting Papers: A teacher sorting papers departures is an example of a real-world in alphabetical order is an example of a algorithm. real-world algorithm. By looking at only the first letter of the first name, you can remove a lot of unnecessary information. This is an automated process that makes sorting more efficient.
➢ Facial Recognition: When we recognize
somebody’s face, we’re drawing upon data we’ve previously collected on the size and position of that person’s facial features. That information is then analyzed internally to automatically recognize others.
➢ Google Search: For example, try searching
for “swimming elephant” and see what you get. Google uses an algorithm to generate these answers without needing the entirety of the question.
➢ Duplicating Outcomes: Following a recipe
is a good example of real-world algorithms in action. You might be able to figure out how to make delicious pasta on your own through trial and error, but following a step-by-step recipe from a well-known chef helps ensure success.
➢ Traffic Lights: Most traffic lights don’t
automatically cycle through green, yellow, and red. Rather, there are sensory inputs that determine the signals’ timing based on the flow of traffic. The algorithm is a well-constructed, step-by-step order that directs the traffic appropriately (although it may not feel like it when you’re sitting at a red light).