Search topics and sections

Computer science is the study of computation, which means processing information by following steps or rules. It studies algorithms and the hardware (the physical parts of a computer) and software (the programs it runs) that carry them out. An algorithm is an exact set of steps for solving a problem, like a recipe that a machine can follow.[1]

Computer scientists ask which problems such steps can solve, how fast they can solve them, and how to build machines and programs that run them. The field combines mathematics, science, and engineering.[1]

What computer science studies

The field's central question is what can be automated, and how efficiently. A 1989 report, Computing as a Discipline, by Peter Denning and colleagues, defined it as "the systematic study of algorithmic processes that describe and transform information: their theory, analysis, design, efficiency, implementation, and application." The report named the basic question as "What can be (efficiently) automated?"[1]

An earlier view puts the computer itself at the center. In 1967, Allen Newell, Alan Perlis, and Herbert Simon wrote that computer science is "the study of the phenomena surrounding computers."[2]

Critics said the field studies algorithms, not machines. The authors replied that "computers" meant the hardware, its programs, and "all that goes with them."[2]

Three ways of working

Denning describes three ways of working, each from an older field:[3]

Way of working Comes from What it involves
Theory Mathematics Building notations and structures, then working out the logical results of axioms (starting statements accepted as true) and laws
Experimentation (also called abstraction) Science Building models of systems and testing whether they predict new behavior correctly
Design Engineering Building computer systems that support real work

Some work is mainly one kind. Computational complexity is mainly mathematics, experimental study of algorithms is mainly science, and software engineering is mainly engineering. Most work combines all three.[1]

Core ideas

Information as bits

Computers store all information as strings of 0s and 1s. Electronic devices can easily hold two states, such as high and low voltage, so the binary digit, or bit, became the basic unit for storing and sending data.[4]

Claude Shannon's 1948 paper "A Mathematical Theory of Communication" founded information theory. It called binary digits "bits", a word Shannon credited to J. W. Tukey.[5]

Algorithms

An algorithm is a finite, step-by-step procedure that turns an input into a required output.[6] A classic early example is Euclid's algorithm for finding the greatest common divisor of two integers (whole numbers), which is the largest whole number that divides both evenly.[6]

Searching a list shows why the choice of algorithm matters. Linear search checks the items one by one, and if the target is missing, it has to check every item.[7] Binary search works only on a sorted list, but it is much faster:[7]

  1. Look at the middle item of the part of the list still in play.
  2. If it is the target, stop.
  3. If the target is smaller, keep only the left half. If larger, keep only the right half.
  4. Repeat until the target is found or nothing is left.

Each step halves the part still in play, so a list of nn items needs only about log⁡2n\log_2 n steps.[7] For a million items, that is about 20 steps, while linear search may need a million.

Data structures

A data structure is a way of organizing data so that algorithms can add, remove, and find items efficiently. Binary search, for example, needs its data kept in sorted order. Data structures and the algorithms that use them are heavily used in compilers, operating systems, file systems, and search engines.[4]

Abstraction

Abstraction means hiding details that do not matter for the task at hand. Computer scientists view a computer as a stack of layers. Each layer is built from the one below it, so a programmer can work at one layer without thinking about the others.[8]

Layers of abstraction in a computerApplication programsbrowser, gameOperating systemInstruction set architectureMicroarchitectureLogic gatesAND, OR, NOTTransistorson/off switches = 1/0more abstractcloser to thephysical deviceeach layer is built from the one below
A computer can be described as a stack of abstraction layers, from application programs at the top down to transistors that switch on and off to represent 1 and 0. The instruction set architecture is the set of commands a processor can carry out, and the microarchitecture is the processor's internal design for carrying them out.

At the bottom, a transistor acts as an on-off switch, and its two states stand for 1 and 0. Transistors are wired into logic gates, gates into processors, and so on up to the programs people use.[8]

Main areas

The main curriculum guide for the field lists 17 knowledge areas. It is CS2023, written jointly by the Association for Computing Machinery (ACM), the IEEE Computer Society, and the Association for the Advancement of Artificial Intelligence.[9][10] Its drafts sort most areas into three competency (skill) areas: software, systems, and applications.[11]

Group Knowledge areas
Software Software development fundamentals; algorithmic foundations; foundations of programming languages; software engineering
Systems Systems fundamentals; architecture and organization; operating systems; parallel and distributed computing; networking and communication; security; data management
Applications Graphics and interactive techniques; artificial intelligence; specialized platform development; human-computer interaction; security; data management
Not in one group Mathematical and statistical foundations; society, ethics, and the profession

Security and data management, which covers databases, appear in both the systems and the applications groups.[11]

CS2023 adds a unit on society, ethics, and professionalism to most other knowledge areas, because computing affects so much of daily life.[10]

The areas overlap with each other and with other fields. Some, such as computational science, also overlap with fields like bioinformatics and computational chemistry.[4]

CS2023 dropped computational science as a separate knowledge area because its content was already covered elsewhere.[10]

Theory of computation

Theoretical computer science asks what can be computed at all, and what can be computed with a reasonable amount of time and memory.[12]

Turing machines

In 1936, Alan Turing described an imaginary machine to define precisely what "computable" means.[12] A Turing machine has a tape divided into squares, each holding one symbol. A head scans one square at a time, and the machine is always in one of a finite number of states.[13]

A state is the machine's current condition. At each step, the current state and the scanned symbol fully decide what happens next. The machine writes a symbol, moves one square left or right, and switches to a next state.[13]

A Turing machinecontrolcurrent state: q2finite set of states1011...read/write headtape: one symbol per squaretransition rule(q2, read 0) →write 1, move R, go to q3
A Turing machine has a finite control in state q2q_2 and a read/write head over a tape that continues without end to the right. The rule (q2,0)→(1,R,q3)(q_2, 0) \to (1, R, q_3) says what the machine does next.

Formally, a Turing machine is a quadruple

T=(Q,Σ,s,δ),δ:Q×Σ→Σ×{L,R}×QT = (Q, \Sigma, s, \delta), \qquad \delta : Q \times \Sigma \to \Sigma \times \{L, R\} \times Q

where QQ is a finite set of states, Σ\Sigma is a finite set of symbols, s∈Qs \in Q is the starting state, and δ\delta is the transition function. Given the current state and scanned symbol, δ\delta returns the symbol to write, the direction to move (LL or RR), and the next state.[13]

Turing also described a universal Turing machine, which can compute anything that any other Turing machine computes.[13] This is the idea behind a general-purpose computer that can run any program.

The Church-Turing thesis

Alonzo Church's lambda calculus and Turing machines turned out to be equivalent, so anything computable in one is computable in the other.[12] The Church-Turing thesis holds that these precise models capture the everyday idea of "computable in principle." The Stanford Encyclopedia of Philosophy describes this belief as accepted by mathematicians without exception.[12]

Unsolvable problems

Some well-defined problems cannot be solved by any algorithm. The halting problem asks whether a given Turing machine will eventually stop on a given input. Turing proved that no algorithm can answer this for every machine and input.[12]

Church and Turing independently proved that the Entscheidungsproblem has no solution. It is Hilbert's question of whether a mechanical method can decide every statement of first-order logic, a standard system of logic that uses variables for objects and makes statements about their properties and relations. Turing derived this result from the fact that no algorithm can solve the halting problem.[12]

A counting argument shows that unsolvable problems are the rule, not the exception. Turing machines are countable, meaning they can be listed one by one, while sets of natural numbers (0, 1, 2, 3, and so on) are uncountable, meaning there are too many to list. So almost all such sets cannot be decided by any machine.[12]

Measuring efficiency

Computer scientists measure an algorithm's cost by how its number of steps grows with the input size nn. They ignore constant factors and keep only the fastest-growing term.[7] Big O notation states this as an upper bound:[6]

f(n)=O(g(n))if there are constants c>0 and n0>0 such that 0≤f(n)≤c g(n) for all n≥n0f(n) = O(g(n)) \quad \text{if there are constants } c > 0 \text{ and } n_0 > 0 \text{ such that } 0 \le f(n) \le c \, g(n) \text{ for all } n \ge n_0

Here f(n)f(n) is the cost of the algorithm on inputs of size nn, and g(n)g(n) is a simpler comparison function. The constant cc absorbs fixed factors, and n0n_0 says the bound needs to hold only for large inputs.[6]

Binary search runs in O(log⁡n)O(\log n) time.[7] Linear search runs in O(n)O(n) time, because in the worst case it checks all nn items.

Growth of linear search and binary search steps016324864016324864list size nsteps (worst case)646linear search: nbinary search: log₂ n
Worst-case steps for linear search grow in step with list size nn, while binary search needs only about log⁡2n\log_2 n steps. At n=64n = 64 that is 64 steps against about 6.

The classes P and NP

Complexity theory sorts problems into classes by the resources needed to solve them. The class P holds problems that a computer can solve in polynomial time, meaning a number of steps bounded by a polynomial in the input size, such as n2n^2 or n3+5nn^3 + 5n. Problems outside P are not considered practical to solve.[12]

The class NP holds problems whose yes-answers have short proofs that can be checked quickly.[12]

An example is subset sum: given a list of numbers and a target, is there a subset that adds up exactly to the target? A proposed subset is easy to check. But no known method finds one in less than exponential time, which grows roughly like 2 raised to a power of the input size.[12]

NP-complete problems

The Boolean satisfiability problem (SAT) asks whether the true-or-false variables of a logic formula can be set so that the whole formula comes out true.[12]

SAT was the first problem proved NP-complete, by Stephen Cook in 1971.[12]

A reduction turns each instance of one problem into an instance of another, so that a method for the second also solves the first. A problem is NP-complete if it is in NP and every problem in NP reduces to it in polynomial time.[12] A fast algorithm for SAT would therefore give a fast algorithm for every problem in NP.

Cook and Leonid Levin each stated the P versus NP problem independently in 1971. It asks whether every problem whose answer is easy to check is also easy to solve.[14]

How the classes relate

The known relations between the main classes are

P⊆NP⊆PSPACE⊆EXPTIME,P≠EXPTIME\mathrm{P} \subseteq \mathrm{NP} \subseteq \mathrm{PSPACE} \subseteq \mathrm{EXPTIME}, \qquad \mathrm{P} \neq \mathrm{EXPTIME}

where PSPACE holds problems solvable with a polynomial amount of memory, and EXPTIME holds problems solvable in time 2p(n)2^{p(n)} for some polynomial pp. None of the three inclusions has been proved strict. The only proved separation is P≠EXPTIME\mathrm{P} \neq \mathrm{EXPTIME}, so at least one inclusion must be strict.[12]

Nested complexity classes P, NP, PSPACE and EXPTIME EXPTIME time 2^p(n) PSPACE polynomial memory NP answers checkable in polynomial time P solvable in polynomial time SAT, subset sum in NP; not known to be in P Known: P ⊆ NP ⊆ PSPACE ⊆ EXPTIME and P ≠ EXPTIME. Whether P = NP is unknown.
The complexity classes P, NP, PSPACE and EXPTIME drawn as nested ovals, with problems like SAT and subset sum in NP but not known to be in P. Dashed boundaries mark inclusions not proven strict; it is known that P⊆NP⊆PSPACE⊆EXPTIMEP \subseteq NP \subseteq PSPACE \subseteq EXPTIME and P≠EXPTIMEP \neq EXPTIME, but whether P=NPP = NP is open.

History

Year Event
Mid-1830s Charles Babbage starts work on the Analytical Engine[15]
1843 Ada Lovelace publishes her notes on the Analytical Engine[16]
1936 Alan Turing describes his machines and proves the halting problem unsolvable[12]
1945 John von Neumann writes the First Draft of a Report on the EDVAC (June 30)[17]
1946 ENIAC is announced to the public (February 14)[18]
1947 The Association for Computing Machinery is founded[19]
1948 Claude Shannon publishes "A Mathematical Theory of Communication"[5]
1953 Cambridge starts the first taught computing course in Britain[20]
1962 Purdue founds the first computer science department in the United States[21]
1966 Alan Perlis receives the first Turing Award[22]
1971 Cook and Levin state the P versus NP problem[14]
1989 Computing as a Discipline defines the field[1]
2000 The Clay Mathematics Institute offers $1 million for solving P versus NP[23]

Before electronic computers

Charles Babbage began designing the Analytical Engine in the mid-1830s. In modern terms, it would have been a general-purpose computer, but it was never built.[15]

In 1843, Ada Lovelace published a translation of an article on the engine, with long notes of her own.[16] Her notes included a method for computing Bernoulli numbers on the engine. The Computer History Museum calls it the first published description of a stepwise sequence of operations for solving certain mathematical problems.[16]

Historian Thomas Misa argues that Babbage and Lovelace each made important contributions to this work.[24]

Logic and the first computers

Turing's 1936 description of his machine was a milestone in the theory of computation.[4]

ENIAC, built at the University of Pennsylvania and announced in February 1946, was the first general-purpose electronic computer. It was programmed by plugging cables and setting switches.[18]

In 1945, John von Neumann's First Draft of a Report on the EDVAC described a stored-program computer. Such a machine keeps both its instructions and its data in electronic memory.[17] Storing instructions in memory was key to later theory about how algorithms behave.[4]

Becoming a discipline

The ACM was founded in 1947 "to advance the science, development, construction, and application of the new machinery for computing, reasoning, and other handling of information."[19]

The field was called computer science from its start in the 1950s.[1] Universities soon began teaching it:

Year Institution Event
1953 University of Cambridge Starts the Diploma in Numerical Analysis and Automatic Computing in October, the first taught computing course in Britain[20]
1962 Purdue University Sets up the first computer science department in the United States in October[21]

Computer science is one of several computing disciplines. The ACM and IEEE Computing Curricula 2020 report describes seven of them.[25]

Discipline Main focus
Computer engineering Joins computing with electrical engineering, with a focus on how hardware and software work together
Computer science Algorithms, computation, and the design of computing systems
Cybersecurity Protecting computing systems; curriculum guidelines first appeared in 2017
Information systems Using computing to meet the needs of organizations such as businesses
Information technology Making technology available to people and organizations, and keeping it running
Software engineering Designing reliable, trustworthy, secure, and usable software systems
Data science Getting knowledge from data

Computer science also draws heavily on mathematics and electrical engineering. Mathematics supplied the ideas of binary representation and the stored program, and electrical engineering supplied circuit design.[4]

Degree programs commonly require discrete mathematics. This includes logic, combinatorics (the study of counting and arranging objects), and graph theory (the study of networks of points and connections). Many programs also require calculus, statistics, numerical analysis, and physics.[4]

Organizations and awards

The ACM and the IEEE Computer Society are the main professional societies for computing. Together with the Association for Information Systems, they have produced the curriculum guidelines for computing disciplines since 1991.[4]

The ACM gives the A.M. Turing Award, often called the "Nobel Prize in Computing". It carries a $1 million prize funded by Google and is named for Alan Turing.[26] Alan Perlis received the first award in 1966.[22]

Open questions

The best-known open problem in computer science is P versus NP. It is one of the seven Millennium Prize Problems of the Clay Mathematics Institute, and each carries a $1 million prize.[23] Nobody has proved that problems like SAT or subset sum lack fast algorithms, even though none has been found.[14]

The nature of the field is still debated, and the philosophy of computer science treats these questions. Newell, Perlis, and Simon defended computer science as a science against critics who said that computers are artificial and so obey no fixed laws.[2] Denning later argued that the field combines science, engineering, and mathematics.[1]

References

  1. Is computer science science?, Peter J. Denning, Communications of the ACM, 2005.
  2. What is Computer Science? (letter by A. Newell, A. J. Perlis, and H. A. Simon, Science, 1967), Carnegie Mellon University, 1967.
  3. Computer Science: The Discipline, Peter J. Denning, 1999.
  4. Computer science, Encyclopaedia Britannica.
  5. A Mathematical Theory of Communication, C. E. Shannon, Bell System Technical Journal, 1948.
  6. Overview of Algorithm Design and Analysis, Engineering LibreTexts.
  7. Linear Search, Binary Search, and Worst-Case Analysis (lecture notes), University of Toronto, 2024.
  8. 5.2 Computer Levels of Abstraction, OpenStax, Introduction to Computer Science.
  9. Knowledge Areas of CS2023, ACM/IEEE-CS/AAAI, 2023.
  10. Computer Science Curricula 2023, Version Gamma, ACM/IEEE-CS/AAAI Joint Task Force, 2023.
  11. Computer Science Curricula 2023, Version Beta, ACM/IEEE-CS/AAAI Joint Task Force, 2023.
  12. Computability and Complexity, Stanford Encyclopedia of Philosophy.
  13. Turing Machines, Stanford Encyclopedia of Philosophy.
  14. P vs NP, Clay Mathematics Institute.
  15. Ada Lovelace and the Analytical Engine, Bodleian Libraries, University of Oxford, 2018.
  16. Ada Lovelace, Computer History Museum.
  17. June 30, 1945: "First Draft of Report on EDVAC" Published, Computer History Museum.
  18. ENIAC, Penn Engineering, University of Pennsylvania.
  19. About ACM, Association for Computing Machinery.
  20. The Diploma course, University of Cambridge Computer Laboratory, 2007.
  21. History of the Department, Purdue University Department of Computer Science.
  22. Turing Awardees, U.S. National Science Foundation.
  23. The Millennium Prize Problems, Clay Mathematics Institute.
  24. Charles Babbage, Ada Lovelace, and the Bernoulli Numbers, Thomas J. Misa, arXiv, 2023.
  25. Computing Curricula 2020: Paradigms for Global Computing Education, ACM and IEEE Computer Society, 2020.
  26. A.M. Turing Award, Association for Computing Machinery.

Figure

Subtopics

Abstraction (computer science)Artificial intelligenceArtificial lifeAssociation for Computing MachineryAutonomic computingBiometricsBitByteCambridge Diploma in Computer ScienceCentre for Quantum ComputationCharacter encodingChennai Mathematical InstituteCleo (mathematician)CodebergComputationComputer algebraComputer engineeringComputer graphicsComputer hardwareComputer magazineComputer networkComputer performanceComputer programmingComputer science educationComputer scientistComputer securityComputingComputing as a DisciplineComputing CurriculaComputing platformCourant Institute School of Mathematics, Computing, and Data ScienceCrash (computing)Data compressionData processingData scienceDatabaseDistributed computingDocumentationEcma InternationalElectronic votingEmail addressEmma Haruka IwaoEthnocomputingEWeekF. W. JordanFAQFiducial markerFloating-point arithmeticFlorencio UtrerasFrench Institute for Research in Computer Science and AutomationGarbage in, garbage outGrace Murray Hopper AwardGraphBLASHacker cultureHal AbelsonHarold W. KuhnHigh-performance computingHistory of computingHubert Curien LaboratoryHuman–computer interactionHypertextIEEE Computer SocietyInformaticsInformationInformation Networking InstituteInformation retrievalInternational Journal of Mathematics and Computer ScienceJournal of Advances in Information FusionJournal of Biomedical SemanticsJournal of the ACMLecture Notes in Computer ScienceMathematics and Computer EducationMitchell BakerMobile computingMorgan Kaufmann PublishersNick SzaboOrchestration (computing)Parallel computingPCMagPDFPhilosophy of computer scienceRay KurzweilReal-time computingRené de PosselSelf-management (computer science)Sergei Abramov (mathematician)SIAM Journal on Scientific ComputingSoftwareSoftware engineeringSolomon W. GolombTest of Time AwardTheoretical computer scienceTuring AwardUnconventional computingUnstructured dataVernor VingeVideo game developmentVint CerfVisual computingWilliam Norris (CEO)Wired (magazine)Wired UKYear 2038 problemZdzisław Józef Porosiński