computer science

Cards (198)

  • An algorithm is a sequence of steps that can be followed to solve a problem.
    Be aware that a computer program is an implementation of an algorithm and that an algorithm is not a computer program.
  • Decomposition means breaking a problem into a number of sub-problems, so that each subproblem accomplishes an identifiable task, which might itself be further subdivided.
  • Abstraction is the process of removing unnecessary detail from a problem.
  • more than one algorithm can be used to solve the same problem.
  • When referring to exam efficiency it means TIME efficiency
  • A linear search is a simple sequential search that starts at the beginning of a list and compares each item in the list with the value it is looking for until it finds a match.
  • A linear search doesnt require the list to be sorted so is easier to code but it can take a long time to find the item you are looking for if the list is long
  • A linear search starts at the first item in a list
    It compares the value with the item you are searching for (search term)
    If they match then stop and exit the algorithm, otherwise move onto the next item and repeat
    continue until you find a match or reach the end of the list
  • A binary search searches an ordered list to find an item starting in the middle of the list and comparing that with the search term
  • A binary search starts in the middle of a list
    divides the list into two halves and compares the middle value with the search term
    If they match then stop, otherwise, if search value is smaller than middle item then discard the middle item and everything on the right of it and visa versa
    Repeat the above steps with the part of the list that wasnt discarded until a match for the search term is found or until there are no more items in the list to search
  • Binary searches are much quicker for longer lists but require an ordered list
  • Bubble Sort

    Each run through the list, from start to finish, is known as a pass. The bubble sort continues until a pass is made where no values have been swapped. At this point, the list is sorted.
  • local variables use less memory and are easier to debug. They also allow subroutines to be self - contained.
  • subroutines make the program easier to maintain, they allow multiple people to work on the same program, they can be re-used, they can be tested independently
  • Hex is useful because large numbers can be represented using fewer digits. For example, colour values and MAC addresses are often represented in hex. Additionally, hex is easier to understand and remember than binary. Programmers often use hex to represent binary values as they are simpler to write and check than when using binary.
  • • kilo, 1 kB is 1,000 bytes
    • mega, 1 MB is 1,000 kilobytes
    • giga, 1 GB is 1,000 Megabytes
    • tera, 1 TB is 1,000 Gigabytes.
  • Binary shifts can be used to perform simple multiplication/division by powers of 2.
  • extendid ASCII uses 8 bits allowing 256 characters instead of 128
  • unicode can be between 1 and 4 bytes long but unicode takes up more storage space than ASCII
  • Unicode uses the same codes as ASCII up to 127
  • the term pixel is short for picture element. A pixel is a single point in an image
  • Colour depth is the number of bits used to represent each pixel
  • Files contain extra data called metadata. Metadata includes data about the file itself, such as:
    • file type
    • date created
    • author
    An image file also includes metadata about the image data itself, such as:
    • the height and width of the image - this defines how many rows and columns the pixels are to be arranged in
    • the resolution
    • the colour depth
    Without this metadata, the image data would not be correctly interpreted, meaning the image could not be correctly displayed.
  • a sample is a measure of amplitude at a point in time.
  • analogue signals are sampled to create the digital version of sound.
  • Sampling rate is the number of samples taken in a second and is usually measured in hertz (1 hertz = 1 sample per second).
    Sample resolution is the number of bits per sample.
  • File size (bits) = rate x resolution x seconds
  • An image can be compressed by reducing its colour depth. This reduces the range of colours that the image contains. In practice, this results in an averaging of shades of colours.
    For example, a very light shade of green could be averaged with a not so light shade
  • For sound, lossy compression may remove sounds outside the human range of hearing that were nevertheless picked up during recording. This would produce no noticeable loss of quality, but would reduce the file size.
    Similarly, an audio file can be compressed by reducing the bit depth of the samples. MP3 is a lossy audio file format
  • There are some files that we would not want to lose data from. For example:
    • text files
    • spreadsheets
    • financial records
    • emails
    With lossless compression, files are reduced in size without the loss of data. However, lossless compression does not usually achieve the same file size reduction as lossy compression.
  • PDF is lossless
  • PNG is lossless
  • JPEG is lossy
  • MPEG is lossy
  • MP3 is lossy
  • Here is some data: 00 00 00 11 11 11 11 00 00 00, which is ten data values of two characters each, giving 20 characters in total. RLE looks for the runs of each data, and records what the data is and how many times in succession it occurs. These values are stored instead of the original data.
    For example:
    00000011111111000000 becomes:
    60 81 60 (six 0s, eight 1s, six 6s)
    In large files, this can result in significant space savings.
  • The main advantages of compression are reductions in storage space, data transmission time, and communication bandwidth. This can result in significant cost savings.
  • Hardware is the physical components of a computer. Software is the programs that run on a computer. A computer system requires both hardware and software to function
  • system software manages the computer system resources and acts as a platform to run application software
    application software is software that performs end-user tasks.
  • OS handles management of the:
    processor(s)
    memory
    input/output (I/O) devices
    applications
    security.