IB CS HL Topic 4 - Computational thinking, problem-solving and programming

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/29

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

30 Terms

1
New cards

Pseudo Code

Conditions

<p>Conditions</p>
2
New cards

Concurrent Programming

Concurrent Processing System - 1 job uses several processors to execute sets of instructions in parallel.

  • Increases computation speed and complexity of the programming language and hardware.

3
New cards

Sequential

Refers to processes that are executed one after the other, without overlap in execution.

4
New cards

GANTT charts

Useful way to track the order of events

<p>Useful way to track the order of events</p>
5
New cards

Pre conditions

Constraints the state of the system before the use case can start.

6
New cards

Post conditions

Constraints the state of the system after the use case has executed.

7
New cards

Abstraction

A technique for managing complexities of computer systems by removing some characteristics to focus on the essential ones.

8
New cards

Why use abstraction?

  • Convenient way to deal with complexity

  • Enables a person to concentrate on the essential aspects, while ignoring distracting details.

9
New cards

Successive Decomposition

A method of breaking down complex problems into simpler, more manageable sub-problems to better understand and solve them.

10
New cards

Collections

  • Unordered lists of unknown length

  • Dynamic size = efficient use of RAM

  • Can store any data type

  • Methods

    • addItem(item) - Adds an item to the end

    • getNext() - Returns the first item in the collection when first called, and subsequently gets the next item

    • resetNext() - Goes back to the start of the collection and restarts the iteration

    • hasNext() - Returns ‘TRUE‘ if there are

      one or more elements in the collection

    • isEmpty() - Returns TRUE if the collection does not contain any elements.

11
New cards

Sequential search

  • To find an item in an ordered/unordered list

  • Starts at the first element and compares each element to the target until it finds it.

  • Pros: Can be performed on both sorted & unsorted lists

  • Cons: Slower than binary search

<ul><li><p>To find an item in an ordered/unordered list</p></li><li><p>Starts at the first element and compares each element to the target until it finds it.</p></li><li><p>Pros: Can be performed on both sorted &amp; unsorted lists</p></li><li><p>Cons: Slower than binary search</p></li></ul><p></p>
12
New cards

Binary Search

  • Half-interval search

  • Only applies to sorted arrays

  • Finds the position of a target value by repeatedly dividing the interval in half and comparing the target value to the middle element of the array

  • If they are unequal, the lower or upper half of the array is eliminated, depending on the result, and the search is repeated in the remaining sub-array until it is successful.

  • Pros: Faster than sequential search

  • Cons: Can only be performed on sorted lists

<ul><li><p>Half-interval search</p></li><li><p>Only applies to sorted arrays</p></li><li><p>Finds the position of a target value by repeatedly dividing the interval in half and comparing the target value to the middle element of the array</p></li><li><p>If they are unequal, the lower or upper half of the array is eliminated, depending on the result, and the search is repeated in the remaining sub-array until it is successful.</p></li><li><p>Pros: Faster than sequential search</p></li><li><p>Cons: Can only be performed on sorted lists</p><p></p></li></ul><p></p>
13
New cards
<p>Bubble sort</p>

Bubble sort

  • Repeatedly steps through the list to be sorted, compares each pair of adjacent items, and swaps them if they are in the wrong order.

  • Pros: Can finish faster if no/less swaps are made

  • Cons: Makes a lot of swaps; complex

<ul><li><p>Repeatedly steps through the list to be sorted, compares each pair of adjacent items, and swaps them if they are in the wrong order.</p></li><li><p>Pros: Can finish faster if no/less swaps are made</p></li><li><p>Cons: Makes a lot of swaps; complex</p></li></ul><p></p>
14
New cards

Selection sort

  • Divides the input list into a sorted and an unsorted region.

  • Initially, the sorted sublist is empty, and the unsorted sublist is the entire input list.

  • Repeatedly selects the smallest/largest element from the unsorted region and moves it to the end of the sorted region.

  • Moves the sublist boundaries 1 element to the right

  • Pros: Max of n swaps (fewer than bubble sort); simple when memory is limited

  • Cons: Inefficient on large lists; must always perform n swaps - cannot finish early; complex

<ul><li><p>Divides the input list into a sorted and an unsorted region.</p></li></ul><ul><li><p>Initially, the sorted sublist is empty, and the unsorted sublist is the entire input list.</p></li><li><p>Repeatedly selects the smallest/largest element from the unsorted region and moves it to the end of the sorted region.</p></li><li><p>Moves the sublist boundaries 1 element to the right</p></li></ul><ul><li><p>Pros: Max of n swaps (fewer than bubble sort); simple when memory is limited</p></li><li><p>Cons: Inefficient on large lists; must always perform n swaps - cannot finish early; complex</p></li></ul><p></p>
15
New cards

Flowcharts

Shapes and Meanings

<p>Shapes and Meanings</p>
16
New cards

Factors affecting algorithm’s run time…

  • computer used, the hardware platform

  • representation of abstract data types

  • efficiency of compiler

  • competence of programmer

  • complexity of underlying algorithm

  • size of the input

17
New cards

Complexity

A measure of the amount of time [t(n)] and/or space required by an algorithm for an input of a given size (n).

<p>A measure of the amount of time [t(n)] and/or space required by an algorithm for an input of a given size (n).</p>
18
New cards

Iteration

  • Number of times a step is performed in an algorithm

  • Often in loops/recursive methods

19
New cards

Fundamental operations of a computer

  • CPU’s set of instructions

    • Add

    • Compare

    • Retreive

    • Store

20
New cards

Compound operations of a computer

  • A large number of sub-operations

  • Involves multiple stages/operations

21
New cards

Features of a computer language

  • Computer languages

    • High level - Java, Python, C++

    • Low level - Assembly, Machine Code

  • Fixed vocabulary

  • Unambiguous meaning

  • Consistent grammar & syntax

22
New cards

Need of high level languages…

  • Similar to human language = easier to understand

  • Allows for quicker development and debugging

  • Abstracts basic operations of a computer

  • Takes less time to type compared to low level languages

23
New cards

Compiler

The translator translates a high level language into a lower level language (done in a batch)

24
New cards

Interpreter

Translator translates a high level language into an intermediate code which will be immediately executed by the CPU (done line by line)

25
New cards

Assembler

Translator translates assembly language to machine code (mnemonics to binary)

26
New cards

Variable

  • Storage location for data

  • Represents a value

  • Naming a memory location for later usage

  • Has a pre-determined, fixed name and data type

27
New cards

Constant

  • An identifier with an unalterable associated value

  • Value cannot be changed during run-time

28
New cards

Operator

  • A character/set of characters that represents an action

  • Types

    • Boolean

    • Arithmatic

    • Assignment

    • Relational

29
New cards

Object

  • An instance of a class

  • Holds data (attributes - variables) and ways to manipulate the data (behaviors - methods)

30
New cards

Modular Programming

  • Breaking down a programming project into modules

  • Pros

    • Usefulness of reusable code

    • Manageable modules - easier to design, implement, test, and update/fix

    • Distributed development - Parallel work on different modules - less development time

    • Program readability increases

    • Eases program organization