DATA STRUCTURE

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Addressing Function

- a function which maps the ith element of a vector array onto an integer between 1 and n, where n is the no. of elements of the vector array.

Array

- a group of elements having the same data type. - can be represented so as to permit the referencing of any elements by knowing its position in the structure.

programming

- a problem solving process - it is implemented in a machine known as computer and the operations provided by the machines in used to solve problem

Data Type

- actual implementation of ADT in a particular programming language - set of data together w/ the operations - not a mathematical model unlike ADT - refers to the kind of data that variables can assume, hold, or take on in a programming language and for which operations are automatically provided - classification of a set of data values together with its operations - refers to atomic data types

execution time

- amount of time spent in executing instructions of a given problem - it is dependent on the particular computer (hardware) being used - expressed in T(n), where is T is time function

Stack

- an ordered collection of items into which new items may be inserted and from which items may be deleted at one end only (the top end) - LIFO (Last In First Out) structure

solution domain

- data structure to use an algorithm in order to solve problem - links the problem and machine domains

machine domain

- hardware specifications (RAM & processor in order to solve problem) - consists of storage medium (memory0 and processing unit

time efficiency

- how fast the algorithm or program runs/executes - (performance) - amount of time required to process the data

problem domain

- input data in order to obtain expected output data results - includes the input or the raw data to process, and the output or the processed data

O(n) = Big-O notation or Order of growth of a function

- is a more generalized approximation of an algorithm's time efficiency or running time and space utilization (RAM usage). = a notation used in the analysis of algorithms. = used to classify algorithms by how they respond to changes in the input size (i.e. change in the runtime and space utilization of the algorithm as input size change). = provides approximation(estimate) of the 2 factors to analyze algorithms (running time/time efficiency and space/memory utilization/space efficiency). = describes how quickly runtime will grow relative input as the input gets very large.

Input size

- is the most variable/unpredictable factor among all factors. - changes drastically compared to other factors.

total frequency count

- is the number of times an instruction/statement in an algorithm/program is executed. - the sum of all instructions frequency counts

Abstract Data Type (ADT)

- mathematical model with a collection of operations defined on a model - data operations/operator - generalization of primitive data type - specifies the type of data structured. it specifies what its operations do - mathematical model that describes a set of data together with the operations used to manipulate the data

Data Structure

- the implementation of ADT in terms of the data types or data structure - a collection of atomic data represented in some unique structure - a collection/group of atomic data together with operations

space utilization

- this is how much memory is used - the amount of memory required to store data

1. saves memory/RAM space 2. runs or executes fast

2 Factors/Criteria in deciding what data structures and algorithm to use

1. Algorithm saves RAM (fewer variables) 2. Algorithm saves running time (executes fast)

2 factors to choose an algorithm

Space Complexity

Aside from being concern about time complexity of an algorithm/code, we are also concerned with how much memory/space an algorithm uses. The notation of space complexity is the same as time complexity (Big-O), but instead of checking the time steps or frequency count of operations, we check the size of the allocation of memory.

the Big-O notation / Order of growth

O(n) = called ______________________

Problem Machine Solution

Programming, as a problem solving process, could be viewed in terms of 3 domains.

cubic (worst runtime) exponential quadratic log linear linear logarithmic constant (least runtime)

RANK THE COMMON FUNCTIONS GROWTH RATE IN BIG-O:

FALSE

TRUE OR FALSE. A sorting algorithm accepts n integers as input to be sorted in ascending order. The running time to sort 5 integers (n=5) is the same as the running time to sort 10 integers (n=10).

FALSE

TRUE OR FALSE. The exact running time of any instruction can be determined

Total Frequency Count

The approximate total running time of an algorithm.

The number of times the instruction is executed. The amount of time to execute the instruction.

The running time or execution time of one instruction in an algorithm is a product of these two numbers. 2 answers

unit

The storage medium - bits, bytes, words - consists of serially arranged bits that are addressable as a __________.

theoretical estimation

This is to estimate or approximate an algorithm's running time, not calculating the exact running time, since exact running time can vary depending on the computer hardware and other factors

Data Structure Algorithm

Two things that are equally important in problem solving programming process

1. Finiteness 2. Definiteness 3. Input 4. Output 5. Effectiveness

What are the five properties of algorithms?

a) Parenthesis Count at any point in the expression is >= 0. b) Parenthesis Count is zero at the end of the expression.

What are two requirements for valid arithmetic expressions with parentheses?

Algorithm efficiency

What is measured in two criteria?

T- time function n - size

What is n and T in T(n)

push

adds a new element into the Stack at the top end.

processing units

allow us to perform basic operations that include arithmetic, comparison and so on (processor's instruction set)

algorithm

designing a good or effective set of instructions to operate...

effectiveness

ensured if all the operations in the algorithm are sufficiently basic that they can, in principle, be done exactly and in finite time by a person using paper & pen

definiteness

ensured if every step of an algorithm is precisely defined

Data Structure

examples of this are array, structure, queue, linked list, tree, graph

Data Type

examples of this are s int (+, -, *, /, %), float (+, - *,/), char(concat)

1. input size 2. underlying algorithm 3. machine speed 4. quantity of source code of the algorithm implementation (program) 5. quality of machine code generated from the source code by the compiler

five factors that affect the execution (running) time

Big O

is an estimate of the worst case performance of a function assuming the algorithm will perform the maximum number of iterations.

Linear Addressing Function

loc(a[i]) called a ___________

finiteness

means an algorithm must terminate after a finite number of steps

Data Structure

refers how the data used by the algorithm (program) represented. It involves identifying the correct input data needed to to be processed in order to obtain the desired result or output data

pop

removes the top element from the Stack

IsEmpty()

returns True if Stack is empty, otherwise returns False.

Size()

returns the number of elements in the Stack.

raw data

set of numbers in the original (unsorted)

complexity of algorithm

several algorithms could be created to solve a single prob;em

processed data

sorted numbers

input

the domain of the algorithm (raw input data) which could be zero or more quantities

output

the set of one or more resulting quantities which is also called the range of the algorithm (must be atleast one)

partial algorithm (like ATMs) total algorithm (definite start and definite end)

two types of algorithm

Last in First Out

what is LIFO?

branching factor

what is b in O(b^n)

depth

what is d in O(b^n)


Ensembles d'études connexes

Hazmat - Will Not Carry - Labeling and Marking

View Set