Please enable JavaScript.
Coggle requires JavaScript to display documents.
Computer Science- Component 2 (Algorithms (Insertion Sort- Simple…
Computer Science- Component 2
Recursion
- any routine that calls itself
Decomposition
-Breaking down a problem into a number of sub-problems , each sub-problem accomplishes an identifiable task
Procedure
- Piece of code that you can run whenever needed
Function
- Same as above but returns a value
Global variables
- accessible throughout an entire program including its subroutines
Not a good implementation, as code can create conflict later and if the variable has the same name it will be difficult to change later
Local variables
- only accessible from within the subroutine in which they are defined
Subroutine
- Section of code that can be called or executed anywhere in a program
Software Development Life Cycle
Step 1
- Feasibility study e.g costs?
Step 2
- Analysis e.g research
Step 3
- Design
Step 4
- Implement
Step 5
- Evaluation e.g Testing
Step 6
- Maintenance - feedback
Models
Spiral Mode
- Used for large projects, after going through each stage a prototype is made
Waterfall Model-
A linear and sequential method, once a stage is completed it is difficult to mane the previous stages as code will need to be written again
Agile Model
- iterative and incremental process models with focus on process adaptability and customer satisfaction
Same as spiral, but small multitasking groups work together
*Cyclical model
- * Similar to waterfall , good model for managing large groups of developers working in parallel
Pipelining
-where multiple instructions are overlapped in execution
Concurrency
- is known as when several things are happening simultaneously
Algorithms
Big O Notation
- measure of time complexity
O(n!) is the worst, and O(long n) is extremely efficient
Binary Search
- Examines the middle item first, if item is found returns the index. If not, eliminates half the list depending on greater or less than the middle item. Repeats until found
Only works for a sorted list . Big O = O(long n)
Insertion Sort-
Simple comparison sort where the sorted list is built up one item at a time, compares item to the right then identify if its bigger or less than and move on.
ADV
: Simple to code,good performance with small lists, memory efficient
Dis
-Poor performance in large lists, not as quick as merge or quick sort
Quick Sort-
Splits list into two smaller lists, chose item from the list to act as a 'pivot' then split the lists and compare against the pivot value
Does not work well with sorted lists, very complex to code
Fastest method on handling most lists
Merge Sort
-quicker to sort two small lists then merge them together, rather sort one big list in the first place. Big O = O(n log n)
Bubble Sort-
simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order.