Arrays, Searching & Processing features Flashcards
What is an Array?
Arrays are storage structures for computers that store variables.
What is a 1 dimensional array?
A storage structure with many storage locations addressable by index number.
Characteristics of a Binary search.
A search that can only be carried out on a sorted list.
Extremely fast, however if list is not sorted it does mean an additional overhead.
How does a Binary search work?
A Binary search works by dividing a sorted list in half each time a comparison is made. It will rarely require more that 4 or 5 comparisons regardless of items searched.
When is Binary search necessary?
Binary search is necessary when going through large data sets, however it can be very hard to program.
Characteristics of a Linear search.
Only way to search unsorted data.
Slow but simple, very easy to implement.
If data set is small can be just as acceptable as a binary search.
Requires N comparisons to search N data items.
How does a Linear search work?
Start with item 1: Is this what we’re looking for? No? Let’s try the next item. R peat until item is found or data is finished.
The four processing features of a programming language?
Instructions, Procedures, Methods and Functions.
What is an Instruction?
An instruction is a statement that describes and action that a program should carry out.
What is a Procedure?
A Procedure is a self-contained group of instructions that together, carry out a specific task. Also may be known as subroutine or modular.
Benefits of Modular programming?
Debugging is easier since areas can be more easily located.
Avoids duplication.
Useful procedures can be re-used.
What is an important feature of Procedures?
An important feature of Procedures is that variables are completely local and have no effect on similarly named variables in the main program or other procedures.
What is a Method?
A Method is an action that can be carried out on an object of a given class. Objects have pre-defined methods, and custom methods can be added to classes.
E.g show, bring to front, refresh.
What is a Function?
A Function is a procedure that calculates and returns a value.
What are the three Control Structures?
Selection Structure, Iteration Structure and Sequence Structure.