Computer Science

Algorithms in Computer Science

Algorithms in computer science are step-by-step procedures or formulas for solving problems. They are a fundamental part of computer science and are used to perform various tasks, such as searching, sorting, and data analysis. Efficient algorithms are crucial for optimizing the performance of computer systems and applications.

Written by Perlego with AI-assistance

8 Key excerpts on "Algorithms in Computer Science"

  • The Social Power of Algorithms
    • David Beer(Author)
    • 2019(Publication Date)
    • Routledge
      (Publisher)
    This paper synthesises, critiques and extends these studies. Divided into two main sections – thinking critically about and researching algorithms – the paper makes four key arguments. First, as already noted, there is a pressing need to focus critical and empirical attention on algorithms and the work that they do in the world. Second, it is most productive to conceive of algorithms as being contingent, ontogenetic, performative in nature and embedded in wider socio-technical assemblages. Third, there are three main challenges that hinder research about algorithms (gaining access to their formulation; they are heterogeneous and embedded in wider systems; their work unfolds contextually and contingently), which require practical and epistemological attention. Fourth, the constitution and work of algorithms can be empirically studied in a number of ways, each of which has strengths and weaknesses that need to be systematically evaluated. With respect to the latter, the paper provides a critical appraisal of six methodological approaches that might profitably be used to produce insights into the nature and work of algorithms.

    Thinking critically about algorithms

    While an algorithm is commonly understood as a set of defined steps to produce particular outputs it is important to note that this is somewhat of a simplification. What constitutes an algorithm has changed over time and they can be thought about in a number of ways: technically, computationally, mathematically, politically, culturally, economically, contextually, materially, philosophically, ethically and so on.
    Miyazaki (2012) traces the term ‘algorithm’ to twelfth-century Spain when the scripts of the Arabian mathematician Muḥammad ibn Mūsā al-Khwārizmī were translated into Latin. These scripts describe methods of addition, subtraction, multiplication and division using numbers. Thereafter, ‘algorism’ meant ‘the specific step-by-step method of performing written elementary arithmetic’ (Miyazaki, 2012, p. 2) and ‘came to describe any method of systematic or automatic calculation’ (Steiner, 2012, p. 55). By the mid-twentieth century and the development of scientific computation and early high level programming languages, such as Algol 58 and its derivatives (short for ALGOrithmic Language), an algorithm was understood to be a set of defined steps that if followed in the correct order will computationally process input (instructions and/or data) to produce a desired outcome (Miyazaki, 2012).
    From a computational and programming perspective an ‘Algorithm = Logic + Control’; where the logic is the problem domain-specific component and specifies the abstract formulation and expression of a solution (what is to be done) and the control component is the problem-solving strategy and the instructions for processing the logic under different scenarios (how it should be done) (Kowalski, 1979). The efficiency of an algorithm can be enhanced by either refining the logic component or by improving the control over its use, including altering data structures (input) to improve efficiency (Kowalski, 1979). As reasoned logic, the formulation of an algorithm is, in theory at least, independent of programming languages and the machines that execute them; ‘it has an autonomous existence independent of “implementation details”’ (Goffey, 2008, p. 15).
  • Getting Started with Python
    eBook - ePub

    Getting Started with Python

    Understand key data structures and use Python in object-oriented programming

    • Fabrizio Romano, Benjamin Baka, Dusty Phillips(Authors)
    • 2019(Publication Date)
    • Packt Publishing
      (Publisher)
    The study of algorithms is also important because it trains us to think very specifically about certain problems. It can serve to increase our mental and problem solving abilities by helping us isolate the components of a problem and define relationships between these components. In summary, there are four broad reasons for studying algorithms:
    1. They are essential for computer science and intelligent systems.
    2. They are important in many other domains (computational biology, economics, ecology, communications, ecology, physics, and so on).
    3. They play a role in technology innovation.
    4. They improve problem solving and analytical thinking.
    Algorithms, in their simplest form, are just a sequence of actions, a list of instructions. It may just be a linear construct of the form do x , then do y , then do z , then finish. However, to make things more useful we add clauses to the effect of, x then do y , in Python the if-else statements. Here, the future course of action is dependent on some conditions; say the state of a data structure. To this we also add the operation, iteration, the while, and for statements. Expanding our algorithmic literacy further we add recursion. Recursion can often achieve the same result as iteration, however, they are fundamentally different. A recursive function calls itself, applying the same function to progressively smaller inputs. The input of any recursive step is the output of the previous recursive step.
    Essentially, we can say that algorithms are composed of the following four elements:
    • Sequential operations
    • Actions based on the state of a data structure
    • Iteration, repeating an action a number of times
    • Recursion, calling itself on a subset of inputs
    Passage contains an image

    Algorithm design paradigms

    In general, we can discern three broad approaches to algorithm design. They are:
    • Divide and conquer
    • Greedy algorithms
    • Dynamic programming
    As the name suggests, the divide and conquer paradigm involves breaking a problem into smaller sub problems, and then in some way combining the results to obtain a global solution. This is a very common and natural problem solving technique, and is, arguably, the most commonly used approach to algorithm design.
  • Rules
    eBook - ePub

    Rules

    A Short History of What We Live By

    algorithm was the solution of specific problems by step-by-step procedures of calculation.
    But long before the word there was the thing. From ancient mathematical traditions in Babylonia, Egypt, India, China, and elsewhere, texts survive that contain numerical problems and sophisticated solutions that are clearly algorithmic in the sense that crystallized around the word as it came to be assimilated into medieval Latin and other languages after circa 1200 CE. A brief and incomplete sampling of the kinds of problems to which the term algorithm is retrospectively applied might include: ancient Egyptian problems (c. 1650 BCE) on how to distribute 100 loaves of bread among 10 men if 50 are to be distributed among 6 men and the other 50 among the remaining 4;9 Old Babylonian prediction rules (c. 1100 BCE) for the length of the lunar month;10 Chinese procedures for the extraction of square and cube roots (1st c. CE);11 and medieval Sanskrit problems (12th c. CE) on how to determine the purity of gold compounded of four parcels of gold, all of different weights and degrees of fineness.12 All of these problems and the methods used to solve them—which often require great erudition and insight on the part of modern scholars to reconstruct—fit neatly into at least the broader modern category of algorithms: a step-by-step procedure to solve mathematical problems by calculation.
    Was this also the category to which such problems belonged in the learned cultures that posed and solved them? Scholars who have painstakingly reconstructed these traditions have expressed doubts on this score, even if they are convinced that the methods qualify as algorithms in the modern sense. Historian of Babylonian mathematics Jim Ritter points out that the canon of ancient mathematical texts was first constituted by European scholars in the nineteenth century, when the prevailing assumption was that mathematics was mathematics was mathematics, regardless of context, and that modern definitions (and algebraic notation) could be applied unproblematically to diverse past traditions. In the case of Old Babylonian problem texts, Ritter suggests that it may be illuminating to interpret surviving cuneiform problem texts not only in the context of other mathematical texts but also in that of other “rational practice” texts from the ancient Near East, including Akkadian tablets about medicine, divination, and jurisprudence. Why? Because all of these texts exhibit striking semantic and syntactical similarities, and all would have been rooted in the practices of the same professional class of scribes. Modern historians of mathematics might not recognize the broader category of procedural texts, but perhaps “the grouping would have made sense to the ancient Babylonians.”13
  • C Programming
    eBook - ePub

    C Programming

    Learn to Code

    Section 3.5 will introduce the concept of programming and the different components involved in executing them.

    3.3 Algorithm Design

    Before we jump into the definition of an algorithm, let us look at the image shown in Figure 3.3 . We have taken this image from a cook book by Sanjeev Kapoor. The objective of using this image is to introduce you to different features of an algorithm. We are not here to learn cooking; instead, the picture will help you to understand how to write unambiguous statements in making a recipe. The procedure written in the image has a high resemblance to algorithm design.
    Figure 3.3 A cooking recipe.
    If you analyze the recipe, you can easily see that the steps are well written, and whoever follows the steps will able to cook a tasty “crisp pohe”. No actions are ambiguous, and the procedure mentions all the ingredients required to prepare the recipe. We can say that the method specified in the image is a step-by-step method to make the food, and the ingredients are known as the input for processing. Finally, the “crisp pohe” will be the output of this process.
    Now we are ready to explain the algorithm. By following the similar analogy discussed above, we can define an algorithm as follows:
    An algorithm is a sequence of unambiguous instructions for solving a problem in a finite amount of time.
    According to the programmer’s perspective, we write the algorithm to solve a given programming task that can easily be converted into a program statement irrespective of any programming language. For example, let the job be to add two numbers; then how do we write an algorithm for that? Following the problem-solving technique, we need to analyze and identify the input to our algorithm and what should be the output produced by it. In our case, the algorithm needs two numbers, and it will provide their addition as the result. After that, we need to write the step-by-step procedure to perform the addition operation. Every step must instruct the computer to do something, and upon completion of all the steps, the machine should produce the required result. The complete algorithm to solve the addition of two numbers will be discussed in the subsequent section.
  • Hands-On Data Structures and Algorithms with Python
    eBook - ePub

    Hands-On Data Structures and Algorithms with Python

    Write complex and powerful code using the latest features of Python 3.7, 2nd Edition

    The theoretical foundation of algorithms, in the form of the Turing machine, was established several decades before digital logic circuits could actually implement such a machine. The Turing machine is essentially a mathematical model that, using a predefined set of rules, translates a set of inputs into a set of outputs. The first implementations of Turing machines were mechanical and the next generation may likely see digital logic circuits replaced by quantum circuits or something similar. Regardless of the platform, algorithms play a central predominant role.
    Another aspect is the effect algorithms have on technological innovation. As an obvious example, consider the page rank search algorithm, a variation of which the Google Search engine is based on. Using this and similar algorithms allows researchers, scientists, technicians, and others to quickly search through vast amounts of information extremely quickly. This has a massive effect on the rate at which new research can be carried out, new discoveries made, and new innovative technologies developed. An algorithm is a sequential set of instructions to execute a particular task. They are very important, as we can break a complex problem into a smaller one to prepare simple steps to execute a big problem—that is the most important part of algorithms. A good algorithm is key for an efficient program to solve a specific problem. The study of algorithms is also important because it trains us to think very specifically about certain problems. It can help to increase our problem-solving abilities by isolating the components of a problem and defining relationships between these components. In summary, there are some important reasons for studying algorithms:
    • They are essential for computer science and intelligent systems
    • They are important in many other domains (computational biology, economics, ecology, communications, ecology, physics, and so on)
    • They play a role in technology innovation
    • They improve problem-solving and analytical thinking
    There are mainly two important aspects to solve a given problem. Firstly, we need an efficient mechanism to store, manage, and retrieve the data, which is important to solve a problem (this comes under data structures); secondly, we require an efficient algorithm which is a finite set of instructions to solve that problem. Thus, the study of data structures and algorithms is key to solving any problem using computer programs. An efficient algorithm should have the following characteristics:
  • Essential Algorithms
    eBook - ePub

    Essential Algorithms

    A Practical Approach to Computer Algorithms Using Python and C#

    • Rod Stephens(Author)
    • 2019(Publication Date)
    • Wiley
      (Publisher)
    CHAPTER 1 Algorithm Basics
    Before you jump into the study of algorithms, you need a little background. To begin with, you need to know that, simply stated, an algorithm is a recipe for getting something done. It defines the steps for performing a task in a certain way.
    That definition seems simple enough, but no one writes algorithms for performing extremely simple tasks. No one writes instructions for how to access the fourth element in an array. It is just assumed that this is part of the definition of an array and that you know how to do it (if you know how to use the programming language in question).
    Normally, people write algorithms only for difficult tasks. Algorithms explain how to find the solution to a complicated algebra problem, how to find the shortest path through a network containing thousands of streets, or how to find the best mix of hundreds of investments to optimize profits.
    This chapter explains some of the basic algorithmic concepts you should understand if you want to get the most out of your study of algorithms.
    It may be tempting to skip this chapter and jump to studying specific algorithms, but you should at least skim this material. Pay close attention to the section “Big O Notation,” because a good understanding of run time performance can mean the difference between an algorithm performing its task in seconds, hours, or not at all.

    Approach

    To get the most out of an algorithm, you must be able to do more than simply follow its steps. You need to understand the following:
  • Philosophy of Computer Science
    eBook - ePub

    Philosophy of Computer Science

    An Introduction to the Issues and the Literature

    • William J. Rapaport(Author)
    • 2023(Publication Date)
    • Wiley-Blackwell
      (Publisher)
    16 .
    Knuth
    Donald Knuth goes into considerably more detail, albeit still informally (Knuth, 1973 , “Basic Concepts: Section 1.1 : Algorithms,” pp. xiv–9, esp. pp. 1–9). He says that an algorithm is “a finite set of rules which gives a sequence of operations for solving a specific type of problem,” with “five important features” (Knuth, 1973 , p. 4):
    1) Finiteness. An algorithm must always terminate after a finite number of steps. (Knuth, 1973 , p. 4)
    Note the double finiteness: a finite number of rules in the text of the algorithm and a finite number of steps to be carried out. Moreover, algorithms must halt. (Halting is not guaranteed by finiteness; see point 5.)
    Interestingly, Knuth also says that an algorithm is a finite “computational method,” where a “computational method,” more generally, is a “procedure,” which only has the next four features (Knuth, 1973 , p. 4).12
    2) Definiteness. Each step … must be precisely defined; the actions to be carried out must be rigorously and unambiguously specified …” (Knuth, 1973 , p. 5).
    This seems to be Knuth's analogue of the “precision” that Rosser and Markov mention. The best examples often come from the humor that they engender:
    Precision: In a “Zits” comic strip from 14 March 2009, teenage Jeremy's mother hands him his laundered clothes, saying “Take these clothes. Carry them in your hands and walk in that direction until you come to the stairs. Make a right turn. Walk up 22 steps. Turn right, and then enter the first room you come to. Put the clothes somewhere within those four walls.” Her husband comments, “You don't leave a lot of room for interpretation, do you?” to which she replies, “After picking up several tons of laundry off that stairway, I've learned to be specific.” (We'll return to this example in Section 10.5 and to this issue in Section 16.7
  • Algorithms: Design Techniques And Analysis (Revised Edition)
    eBook - ePub

    Algorithms: Design Techniques And Analysis (Revised Edition)

    Design Techniques and Analysis(Revised Edition)

    • M H Alsuwaiyel(Author)
    • 2016(Publication Date)
    • WSPC
      (Publisher)
    KRUSKAL for finding a minimum cost spanning tree of an undirected graph. Both data structures are used extensively in the literature for the design of more complex algorithms.
    Passage contains an image

    Chapter 1

    Basic Concepts in Algorithmic Analysis

    1.1    Introduction

    The most general intuitive idea of an algorithm is a procedure that consists of a finite set of instructions which, given an input , enables us to obtain an output if such an output exists or else obtain nothing at all if there is no output for that particular input through a systematic execution of the instructions. The set of possible inputs consists of all inputs to which the algorithm gives an output. If there is an output for a particular input, then we say that the algorithm can be applied to this input and process it to give the corresponding output. We require that an algorithm halts on every input, which implies that each instruction requires a finite amount of time, and each input has a finite length. We also require that the output of a legal input to be unique, that is, the algorithm is deterministic in the sense that the same set of instructions are executed when the algorithm is initiated on a particular input more than once. In Chapter 13 , we will relax this condition when we study randomized algorithms.
    The design and analysis of algorithms are of fundamental importance in the field of computer science. As Donald E. Knuth stated “Computer science is the study of algorithms.” This should not be surprising, as every area in computer science depends heavily on the design of efficient algorithms. As simple examples, compilers and operating systems are nothing but direct implementations of special purpose algorithms.
    The objective of this chapter is twofold. First, it introduces some simple algorithms, particularly related to searching and sorting. Second, it covers the basic concepts used in the design and analysis of algorithms. We will cover in depth the notion of “running time” of an algorithm, as it is of fundamental importance to the design of efficient algorithms. After all, time is the most precious measure of an algorithm’s efficiency. We will also discuss the other important resource measure, namely the space required by an algorithm.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.