[Unit 2.1] Computational Thinking Flashcards
Algorithms and Programming
define thinking concurrently
how problems can be run at the same time to be more efficient
how does concurrent processing work
process happens at same time. one starts before another finishes.
each process is given a slice of processor time
different processes can be executed in different cores
how does multitasking work in terms of concurrent processing
on a single core CPU:
-process is given slice of CPU time then paused
-next process is give slice of time and paused
-so on
on a multicore CPU:
-programs split between cores
-then same as single core CPU
what are the advantages of concurrency
more efficient use of processor time.
long running tasks do not delay shorter ones
tasks with preconditions can wait
user interact with other tasks
multiple users use same system at same time
what are the disadvantages of concurrency
not always faster than serial processing
makes programming harder
OS needs complex scheduling algorithms
whats the difference between parallel and concurrent processing
parallel - one core is running one task and another core running a different task
concurrent - cores swap processes between cores giving each process a slice of CPU time
what is multithreading
processes of program are divided into threads which can be worked on at the same time
define logic
principles used to reason about data in precise and structured manner
define thinking logically
carefully planning an algorithm to solve problems.
define pseudocode
write algorithms using code-like statements
define flow-charts
visually represent the steps that make up an algorithm
define decomposition
breaking down a complex problem down into smaller more manageable sub-problems
define top-down design
breaking a problem down into major tasks, each task is broken into subtasks and so on.
what is a hierarchy chart
used for representing structure of a program showing how modules relate to each other.
what are the advantages of decomposition
-splits problem into smaller easier problems
-makes problem more solvable
-leads to development of subroutines
-leads to modularity
-allows reusability
define thinking ahead
planning code to ensure efficient outcome and reusing code where possible.
what 4 things are involved with thinking ahead
I/O
pre conditions
reusable components
caching/pre-fetching
what are preconditions
conditions that must always be true before section of code executes
what are the advantages of preconditions
-ensures programmer knows what to check before calling code
-if none you can avoid unnecessary coding
-documentation of I/O & pre-conditions helps make code reusable
what are reusable components
modules/sections of program that are designed to be used in multiple programs without modification.
what are the advantages of reusable components
reduce code complexity
improve readability
save time
save money
what is caching in terms of thinking ahead
temporary storage of program instructions that have been used once and may be needed again shortly
give an example of caching in regular programming
putting a file into an array.
what are the disadvantages of caching
if original data is changed while being cached there will be inconsistencies and errors
What is computational thinking
The ability to think logically about a problem and apply techniques for solving it. Come up with more efficient solution
What is abstraction
Simplifying a problem by removing unnecessary details so we can focus on important parts
What are the advantages of using abstraction
simplifies design of software
simplifies coding of software
saves memory & other system resources.