7 Algorithm design and problem solving Flashcards
What are some different types of programming languages?
Declarative, object-oriented, event driven, procedural
What is a declarative programming language?
Language where rules are declared, you can ask questions, answer given based upon the rules
What is an object-oriented programming language?
Language where user can create objects that have attributes and methods
What is an event driven programming language?
A language where there are buttons, text boxes and items user can interact with, each item has its own code which is only run when the item is clicked or changed, all code of program not run from start to finsih
What is a procedural programming language?
Language with statements run in order they are written in, uses subroutines which can be called from other parts of the program
What is the program development life cycle?
A series of structured steps followed to produce a system
What are some different varieties of the program development life cycle?
Cyclic, spiral, waterfall and rapid development
What are the stages of the program development life cycle?
Analysis, design, coding and testing
What is decomposition?
The process of taking a problem or system, and splitting it into smaller parts (sub-problems, sub-systems) which it turn can be split into smaller parts
What is the analysis stage of the program development life cycle?
The first stage of the cycle where the problem is investigated
What is the design stage of the program development life cycle?
The second stage of the cycle where the program is planned out and the problem is decomposed
What things can be used in the design stage of the program development life cycle to plan out the program?
Structure diagram, flowcharts and pseudocode
What is a structure diagram?
A hierarchical diagram that shows a decomposed system, the name of the program at the top and its subprograms below
What is a flowchart and what are its components?
A diagrammatic representation of an algorithm with symbols for decisions, processes, start / stop points, inputs / outputs and arrows to show the direction of flow
In a flowchart, how is the content inside each box written?
Written as words or pseudocode statements
In a flowchart, what is the symbol for a each thing?
Start / stop - curved rectangle thing, process - rectangle, input / output - parallelogram, decision - diamond (think)
What is pseudocode?
Code-like statements used to design an algorithm but do not follow any specific language
What is important in pseudocode and what can be imperfect?
Logic is important, syntax can be imperfect
What is the coding stage of the program development life cycle?
The third stage of the cycle where a program is written in a programming language, includes iterative testing while program is being developed
What is the testing stage of the program development life cycle?
The fourth stage of the cycle where a program is repeatedly used with test data to ensure it fully works, doesn’t crash and meets all requirements
What are the four types of test data and what are their details?
Normal - data program should accept, abnormal - data program shouldn’t accept, extreme - data on edge of what is accepted, boundary - data on edge of being accepted and rejected
What is a search algorithm?
An algorithm which checks a set of data to see if a specific value exists in it or not
What is a sorting algorithm?
An algorithm which takes a set of data and rearranges it to be in a specific order
What is linear search?
A search algorithm which checks each item one at a time, and keeps continuing to the next item until it finds the data it is searching for or reaches the end
What is bubble sort?
A sorting algorithm which takes values 1 and 2, swaps them if they are the wrong way round, checks values 2 and 3, and repeats for the entire list.
How does a bubble sort algorithm stop?
If the number of times the algorithm has been through the list = the number of elements in the list - 1, or if the algorithm has been through the list without making any changes
What are some number-related things program can do?
Totalling, counting, finding the minimum, finding the maximum, finding the average (can be mean)
What is validation in computer science?
The checking of data to make sure it is reasonable and within set bounds
What are some types of validation?
Range check (checks if data within one or two numeric bounds), length check (checks number of characters within set limit), type check (checks data is the correct type), presence check (checks if data has been entered), format check (checks if data is entered in correct format / order)
What is a check digit?
Error detection method where check digit is calculated from set of numbers, input with numbers, calculation performed on data again and check digit values compared to see if data entered is correct
What is verification in computer science?
The process of checking that data is entered accurately, that it is the same as the original
What are some examples of verification, and what happens in each?
Visual check - visually checking the entered data with the original side-by-side; double entry check - same data entered twice, usually by different people, and then entered data compared
What is a trace table and its structure?
A structure which is completed when manually running an algorithm line by line, each column in a table for one variable and column for all outputs
What can a trace table be used for?
Helps to follow a program to work out its purpose (see what changes made and when) and find and correct errors (shows what program actually does, different from what it should do, error found)
What methods can computer programmers use to find errors?
Using a trace table, dry running by reading code, use featured within Integrated Development Environment (IDE)