Algorithms and Data Structures ALL (TIM)

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Base Class

" contains attributes and methods. It is the highest class and does not inherit from any other class."

Parameter passing - By Reference

" the location (in memory) of the data is used. This means that any changes are retained after the procedure or function has been completed."

Functions

"A block of code given a unique identifiable name within a program. A function can take either zero or more parameters when it is called and should return a value. It should be designed and written to perform one task or action which is clearly indicated by its name."

Procedures

"A block of code given a unique identifiable name within a program. It can take either zero or more parameters when it is called and should be designed and written to perform one task or action which is clearly indicated by its name."

Subclass

"A class that extends another class. The subclass inherits the methods and attributes of the class it extends."

Superclass

"A class that has been extended by another class. It allows the extending class to inherit its attributes and methods."

Dijkstra's Shortest Path

"A graph search algorithm that solves the single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree. This algorithm is often used in routing and as a subroutine in other graph algorithms. In practice in picks an unvisited vertex with the lowest-distance, calculates the distance through it to each unvisited neighbour, and updates the neighbours distance if smaller. It the marks the visited when done with neighbours."

High Level Language

"A language designed to help a programmer express a computer program in a way that reflects the problem that is being solved, rather than the details of how the computer will produce the solution. One-to-many language."

Low Level Language

"A language which is close to machine code. Related closely to the design of the machine. A one-to-one language"

Assembly Language

"A language which is related very closely to the computer's own machine code. "

Overriding

"A method in a subclass or derived class which has the same name as a method in one or more of its superclass's. The method supersedes all other versions of the method above it in the inheritance tree."

OOP (Object Oriented Programming)

"A method of programming which classifies real world objects into classes and encapsulates those objects attributes and behaviours."

Binary Search

"A particularly efficient search method. It only works if records in the file are in sequence. This type of search involves accessing the middle record in the file and determining if the target record has been found or, if not, if it is before or after in the sequence. This process is repeated on the part of the file where the target record is expected, until it is found."

Method

"A program routine contained within an object designed to perform a particular task on the data within the object. A method can broadly be thought of as a procedure / function from more traditional procedural programming languages."

Algorithm

"A sequence of steps designed to perform a particular task. It may be constructed to describe the operation of a complete system or to describe a particular part of it."

Bubble Sort

"A simple algorithm popular with inexperienced programmers. It is inefficient when sorting large amounts of data as the time taken is related to the square of the number of items. If 10 items take 1ms then 100 times will take 100ms (this is 10 times the number of items and so the time will be 102 or 100 times longer)."

Insertion Sort

"A simple sorting algorithm that builds the final sorted array (or list) one item at time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort."

Attribute

"A single bit of data within a record"

Polymorphism

"A specialised form of overloading which allows us to create very general object structures, which can be used with a wide range of data types."

Modularity

"A technique of code design where a solution is broken down into a number of small self-contained and manageable chunks. Each Module of code should be designed to perform one set specific purpose. If during design it is found that the module starts to grow and performs more than one task then the additional functionality should be split out into a new module."

Class

"A type definition of an object"

Merge Sort

"A type of divide and conquer algorithm that was incited by John von Neumann. First the list is divided into the smallest unit (1 element), then each element is compared with the adjacent list to sort and merge the two adjacent lists. Finally all elements are sorted and merged."

Quick Sort

"A type of divide and conquer algorithm which sorts the given sequence in place meaning that it doesn't require extra storage as would be needed in a merge sort. The basic idea is dividing the sequence into two sub-lists around an element which is called the pivot such that all elements in the lower sub-list are less than the value of the pivot element and all elements in the higher sub-list are greater than the pivot element."

Local Variable

"A variable which is defined and can only be used within one part of the program (normally a single function or procedure)."

Encapsulation

"All of the object's attributes are contained and hidden in the object and access to them is restricted to operations of that class."

Object

"An instance of a class."

LMC (Little Man Computer)

"An instructional model of a computer, created by Dr. Stuart Madnick in 1965. It is generally used to teach, because it models a simple von Neumann architecture computer - which has all of the basic features of a modern computer. It can be programmed in machine code or assembly code"

Derived Class

"Any class that inherits attributes and methods from any other derived class or base class."

Procedural Language

"Any high level language in which program statements can be grouped in self-contained blocks called procedures and functions. These procedures have their own variables, not accessible outside the procedure

Parameters

"Data structures passed into a Procedure or Function when they are initially called."

Linear Search

"Involves examining each entry in turn in the file until the time is found or the end of the file is reached. Unless the file is in some useful order a serial search has to be used."

OO (Object Orientation)

"Looking at systems by classifying them into real world objects"

Indexed Addressing

"Modifies the address (either a direct or an indirect address) in the address field by the addition of a number held in a special-purpose registers, called an index register, before the address is used. Index registers are quickly and easily altered providing an efficient way of accessing a range of memory locations, such as in an array."

Sequence

"One of the 3 basic programming constructs. Instructions happening one after the other in order"

Machine Code

"Set of all possible instructions made available by the hardware design of a particular processor. Closest to pure binary."

IDE (Integrated Development Environment)

"Software that performs the various stages of software design and implementation in a single integrated system. It will usually include facilities for project management, design, graphical design, programming, testing and producing documentation."

Instantiation

"The process of creating an actual named instance of class. Creates a named copy of the class in an object of that class."

Parameter passing

"The process of providing a procedure, function or module with values at the point when you call it."

Programming Paradigm

"The word 'paradigm' means to describe an example or pattern. In a Computing context, this means to describe a computational way of doing things. This is a style or way of programming. E.g. Low-Level languages, High-Level languages, Declarative languages are all examples of different programming paradigms."

Big O Notation

"Used in computer science to describe the performance or complexity of an algorithm. This specifically described the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm."

Indirect Addressing

"Uses the address field to hold the address of a location that contains the required address.

Direct Addressing

"Uses the data in the address field without alteration. This is the simplest method of addressing and also the most common."

Immediate Addressing

"Uses the data in the address field, not as an address, but as a constant that is needed by the program. An example is a routine counting up to 10, which may have the constant '10' supplied in the address field of an instruction. Although the address field cannot hold numbers as large as those that can be stored as data in a memory location, because space has to be left for the operation code field, this is a particularly convenient method of loading constants into the accumulator."

Inheritance

"When a derived class is defined it also has all the attributes and methods of the base class."

A* Algorithm

"Widely used in pathfinding and graph traversal, the process of plotting an efficiently traversable path between points, called nodes. A* uses a best-first search and finds a least-cost path from a given initial node to one goal node (out of one or more possible goals). As A* traverses the graph, it follows a path of the lowest expected total cost or distance, keeping a sorted priority queue of alternate path segments along the way."

Parameter passing -By Value

"a (local) copy of the data is used, which is discarded when the subprogram exits."

Merge Sort

- Split all elements into individual arrays. - Compare the first element in both arrays. - Put the smallest into a new list. - Compare the next element of 1 array with the second element of the 2nd array. - Put the smallest into a new array. - Repeat until merged.

Machine

0's and 1's which are directly executable by the processor. This is the generation that "computers understand". Difficult to program in and hard to understand or debug. This is also known as _____________ code

Bubble Sort

A Sorting Algorithm that passes over the list many times, compares each pair of adjacent items and swaps them if they are in the wrong order.

Selection

A code construct that makes a choice between two or more outcomes

Iteration

A code construct, also known as a loop.

Variable

A named value in a computer program that can be changed by the program code as it runs. "temp" and "num" are examples in our bubble sort program.

Sorting Algorithm

A process commonly used to sort data

Binary Search

A search algorithm that divides the search space in half each time until it finds the target, faster than linear but requires the array to be sorted.

Linear Search

A search algorithm which looks at every element in turn until it finds the target, it is slow but works even on unsorted data.

List

A set of data that can be sorted into order

Search Algorithm

A structured process that finds a target in a set of data.

Boolean

A value that is either true or false

Array

A variable that can hold list items

Drivers

Device _________________ are loaded into memory by the Operating System and used to control the operation of a Hardware Device e.g. Graphics Card _________________, Printer __________________.

Casting

Changing the data type of a value

Range Check

Checks that a value falls within the specified range. e.g. number of hours worked must be less than 50 and more than 0. Age could be >11 and <19

Presence Check

Checks that data has been entered into a field e.g. in most databases a key field cannot be left blank. When filling out a form, your name and date of birth may also be compulsory.

Length Check

Checks the data isn't too short or too long e.g. A password which needs to be six letters long

Iteration

Code is executed repeatedly e.g. While loop, for loop, do-while, repeat-until

Linear search

Each item in the list is checked in order. Can be used on both ordered and unordered list.

Insertion sort

Each item is taken in turn, compared to the items in the rest of the array and placed in the correct position.

Ordered List

Elements are arranged in sequence

Descending

Falling, going from largest to smallest

Algorithmic Thinking

Identifying the steps involved in solving a problem.

Lookup Table

Looks up acceptable values in a table. e.g. There are only seven possible days of the week.

a[n]

Python code that represents the nth member of an array called a.

Insertion Sort

Removes one element from unsorted data and puts it where it belongs in sorted list. Repeats until no input elements remain.

Abstraction

Representing 'real world' problems in a computer using variables and symbols and removing unnecessary elements from the problem.

Ascending

Rising, going from smallest to largest

Assignment

Setting the value of a variable or a constant. HINT: In Python this is done with one = sign

Pseudocode

Simplified programming code that is not language specific, used to design algorithms.

Algorithm

The series of steps to solve a problem or perform an action.

Check Digit

The ________________________ is the last one or two digits in a code are used to check the other digits are correct. e.g. bar code readers in supermarkets use check digits

Target

The item we are searching for in a search algorithm.

Pivot

Used in Quick Sort, items are compared to this element, and placed one side or the other.

Out of Range

Values higher or lower than the expect range, for teenagers greater than 19

Dry Run

Walking through an algorithm which sample data, running each step manually.

Red

What colour are comments?

Sequence

When a list of instructions is carried out in order

Null Value

When no data is entered or left blank to test what happens.

if

a Python keyword that makes a selection

for

a Python keyword that starts a loop

Ordered arrays

Data structure with: fast binary search O(logN) slow insertion and deletion O(N)

Unordered Arrays

Data structure with: fast insertion O(1) slow linear search and deletion O(N)

Valid

Data that is correct

Real

Decimal number with a single decimal also known as a Float

Binary Search

Fast searching algorithm, but the array must be sorted Drawbacks --> insertion takes longer O(logN)

Tab

How do we ensure that our indentations are exctly the same? What is the key on the keyboard?

Quick Sort

In this sorting algorithm, a pivot is chosen, and all the elements moved either side of the pivot. This is repeated with another pivot either side, recursively until done.

Invalid

Incorrect values such as entering 'Dave' in an age field.

Procedure

Is a subprogram (set of instructions) stored under one name that can be called from the main program, unlike a function, it does not return a value.

Function

Is a subprogram that receives data from a program, manipulates it in some way and returns a value as a result.

Syntax Errors

These are mistakes in the way that the code is written. There may be a mistake in the grammar or rules of the language. There may be spelling mistakes, incorrect use of punctuation, missing brackets or incorrect use of capital letters.

Runtime Errors

These errors which may cause program errors or the computer to crash even if there appears to be nothing wrong with the program code.

Machine

This Binary code is an example of _____________________ language

Assembly

This code is an example of

High

This code is an example of a ______________level language

Decision Box

This is a

Process

This is a

Start/Stop

This is a

Sub-Routine

This is a

Binary Search

This is a characteristic of a ???

Linear Search

This is a characteristic of a ???

Linear Search

This is a type of?

Input/Output

This is an

Insertion Sort

This is an?

Iterative Testing

This is testing the code as you create it

Debug

This means to go through the code to search for where/why an error has occurred

Merge Sort

This shows a__________________________?

Data Sanitisation

This trims or strips strings, removing unwanted characters from strings

Unordered List

Unarranged Elements

Integrated Development Environment

What are these features of? - Editor (for writing the code) - Error Diagnostics (such as de-bug facilities) - Run-Time Environment - Translators

Assembler

What are these features of? - Translate Assembly Language code into Machine Code - Necessary for Device Drivers - Used when fast execution is required or limited memory/file size

Interpreter

What are these features of? - Translate and execute source code Line by Line, statement by statement - Source code is checked for syntax - if correct, code is executed. If incorrect it stops. - Used for development (aide debugging)

Compiler

What are these features of? - Translates entire source code all in one go into Machine Code - Error Reports created along with Object Code

Green

What colour are strings?

Assembly

___________________ code which uses mnemonics. This is easier than machine code (programming in binary). One ___________________ language instruction has an equivalent machine code instruction.

Validation

___________________ is a check made by a computer to ensure that the data entered is sensible or reasonable. It attempts to ensure that it is within certain limits or rules.

Assembly

____________________ code needs to be translated into Machine Code for the computer to be able to execute it. It uses an Assembler for the translation.

Authentication

_____________________ is a coding method to check that a user is who they say they are and allowed to accesses the program.

Abstract Data Type

A class considered without regard to its implementation E.g. Stacks, queues, or lists

Selection

A condition such as an IF statement, Branch, Case or Switch is used to decide whether code should be executed

Linear Search

slow searching algorithm O(N)

Binary Search

- The list needs to be in order. - Take the middle value. - Compare to the value you are looking for. - IF it is the value you are looking for. * Celebrate, and stop. - ELSEIF it is larger than the one you are looking for. * Take the values to the left of the middle value. - IF it is smaller than the one you are looking for. * Take the values to the right of the middle value. - Repeat with the new list. This is a type of ??? Search

Pseudocode

- This means 'fake code'. - It's part way between English sentences, and programming code. - It is language neutral (it can be read by programmers who are able to use any language).

Arrays

A data structure: Advantages - Easy to access a particular item - Insertion is fast in an unordered array - Searching is fast in ordered array - Data locality in memory Disadvantages: - Some algorithms require large number of shifting/moves - The size of an array cannot be changed once created - If the size is too large... waste of memory - If the size is too small, it cannot be expanded dynamically

Data Type

A description of the types of data being stored or manipulated e.g. string, integer, real, boolean

Flowchart

A diagram that shows the inputs, outputs and processes in an algorithms.

Constant

A location in memory that stores a value that can not be changed while the program is running

Variable

A named location in memory that stores a value that can be changed while the program is running

Array

A set of data items of the same type grouped together using a single identifier. These can exist in 2D aswell as single dimensions

Merge Sort

A sorting algorithm that sorts partial lists then merges them together.

Operator

A symbol used to indicate that a particular opertation is to be performed such as + - *

Trace Table

A table that follows the values of variables to check for accuracy.

Integer

A whole number

Priority Queue

Abstract data type where: dequeue is O(1) but enqueue is O(N) --> slow insertion, so priority queue is often implemented using a heap to improve insertion time

Extreme

Also known as boundary data, ________________ data is unusual data or data which falls on the limit of acceptability

Linked List

An abstract data type: Advantages: - Take as much memory as needed --> Number of links can be expanded dynamically - No need to move items around Disadvantages: - Conceptually less intuitive than arrays - The objects/items of the link can be located anywhere in memory (loss of data locality) Big O - Insertion /Deletion at beginning of list is O(1) - Insertion at end of double-ended linked list is O(1) Finding, deleting or inserting next to a specific link is O(N) - Number of comparisons is O(N) like for arrays but items do not need to be shifted/movies --> expected to be faster than using arrays

Selection Sort

An algorithm which passes over the list, finds the smallest item and moves it to the left, then repeats the exercise for the remaining list until it is all sorted.

Merge Sort

An array is split into individual sub arrays, these sub-arrays are sorted and then combined (2 arrays at a time).

Binary Search

An ordered list is divided in 2 with each comparison. The pivot is the midpoint.

Input Sanitisation

Another method for validating data and stopping attacks is to clean up the data that is inputted so that it is ready for the application to use.

Decomposition

Breaking down a large problem into smaller sub-problems.

High

Languages such as Python, Java, Ruby, Javascript all resemble human languages making them easier to debug. The focus is more on logic and being able to be written easily by humans rather than the focus being on specific hardware e.g. a specific CPU or memory address. These programs are portable (they can be run on various machines). These are known as ___________ level languages. One instruction in a ____________ level language translates into many machine code instructions.

Low

Machine code and assembly code are known as _________________ level languages

Bubble Sort

Moving through a list repeatedly, swapping adjacent elements that are in the wrong order.

String

Multiple characters

Recursion

Programming technique in which a function calls itself - calling a function involves some memory overhead and more time than an iterative approach - danger of memory leak (stack overflow) is an issue - some problems e.g. Fibonacci and Factorial lend themselves naturally to this approach and these are easier to read when programmed using __________________

Test Plan

The following a featured in a ? - The test number - The data entered - The type of test data - The expected outcome - The result of the test - Action required as a result of the test

Verification

The process of asking someone to enter their password twice (double entry) to check that it matches is also known as _____________________

Logic Errors

The program runs and does not terminate or crash, but the bug in the program causes it to operate incorrectly, or produce an unexpected/incorrect result.

Computational Thinking

The use of computers to solve problems

Format Check

The____________________ ensures the data is in the right format e.g. A National Insurance number is in the form LL 99 99 99 L where L is any letter and 9 is any number. A phone number always starts with a 0 followed by a 1 or 2 if it is a landline or a 7 if it is a mobile.

Comments

These are characteristics of ______________________ : - To inform them reader of a bug or issues - To explain the code and its function in more detail - To stop a line of section of code from executing

Indentation

These are characteristics of __________________________ : - To group together a function - The group a code block

Iteration

These are examples of __________________


Kaugnay na mga set ng pag-aaral

Chapter 11 Understanding Visual Arts

View Set

NUR 422: Community Health Nursing Midterm

View Set