A+ | Verified
1. Algorithm A series of instructions.
A sequence of unambiguous instructions for solving a problem.
Input -> *"computer"* -> output
problem -> algorithm ->
*"computer"*
2. Why should
you study *1. Theoretical Importance* -the core of computer science
algo- rithms? *2. Practical importance* - framework of designing and analyzing
algorithms for new problems
3. What are the
two *1. How should you design them?*
main issues relat- -Brute force (trial and error)
ed to algorithms? -Divide and conquer
-Etc.
*2. How do you analyze algorithm eflciency?*
-How good is the algorithm? (space eflciency, time eflciency)
-Does there exist a better algorithm? (lower bounds, optimality)
4. Data
structures will ...our algorithms.
be accessed
by...
5. Data Structures A technique of storing and organizing data so it can be used eflciently.
Describe the data structure by the Abstract Data Type.
Fundamental Data Structures:
-List (array, linked list, string)
-Stack/queue
-Graph
-Tree
1/
17
, Data Structures Exam 1 Questions And Verified Answers | Graded
A+ | Verified
6. Abstract An item defined by a *series of operations*. Can be implemented
Data Types
through class definitions in an object-oriented language.
Ex. Stack - based on a stack data structure, which operations should we
7. Define pro- use? (push, pop, top, etc.)
gram
behavior in Operations
terms of
to
be performed
on data.
8. What kind of
linear
structure does
a Stack have? Last-in-first-out (LIFO)
(items can only be added and removed from one end)
9. Suppose we have 1. Implement both and compare - expensive and error prone
two algorithms,*Algorithm Analysis* - preferably, analyze them mathematically
how can we
tell which is
better?
10. Data structures
...algorithms.
are
implemented
by...
11. Algorithm Com-
Eflciency depending on the amount of data the algorithm must process.
plexity
12. 1. Time complexity
2. Space complexity
2/
17
, Data Structures Exam 1 Questions And Verified Answers | Graded
A+ | Verified
What are the
two measures
of effi- ciency?
13. Time Complexity The amount of *time* an algorithm takes in terms of the amount of
input.
14. Space Complexi-
ty The amount of *memory (space)* an algorithm takes in terms of the
amount of input.
15. Asymptotic Com-
plexity When *n (number of input items)* goes to infinity, what happens to the
16. Machine-Inde- algo- rithm's performance?
pendent
Fairly compare algorithms regardless of what machine it is running on
(some machines will run slower).
17. What is Big-O No- Comparing the eflciency of two algorithms (determining asymptotic
analysis).
tation used for?
18. Big-O
Notation Let f(n) and g(n) be functions where n is a positive integer. We
Definition write *f(n) = O(g(n))* if and only if there exists a real number c
and a positive integer N satisfying *0 df(n) dcg(n)* for all n eN.
19. Are we more in-
terest in space Usually, time complexity.
or time
complexity?
20. *COME BACK
TO BIG O HERE *COME BACK TO BIG O HERE IF NEEDED*
IF NEEDED*
21. What are some of -You must know the size of the array at the time the code is compiled
the limitations of -Consecutive - the elements of the array are required potentially extensive
arrays? shifting
3/
17