Intro to CS exam 1
What is wrong with the following algorithm? 1. Set X to be 1 2. Increment X 3. Print X 4. If x>0, repeat from 2
It does not halt in a finite amount of time
MARK I
*funded by US navy and IBM * general-purpose, electromechanical programmable computer that used a mix of relays, magnets, and gears to process and store data. *Used base 2 binary system *memory capacity of 72 numbers, and it could be programmed to perform a 23-digit multiplication in the lightning-like time of 4 seconds
ENIAC
*needed to produce the firing tables quickly using multiple external inputs. *(Electronic Numerical Integrator and Calculator), *was completed in 1946 (too late to assist in the war effort) and was the first fully electronic general-purpose programmable computer. *contained 18,000 vacuum tubes and nearly filled a building; * one thousand times faster than the Mark I
Charles Babbage
1. In 1823, he constructed a machine, called the Difference Engine, it could do addition, subtraction, multiplication, and division to 6 significant digits, and it could solve polynomial equations and other complex mathematical problems as well. 2.Babbage tried to construct a larger model of the Difference Engine that would be capable of working to an accuracy of 20 significant digits, but he had to give up his quest. The technology available in the 1820s and 1830s was not sufficient. 3.In the 1830s, he designed a more powerful and general-purpose computational machine that could be configured to solve a much wider range of numerical problems. His machine had four basic components: a mill to perform the arithmetic manipulation of data, a store to hold the data, an operator to process the instructions contained on punched cards, and an output unit to put the results onto separate punched cards. the Analytical Engine, is amazingly similar in design to a modern computer.
Attributes of algorithms
1. correctness a.correct problem b.correct result every time 2. ease of understanding 3. elegance a. clever, non obvious approach that is also simpler 4. efficiency *SOMETIMES THESE FACTORS ARE AT ODDS WITH EACHOTHER
Unsolvable problems
1. no algorithmic solution 2. take too long to solve 3. we don't know how to solve them
Misconceptions about computer science
1. the study of how to write computer programs 2. the study of the uses and applications of computers and software
The first slide rule appeared around ___?
1622
5th generation
1895-? ultra large scale integrated circuits supercomputers and parallel processors 10^15 computations per sec laptops, tablets, smartphones, and handheld wireless devices mobile computing massive external data storage devices 10^17 ubiquitous computing high-resolution graphics, visualization, virtual reality worldwide networks and cloud computing multimedia user interfaces widespread use of digitized sound images and movies.
Colossus
1943, built by alan turing *used to crack the famous German Enigma code that the Nazis believed to be unbreakable *
1st generation
1950-1957 First commercial computers First symbolic programming languages use of binary arithmetic, vacuum tubes for storage punched card input and out put
2nd generation
1957-1965 transistors and core memories first disks for mass storage size reduction, increased reliability, lower costs first high level programming lanfguages --> FORTRAN COBOL first operating systems
3rd generation
1965-1975 Integrated circuits further reduction in size and cost, increased reliability first minicomputers time-shared operating systems appearance of software industry first set of computing standards for compatibility between systems
4th generation
1975- 1985 large scale and very large scale integrated circuits further reduction in size and cost, increased reliability first micro computers --> Altair 8800 growth of new types of software and of the software industry. computer networks graphical user interfaces
When did the history of mathematics begin?
3,000 or more years ago. Their main uses were in building, sailing and commerce applications.
Library
A collection of useful, rewritten algorithms.
UNIVAC I
A commercial model of the EDVAC, called UNIVAC I—the first computer actually sold delivered to U.S. Bureau of the Census on March 31, 1951. (It ran for 12 years) This date marks the true beginning of the "computer age."
High level programming languages
A programming language that uses both natural language constructs and mathematical notation
Define Algorithm
A well ordered collection of unambiguous and effectively computable operations that, when executed, produces a result and halts in a finite amount of time. must have an observable result
Which statement exemplifies abstraction? a. The president of General Motors views the company in terms of its corporate divisions and high-level policy issues. b. The president of General Motors views the company in terms of every worker, every supplier, and every car. c. A good approach to algorithm design and software development is to focus on how we might actually implement a particular operation. d. A convenient way to view the hardware component called "memory" is to focus on the billions of electronic devices that go into constructing a memory unit.
A.The president of General Motors views the company in terms of its corporate divisions and high-level policy issues.
Efficiency
Is the term used to describe an algorithm's careful use of resources.
What is a primitive operation?
An operation that is unambiguous that carries out the algorithm. It can be directly understood by the computing agent Think of figure 2.9 These primitive operations are the building blocks of all algorithms. Think of them like the 26 letters in the alphabet.
the ___ case of an algorithm requires the least work
Best case
What is computer science?
Computer science: the study of algorithms, including Their formal and mathematical properties Their hardware realizations Their linguistic realizations Their applications
Control operations
Conditional and iterative operations make up the category of control operations. They allow us to alter the normal sequential flow of control in an algorithm.
To create a loop that executes exactly b times, we create a__?
Counter
The selection of an algorithm to solve a problem is greatly influenced by the way the input __ for that problem are organized.
Data
Micro computer
Desktop computer that uses integrated circuit technology, developed in the mid-1970s; smaller than a minicomputer
Charles babbage gave up on his second ___ because the current technology could not support his project
Difference Engine
Compare the automation of physical tasks in the industrial revolution to the automation of repetitive mental tasks in the computer revolution.
During the industrial revolution, many manual and tedious tasks such as weaving, became more efficient through the use of machinery, and equipment was used to eliminate the need for hundreds of individuals to complete mundane and repetitive tasks. So instead of an individual needing to pull individual weft threads through the warp threads, a machine was created to complete this mundane task, so workers could be used elsewhere. In the computer revolution, mundane mental tasks such as computing were automated so that individuals could spend their time and energies on more sophisticated and pressing issues that that of simple math, or math that might take years to compute by hand. Both the automation of the industrial revolution and the automation of the computer revolution was spurred by human ingenuity and the necessity to save time and effort in areas where it was not as necessary.
What was the first fully electronic general purpose programmable computer?
ENIAC
Pseudocode
English language with mathematical operations and a structure similar to a high level programming language.
What is an example of a natural language?
English, Spanish etc.
Wireless communications are a ___ generation innovation in computing?
Fifth
During the __ generation of computing, the desktop machine shrunk to the size of a typewriter.
Fourth
ZI
German similar in design to the ENIAC—a programmable, general-purpose, fully electronic computing device. Fortunately for the Allied forces, the Z1 project was not completed before the end of World War II.
Why do we use algorithms?
If we can specify an algorithm to solve a problem, then we can automate a solution.
Key punch and Tabulator
Invented by Herman Hollerith they were programmable (via wires and plugs) so that the user could specify such things as which card columns should be tallied and in what order the cards should be sorted. In addition, the machines had a small amount of memory to store results. Thus, they had all four components of Babbage's Analytical Engine.
Jacquard's loom
Jacquard designed an automated loom that used punched cards to create the desired pattern. Not only was it the first programmable device, but it showed how the knowledge of a human expert (in this case, a master weaver) could be captured in machine-readable form and used to control a machine that accomplished the same task automatically
How did John Von Neumann's designs differ from those before them? including the analytical engine?
Like almost all those who have made progress in the field of computer science, John Von Neumann built upon the designs of others, including Charles Babbage. Neumann's work is distinguished from all previous work by implementing the idea of a stored program computer. Instead of having to physically rewire the machine, every time a new type of data was input, he decided to place the instructions in the memory of the computer. meaning that every time a new set of data was introduced, one would only need to write a new set of instructions for the computer rather than to physically rebuild the machine every time. Von Neumann architecture also utilizes a logic unit, memory, processor and input and output, which built upon Babbage himself.
Designing programming languages and translating algorithms into these languages is known as ___ realization.
Lingusitic
Binary search does __ comparisons in the worst case
O(lg(n))
The copy over algorithm is __ in time efficiency in the worst case
O(n)
sequential search is a __ algorithm in the worst case
O(n)
In order to implement a "find" functionality in a word processor, one would have to design a __ algorithm.
Pattern matching.
In Babbage's analytical engine, a mill was used to...?
Perform arithmetic operations
Sorting
Placing a list of items into alphabetical or numerical order
In a ____ it is possible for the loop body to never be executed
Pretest loop
Input operations
Provide the computing agent with data values from the outside world that it may then use in later instructions.
What is theoretical computer science?
Researchers study the logical and mathematical properties of problems and their solutions
___ is one of the most common applications of computers
Searching a list
Output operations
Send results from the computing agent to the outside world.
A purely __ algorithm is sometimes termed a straight line algorithm
Sequential
What are the three types of operations used to construct algorithms?
Sequential, conditional and iterative
Mini computer
Term for a computer that is smaller and less costly than a mainframe system; developed in the mid-1960s
Elegance
The algorithmic equivalence of style
Discuss the importance of Charles Babbage's Analytic engine design and its similarity to modern computer designs. Why was it never completed? How was Ada Augusta important?
The analytical engine, created by charles Babbage, was a masterpiece of mechanical computation. Although it was never realized, due to restrictions in technology as well as Babbage's own death, It exemplified many of the basic and essential aspects of modern computers, such as a logic unit (mill), memory (Store), processor (operator), and an input output (output unit). Ada Augusta was influential in babbage's work on the Analytical engine, and is even considered the first programmer, due to her help and input on how to organize instructions for the Babbage's machine. Some consider Babbage's design to be the first true computer, even though it was never actually built. Because of this, much of his work was forgotten until the 20th century, where it was dug up to aid in the war effort.
The ABC system
The atannasoff berry computer Actually the first electronic computer, but was only capable of one function (linear equations)
Ada Augusta and charles Babbage
The countess was introduced to Babbage and was enormously impressed by his ideas about the Analytical Engine. As she put it, "We may say most aptly that the Analytical Engine weaves algebraic patterns just as the Jacquard Loom weaves flowers and leaves." Lady Lovelace worked closely with Babbage to specify how to organize instructions for the Analytical Engine to solve a particular mathematical problem. Because of that pioneering work, she is generally regarded as history's first computer programmer.
Define computing agent
The machine, robot, person, or thing carrying out the steps of the algorithm
Sequential search
The technique of looking at all the items in a list, starting at the beginning of the list, one at a time, until we either find what we are looking for or come to the end of the list is called sequential search.
Integrated circuits, built on silicon chips, were introduced during the ___ generation of computing?
Third
Leibniz wheel
This machine could carry out addition, subtraction, multiplication and division. The wheel along with the pascaline, Used interlocking mechanical cogs and gears to store numbers and perform basic arithmetic operations. ****they demonstrated how mechanization could simplify and speed up numerical computation. They were not 1. programmable 2. able to store memory.
In the line of code, "Set the value of Area to length*width", "area" is a __?
Variable
Top down design
Viewing an operation at a high level of abstraction and fleshing out the details of it at a later time is called top-down design.
Von Neumann architecture
Von Neumann worked on the ENIAC project 1946, proposed a radically different computer design based on a model called the stored program computer. (placing the program itself inside the memory, removing the need to physically modify the computer in order to solve new problems. Virtually all computers today are von newmann machines) Von Neumann invented programming as it is known today.
EDVAC
Von Neumann's research group at the University of Pennsylvania implemented his ideas, and they built one of the first stored program computers in 1949
When might an algorithm become essentially useless?
When it takes too long to execute
When could an algorithm fall into an infinite loop?
When the continuation condition in the algorithm for the loop never becomes false
The converging pointers algorithm is O(n) in the ___ case?
Worst
Can there be more than one correct algorithmic solution to a given problem?
Yes, they may just vary in terms of their efficiency, or their elegance. EXAMPLE OF SHAMPOO ALGORITHM (1.3 and 1.4)
Define variable
a named storage location that can hold a data value
EDSAC
a stored program computer built at Cambridge University in England under the direction of Professor Maurice Wilkes
Unambiguous operation
an operation is unambiguous if it can be understood by the computing agent without having to be further defined or simplified.
Intractable problems
are solvable, but the solution algorithms all require so much work as to be virtually useless.
During the initial phases of design, we should be thinking and writing how?
at a highly abstract level
Sequential instruction
carries out a single, well-defined task without branching
Automation of repetitive mental tasks was part of a movement known as the ____?
computer revolution
Problems with measuring efficency
different computers, which data set, all effect speed. Doesn't actually tell us about the algorithm itself.
The __ loop is an example of a posttest loop.
do/while
John Napier
in 1614, he invented logarithms as a way to simplify difficult mathematical computations.
What is the pascaline? Describe its history.
in 1672, a French philosopher and mathematician designed and built one of the first mechanical calculators named the pascaline that could do addition and subtraction. This automatic computation spurred on Leibniz and his ideas of automatic computation.
John Von Neumann
in 1946, he proposed a radically different computer design based on the model called the stored program computer
In the sequential search algorithm, the worst case occurs when the value being searched for is the __ value in the list
last
A __ algorithm is called an exponential algorithm
o(2^n)
Selection sort is a __ algorithm is ALL cases
o(n^2)
The shuffle left algorithm is a(n) __ algorithm in the worst case.
o(n^2)
"Print the value of product" is an example of a(n) __ operation.
output operation
Selection Sort
performs the task of sorting a list by growing a sorted subsection of the list from back to front
The number of comparisons done by the selection sort algorithm does not grow at the same rate as the problem size n, instead it grows at approximately the ___ of that rate.
square
Conditional statements
the "question-asking" operations of an algorithm. ask a question and select the next step based on the previous answer to that question.
Virtual machine
the computer system as perceived by the user as opposed to the hardware that actually exists.
Pretest loop
the continuation condition (determines if the iteration is completed) is tested at the beginning of each pass through the loop
Program maintenance
the fixing of errors that are uncovered through repeated usage with different input values.
Algorithm discovery
the process of finding a solution to a given problem.
loop
the repetition of a block of instructions
The analysis of algorithms
the study of the efficiency of algorithms. 1. time efficiency 2. Space efficiency
Benchmarks
useful for rating one MACHINE against another and for rating HOW SENSITIVE a particular algorithm is with respect to variations in input on one particular machine. the real way to measure algorithms is to measure their units of work
Approximation algorithms
ways to approach problems with no known polynomial solution
The worst case in binary search occurs
when the object is not in the list