Computer science unit 2

Description

Includes : Searchs and sorts Programming techniques (sequence, iteration, selection, arrays/lists + subroutines) Translators/compilers (1st generation, 2nd generation ...)
Somto Ibeme
Mind Map by Somto Ibeme, updated more than 1 year ago
Somto Ibeme
Created by Somto Ibeme over 6 years ago
104
4

Resource summary

Computer science unit 2
  1. ALGORITHMS
    1. Searchs
      1. Linear
        1. searches each item in list, compare w/ target until it matches/finished searching list
          1. does not need to be sorted, simple to understand
            1. inefficient on long lists, takes too long
            2. Binary
              1. needs to be sorted
                1. efficient on large lists
                  1. very fast
                    1. cancels half of list by finding midpoint
                  2. finds midpoint of list
                    1. compares with search target
                      1. if search target > midpoint - looks at upper bound
                        1. continues until found
                        2. if search target < midpoint - looks at lower bound
                  3. Sorts
                    1. Merge
                      1. halves list into two until single elements then merges back together in order
                        1. efficient on large lists
                          1. fastest out of all sorts
                            1. too complicated for smaller lists
                            2. Insertion
                              1. go through data one by one + check if current data is bigger/smaller than the number that was before it
                                1. slow + inefficient on large lists
                                  1. good for small lists, simple + accurate
                                    1. pass through the array once
                                  2. Bubble
                                    1. repeatedly swapping adjacent item if they are in wrong order, until they are in the correct order.
                                      1. not as efficient, takes many passes
                                        1. simple to understand + implement
                                    2. PROGRAMMING TECHNIQUES
                                      1. Sequence
                                        1. executed in the order they are written:
                                          1. total = mark1 + mark2 average = total / 2 print (total, average)
                                          2. Selection
                                            1. next statement to be executed depends on whether the condition being tested is true or false
                                              1. if statement
                                                1. if average >= 80 then print ("Distinction") else print ("Pass") endif
                                            2. Iteration
                                              1. repetition
                                                1. for... next
                                                  1. execute the loop a specified number of times - for counter = 1 TO 7
                                                  2. while... endwhile
                                                    1. execute the loop while a certain condition is true, tested at beginning
                                                      1. while emailAddress does not contain “@”
                                                    2. do... until
                                                      1. execute loop until certain condition is true, tested at the end of loop
                                                        1. do ... until emailAddress contains “@”
                                                          1. not in python, used for pseudocode
                                                2. TRANSLATORS/COMPILERS
                                                  1. 1st generation
                                                    1. machine code
                                                      1. Directly Executable by the processor, computer understands
                                                        1. hard to debug, hard to understand, difficult to program in
                                                          1. 0001 - input 1100 - store 0010 - output
                                                          2. no translator needed
                                                          3. 2nd generation
                                                            1. assembly code uses mnemonics
                                                              1. easier to program in compared with 1st generation but still difficult
                                                                1. slower than 1st generation- needs to be translated
                                                                2. One Assembly Language instruction translates to one Machine Code Instruction (1-1 relationship)
                                                                  1. uses assembler to translate
                                                                    1. used to program Device Drivers
                                                                      1. control the operation of a Hardware Device, GCD
                                                                    2. 3rd generation
                                                                      1. uses compiler to translate: translates in 1 go + displays error message afterwards
                                                                        1. harder to debug, hardware specific - suited to certain computer
                                                                        2. uses interpreter to translate: translates as program running (line by line) + if error found interpreting stopped; if not continue
                                                                          1. longer to run, slower
                                                                          2. easier to understand (uses English like key words) easier to debug
                                                                            1. One instruction translates into many machine code instructions
                                                                        3. ARRAYS/LISTS
                                                                          1. data structure that is fixed in size, capable of storing data, accessed by an index
                                                                            1. use 0 based counting (starts at zero)
                                                                            2. sorce = [ ]
                                                                              1. declaration
                                                                                1. memory set aside for contents, giving name to memory space
                                                                                  1. x
                                                                              2. score[0] = 3
                                                                                1. 3 is value to be stored at index
                                                                                  1. assingment
                                                                                    1. putting data into memory location
                                                                                      1. x = 6
                                                                                  2. 0 is position in list
                                                                                  3. score = [1,2,3,4,5]
                                                                                    1. scores[0] = 4
                                                                                      1. score = [4,2,3,4,5]
                                                                                        1. changed value stored at position 0
                                                                                    2. SUBROUTINES
                                                                                      1. code broken up into manageable segments
                                                                                        1. set of program instructions that do specific task
                                                                                        2. call
                                                                                          1. execute subroutine
                                                                                            1. Menu ()
                                                                                            2. instruction that starts subroutine
                                                                                            3. parameters
                                                                                              1. info about data being passed to a function in brackets
                                                                                                1. def FirstTask (textToDisplay, num) :
                                                                                                  1. num + textToDisplay = paramters
                                                                                                2. arguments
                                                                                                  1. value passed to parameter
                                                                                                    1. meal = input("Enter meal") price(meal)
                                                                                                      1. sending response to subroutine
                                                                                                3. function
                                                                                                  1. section of code, performs specific task, returns value
                                                                                                    1. algorithm to calculate VAT
                                                                                                  2. procedure
                                                                                                    1. does not return value
                                                                                                      1. algorithm for making a square
                                                                                                    Show full summary Hide full summary

                                                                                                    Similar

                                                                                                    OCR GCSE History-Paper Two: The Liberal Reforms 1906-14 Poverty to Welfare State NEW FOR 2015!!!
                                                                                                    I Turner
                                                                                                    Latin Literature Exam Techniques
                                                                                                    mouldybiscuit
                                                                                                    Geography Quiz - Tectonics
                                                                                                    oscartaylor
                                                                                                    4. Civil War
                                                                                                    ShreyaDas
                                                                                                    How does Virgil build up tension in the death of Nisus?
                                                                                                    mouldybiscuit
                                                                                                    Maths GCSE - What to revise!
                                                                                                    livvy_hurrell
                                                                                                    Computing Hardware - CPU and Memory
                                                                                                    ollietablet123
                                                                                                    GCSE Biology B2 (OCR)
                                                                                                    Usman Rauf
                                                                                                    C1 Quiz
                                                                                                    Leah Firmstone
                                                                                                    Biology Revision - Y10 Mock
                                                                                                    Tom Mitchell
                                                                                                    Biology- Genes and Variation
                                                                                                    Laura Perry