Storage Management Flashcards
What are Algorithms?
Algorithm
◦ An algorithm is a finite sequence of well-defined, computer-implementable
(optional) instructions, typically to solve a class of specific problems or to perform a
computation.
◦ Algorithms are always unambiguous and are used as specifications for performing
calculations, data processing, automated reasoning, and other tasks.
◦ An algorithm must terminate
What is a Computer Program?
Program
◦ A computer program is a collection of instructions that can be executed by a
computer to perform a specific task
◦ A computer program is usually written by a computer programmer in a
programming language.
◦ A programs implements an algorithm
◦ A program may or may not terminate. For example, an OS
On what basis algorithms are compared?
- Time
- Space
What are Counting Models in analysis of algorithms?
Counting Models
* Core Idea: Total running time = Sum of cost × frequency for all operations
◦ Need to analyze program to determine set of operations
◦ Cost depends on machine, compiler
◦ Frequency depends on algorithm, input data
* Machine Model: Random Access Machine (RAM) Computing Model
◦ Input data & size
◦ Operations
◦ Intermediate Stages
◦ Output data & size
What are Asymptotic Analysis in Analysis of Algorithm?
Asymptotic Analysis
* Core Idea: Cannot compare actual times; hence compare Growth or how time increases
with input size
◦ Function Approximation (tilde (˜) notation)
◦ Common Growth Functions
◦ Big-Oh (O(.)), Big-Omega (Ω(.)), and Big-Theta (Θ(.)) Notations
◦ Solve recurrence with Growth Functions
What are some of the common order of growth classifications?
O(1), O(N), O(log N), O(N log N), O(N^2), O(N^3) and 2^N
What are various data configurations or scenarios for analysis?
Best Case
▷ Minimum running time on an input
◦ Worst Case
▷ Running time guarantee for any input of size n
◦ Average Case
▷ Expected running time for a random input of size n
◦ Probabilistic Case
▷ Expected running time of a randomized algorithm
◦ Amortized Case
▷ Worst case running time for any sequence of n operations
What are Data Structures?
A data structure specifies the way of organizing and storing
in-memory data that enables efficient access and modification of the data.
Linear Data Structures
◦ Non-linear Data Structures
* Most data structure has a container for the data and typical operations that its needs to perform.
Efficiency is measured in terms of time and space taken for these operations.
What are some of key operations relating to data structures
- Create
- Insert
- Delete
- FInd/ Search
- Close
What are Linear Data Structures?
A Linear data structure has data elements arranged in linear or sequential manner such
that each member element is connected to its previous and next element.
Examples of linear data structures are Array, Linked List, Queue, Stack, etc.
Different examples of linear data structure:
* Array: The data elements are stored at contiguous locations in memory.
* Linked List: The data elements are not required to be stored at contiguous locations in memory. Rather each element stores a link (a pointer to a reference) to the location of the next element.
* Queue: It is a FIFO (First In First Out) data structure. The element that has been
inserted first in the queue would be removed first. Thus, insert and removal of the elements in this take place in the same order.
* Stack: It is a LIFO (Last In First Out) data structure. The element that has been
inserted last in the stack would be removed first. Thus, insert and removal of the
elements in this take place in the reverse order.
What are characteristics of Arrays?
- Random access using its index at constant time.
- Elements are stored in contiguous locations.
- Fixed Sizes, not flexible
- Insertion / removal at random location/arbitrary position is costlier O(N) but insertion / removal at end is O(1)
What are characteristics of Linked Lists?
- Elements are not required to be contiguous
- Each element is stored in a node. A node has two parts:
◦ Info: stores the element.
◦ Link: stores the location of the next node - Flexible in size
- insertion or removal of an element at/from any arbitrary position is efficient.
- Random access not possible. Only sequential access.
What is Linear Search?
The algorithm starts with the first element, compares with the given key value and returns yes if they
match.
* If it does not match, then it proceeds sequentially comparing each element of the list with the given key
until a match is found or the full list is traversed.
What is Binary Search?
- Input is sorted list.
- Compares middle element and based on the result eliminates half of the search inputs thus reducing the search time to O(Log N)
What are Non linear data structures?
Nonlinear data structures are those data structures in which data items are not
arranged in a sequence and each element may have multiple paths to connect to other elements.
Common Non-Linear Data Structures include:
◦ Graph: Undirected or Directed, Unweighted or Weighted, and variants
◦ Tree: Rooted or Unrooted, Binary or n-ary, Balanced or Unbalanced, and variants
◦ Hash Table: Array with lists (coalesced chains) and one or more hash functions
◦ Skip List: Multi-layered interconnected linked list