A step-by-step set of instructions to accomplish a task, whether by a computer or a human
Algorithm
Provides a sequence of steps (instructions) to follow in order to achieve the desired outcome
As long as it resolves the problems at hand, it can be valuable
Data types in App Inventor
Numbers
Text (strings)
Boolean values
Objects
List
A collection of elements
List in a computer program
List of student names in a classroom management app
Loop
Used when you know exactly how many times you need to iterate through a block of code
While loop
Used when you are uncertain about the number of iterations required or when the loop should continue until a certain condition is met
Big O notation
A way of expressing the time complexity of an algorithm in terms of the growth rate of the algorithm's resource usage (usually time or memory) as the size of the input data increases
Common Big O notation classifications
O(1)
O(log n)
O(n)
O(n^2)
O(2^n)
O(1)
Considered okay
O(2^n)
Considered unacceptable because of its exponential growth rate
Linear search
Sequentially checks each element of the list until it finds the target element or reaches the end of the list
Worst-case scenario for linear search
Occurs when the target element is not present in the list, requiring n comparisons, where n is the number of elements in the list
Binary search
Repeatedly divides the search interval in half until the target element is found or the interval is empty
Worst-case scenario for binary search
Occurs when the target element is not present in the list, requiring log2(n) comparisons, where n is the number of elements in the list
Downside of binary search
List must be sorted beforehand, which can be an additional overhead
Sorting
The process of arranging items in a systematic order, usually either increasing or decreasing
Benefits of sorting
Can make searches more efficient
Can facilitate other operations such as data retrieval & analysis
Quicksort
Works by selecting a pivot element from the list & partitioning the other elements into 2 sub-lists according to whether they are less than or greater than the pivot
Selection sort
Works by repeatedly finding the minimum element from the unsorted part of the list & moving it to the beginning
Volatile memory
Loses its data when the power is turned off
Non-volatile memory
Retains its data even when the power is turned off
Volatile memory
RAM
Non-volatile memory
ROM, hard drives
CPU (Central Processing Unit)
The "brain" of the computer responsible for executing instructions
Main parts of the CPU
Control Unit
Arithmetic Logic Unit (ALU)
Control Unit
Coordinates the activities of the CPU
Arithmetic Logic Unit (ALU)
Performs arithmetic & logical operations
Software
The electronic instructions that govern a computer's actions to provide a computing service
Categories of software
System software (operating systems, utility programs)
Application software (word processors, web browsers)
System software
Controls and manages computer hardware & provides a user interface
Types of system software
Operating system (OS)
Utility programs
Jobs/responsibilities of an operating system
Controls computer hardware
Manages RAM & processor
Manages programs
Monitors performance
Controls input/output devices
Stores & manages files
Provides a user interface
The 2 basic components that make up all computers are CPU and RAM
RAM
Stores data while being used by the processor
ROM
Read Only Memory; permanent storage for data and instructions that do not change
CPU
Performs arithmetic and logical operations
Categories of software
System software
Application software
Programming software
Hardware software
Functions of an operating system
Provide a user interface
Manage RAM
Manage programs
All of the above - answer
Compiler
Converts high-level language into machine-level language