computer science - unit 2.1

Cards (27)

  • Pseudocode is a text-based way of representing the sequence of steps in an algorithm
  • Flowchart symbols:
    • Terminal: start or end of the process
    • Process: something being initialized, processed or calculated
    • Decision: represents a decision with yes or no outcomes
    • Input/output: represents the input and output of data to the algorithm
    • Subroutine: has its own flowchart, but when called from the main program, it's expressed using a specific symbol
  • Trace Tables involve examining a printed extract of program code, taking each line at a time, writing out the current state of each variable, and noting any output produced
  • Merge Sort:
    • Efficient method of sorting
    • Uses divide and conquer method
    • Repeatedly splits the data set in half until each item is in its own list, then merges adjacent lists back together
  • Insertion Sort:
    • Inserts each item into its correct position in a data set one at a time
    • Useful for smaller data sets and inserting items into an already sorted list
  • Linear Search:
    • Checks each item in turn from the beginning of a data set
    • Works on any type of storage device and is efficient for smaller data sets
  • Binary Search:
    • Calculates a mid-point in the data set and checks if it is the item being searched for
    • More efficient than linear search as it finds items in smaller steps
  • Bubble Sort:
    • Compares each item with the next one and swaps them if they are out of order
    • Finishes when no more items need to be swapped
    • Easy to implement, making it popular for smaller data sets
  • Algorithmic Thinking:
    • Involves creating a set of rules (algorithm) to reach a solution by identifying individual steps needed
  • Abstraction:
    • Removing unnecessary details and including only relevant details in problem-solving
    • Icons and flow charts are examples of abstraction used in problem-solving
  • Decomposition:
    • Breaking a complex problem into smaller manageable parts
    • Advantages include making problems easier to solve and reducing development time by allowing different people to work on different parts simultaneously
  • A computer is an electronic device that takes an input, processes data, and delivers an output
  • When tackling a problem, it's essential to consider all the inputs, processes, and outputs:
    • Inputs: anything supplied to the program to meet its goals, often input by the user, consider appropriate variable name and data type
    • Processes: calculations needed during program execution, data format changes, and data type considerations
    • Outputs: what the program needs to output, the form of the output, appropriate variable name, and data type for any output
  • the ram (random access memory) stores data temporarily while it's being used by the cpu
  • linear search - starting from the beginning of a data set and checking each item in turn until the item is found
  • binary search - calculated midpoint of data set and checks for item to be found. If item is lower than midpoint it repeats on left, vice versa. It repeats until item is found or there there are no remaining items left to check.
  • Binary search is quicker than linear search
  • but if item is first in the list, linear search would be far quicker
  • Fractions cannot be used for binary search, only integers
  • bubble sort compares each item with the next one in the list and swaps them if they are out of order
  • bubble sort is the most inefficient but it is very easy to implement and a popular choice for smaller data sets
  • merge sort uses divide and conquer method, creating 2 or more sub problems
  • merge sort is very effiebt
  • insertion sort - inserts each item into its correct position one at a time
  • insertion sort is useful for smaller data sets
  • syntax errors - break the grammatical rule of the programming language and stop it from running
  • logic errors - produce an unexpected output and on their own they are not enough to stop the program from running