1/127
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Lists
- Collection of data all stored as one value
- Most algorithms need to look through each item of a list
- To search
- To sort
Loops
Structure that allows you to repeat code multiple times
The two types of loops
For loop and while loop
For Loop
Used if you know how many times you are required to loop
While Loop
Used if you are unsure or cannot determine how many times you are required to loop
Linear Search
- O(n) operation
- Start with the first element and compare it with the search item
- If not found, move onto the next element
- If found return true, otherwise return false
- Variations on search
- Returns index of found item
- Return on all found items
- P vs Np
Flag Variable
Set to true or false
For an o(n) search problem where n=30, the worst case scenario would be for the search to take how many steps ?
30 steps
Binary Search
- o(log n) search
- Find the center of the data and compare it to the searched element
- If match, then found
- If no match
- If smaller than center element, eliminate elements to the right
- Else eliminate elements to the left
- Linear vs Binary (Binary is faster)
- Downsides of Binary Searches ?
- Has to be sorted because the data needs to be in order
Using a binary search, what is the worst case scenario if you search for an item in a list that has 20 items ?
5 steps
Sorting
- Process of arranging items in a systematic order
- In computer science, it generally means placing items in an increasing or decreasing order
- Sorted data can make other operations more efficient, such as searches
Issues with Sorting
- Can take a lot of time
- Takes a lot of space (memory)
Sorting Algorithms
- Many sorting algorithms in existence
- Each one typically has pros and cons (depends on the environment)
- Some slow, but memory efficient while other are fast, but need a lot of memory space
- Some good with large sets of data, but carry unnecessary overhead for small amounts of data
- Some work well with partially sorted data, but are terrible with unsorted data
- Others do not benefit from partially sorted data, but do not degrade when data is completely unsorted
Quicksort Algorithms
- First element (in the example video) in the list serves as a pivot
- Place elements smaller than pivot to the left and the rest to the right
- Starting with the left partition, use the first element and sort all elements and then do the same with the right partition
Selection Sort
n^2
- In place comparison sort
- Does not use lots of extra memory
- Has terrible worst case scenario, best case scenario, and average case
- Easy to implement, but inefficient
- Until all elements are sorted
- Move to the beginning of the unsorted segment and set marker
- Find smallest element in unsorted segment
- Swap with element at the beginning of the unsorted segment
- Move marker one spot to the right
- Even if it is already sorted, it will take the same amount of time because each comparison must be completed
- Look at notes for the selection sort example
Which of the following Big O notations would be unacceptable to use unless the number of items was extremely small ?
O(2^n)
Algorithms and Complexity
Algorithms are classified by the rate of growth of the resource utilization (time or memory) as the size of the data grows
Big "O" Classifications
O(1) - Constant
O(log n) - Logarithmic
O(n) - Linear (search)
All these are fine
O(n^2) - Quadratic
O(2^n) - Exponential (unacceptable) (the number has to be extremely small or else it gets crazy)
- Constant is the best because it means that it will always be the same amount of time however, the time that it takes to set up memory to do the search
- That setup process is going to take much longer
True or False: While the canvas component (found in the drawing and animation section) has many interesting features and capabilities, one major downside is that the canvas component only has 3 event handlers to choose from when programming it in the blocks view
False
Multimedia
- Content that includes more than one medium
- Text
- Images
- Audio
- Video
Importance of Multimedia
- Multimedia can make information compact and more impactful
- Infographics
- Visualization
- Can bring understanding when otherwise it might not be possible
- Multimedia can make content more accessible
- Overcoming disabilities
- Convenience/options (Audiobooks)
Differences between Infographics and Visualization
Infographics
- Can not interact with
- Time consuming to create infographics
- It is something that is planned out
- Easy to understand
- Tries to convey a message and point you in a certain direction
Visualization
- Can interact with
- Used when you have so much information
- Once the program is created, you can grab the information and the software will do rest of the work
- More complex
- Not planned out
Reasons why you would want to use multimedia in apps
Aesthetics, accessibility, and context
Multimedia Formats: How is media represented ?
- Data representation
- 1s and 0s
- Need a transition process
Multimedia Formats - Text
- Textual data is represented using standard encoding schemes
- ASCII is one of the earliest systems
- Each character is represented by a number
- 1 byte meant only enough for an American character set
Multimedia Formats - Text (Unicode)
- Unicode
- Includes ASCII
- Used by every machine in the world to display characters
- All languages and some non-languages (emojis and symbols)
Multimedia Formats - Digital Images
- Collection of pixels
- Pixel element
- Smallest part of an image that can be displayed/represented
- Each pixel is one color
- Pixels are tracked
- A pixel is one point of light
Multimedia Formats - Image Files
- Contain information about an image
- Meta information: size, color scheme, file type, and etc
- Color information about each pixel
- Binary vs Grayscale vs Color
- Binary is using only two colors, Grayscale is using colors from 0-255 and color is how much is RGB
- Look at notes for better explanation and examples
Multimedia Formats - Differences between each image file (include if they are lossy or lossless)
- Jpg is lossy
- Gif and png are lossless
Jpg
- Millions of colors, no animation, and no transparent background
Gif
- 256 colors, animation, and transparent backgrounds
Png
- 256 colors or million of colors, no animation, and transparent backgrounds
Lossless vs lossy
Lossless - a data compression technique in which there is no loss of information
Lossy - a data compression technique in which there is a loss of information
Why do we need compression ?
- Need compression because it makes your files smaller which makes it easier to transfer the files
- It will get to the destination faster and takes less space on the server
Multimedia Formats - Audio Files
- Analog to Digital
- Sampling
- ADC vs DAC
- Mp3, flac, aiff, and wav
Sampling
A process of capturing the value of a sound wave at regular intervals, typically thousands of times per second, to store sound and music digitally
Lossy vs Lossless in Audio Files
Lossy - mp3, mp4, and aac
Lossless - flac and alac
No compression - wav and aiff
Multimedia Formats - Video Files
- Video is a series of still images played back in rapid succession and synched audio
- FPS (the less fps makes the image blurry and more life like you are watching a movie) (having more frames per second makes it almost slow motion and you can see every single detail)
- Video codecs are used to "code"/"decode" the video to keep file sizes as small as possible while maintaining quality
Multimedia - Ethical Issues
- Always an issue, but center stage recently - why?
- Fake News is why it has been even more of an issue
Multimedia - Ethical Issues - Text
Scenario 1: Newspaper or Magazine - Should an editor be able to make changes to better communicate an idea ? Why or why not ?
- Most people would say yes because that is the editor's job
- The editor should not make change the whole article and them put someone's else name on it
Multimedia Ethical Issues - Digital Images
- Anything is possible
- Can do anything with photoshop (change and edit photos)
- Can be bad because people can change the color of someone's skin or edit the photo to make someone look bad
Example: The Dove Evolution Campaign
- They photoshopped the women before putting her face on the campaign
- Laws to identify image manipulation
- So final decision - when is it acceptable
- The only time it is acceptable is if it is for fun
- It is not acceptable when it is used to trick people
Multimedia Ethical Issues - Audio
- Lots of possibilities
- Low Tech - taking things out of context
- High Tech - voco, Google Duplex (software that can call and make appointments)
- For voco, they can type in what they want the software to say and then change the audio
Multimedia Ethical Issues - Video
- Anything is possible with the right tools
- Low Tech - deceptive editing
- Middle of the road - DeepFakes software
- High Tech - movie industry
Computing Platforms (the different types)
- Personal computer (desktop)
- Mobile computer/wearable devices (Laptop, tablets, smartphones, smartwatches, smart jewelry, and fitness trackers)
- Servers (a computer or system that provides resources, data, services, and programs to another computer - known as a client)
- Supercomputers (most powerful computers in the world and used to solve the most hardest problems)
Client - Server Relationship
You have one computer that is in the middle and you have all these clients (the other computers) pulling information from the central computer (server)
What are the 2 basic pieces that come together to make all computers ?
Hardware and Software
List of Servers
- Gaming server
- Mail server
- Web server
- Database server
- Communication server
- Application server
More Information related to supercomputers
Supercomputers are used to cure diseases, create the most powerful weapons, solve crimes, hack into other computer systems that are password protected, figure out how to save energy, and much more
Hardware
- Lots of parts inside your system
- CPU (central processing unit)
- RAM (random access memory)
- Adaptor Cards
- Motherboard
- Input and Output devices
- Storage devices
CPU
- The brain of the computer
- Handles all the data that is processing in your system
- The more powerful your CPU is, the more instructions your device can handle per second - which makes your device more efficient
RAM
- Temporary storage area for all your data that needs to be processed for any and all programs being used by the device
- The more RAM your device has, the more programs you can have running the problems and this gives you the ability to use programs that use large files
Adaptor Cards
- Video card, sound card, wifi card, and a card that gives you extra usb slots
- Use these cards and attach them to the motherboard to give you extra features on your computer
Motherboard
The motherboard is what you plug everything into
Input and Output Devices
Input Devices
- Gives you the ability to input data into your computer
- Keyboards, mouse, microphone, and scanner
Output Devices
- Used to communicate the information that was created by the computer
- Printer, monitor, speakers, projectors, and haptic output (vibrations)
Storage Devices
- Devices that are used to store data for long periods of time
- Hard drives, flash drives, CD drives, DVD drives, and the cloud
What are the most important hardware to consider when choosing a device ?
CPU and RAM
Hardware - Memory (main and second)
- Main memory (RAM)
- Where data/information is stored while being used by the processor
- Second Memory
- Storage (your storage devices)
- Look at notes for a diagram
4 Things that makes a computer a computer
- Must be able to input data
- Must be able to process data
- Must be able to store the data
- Must be able to output the data
The 4 things are
- Input
- Process
- Output
- Store
Hardware - Memory - Data Representation
- Data is represented by binary digits (bits)
- A bit is the smallest unit of information a digital device can manipulate (1 or 0)
- 1s and 0s, on and off, electrical charge or not
- 8 bits make a byte
- Bytes represent data in memory with each memory cell holding one byte of data
What does 1 and 0 represent ?
1 is on ad 0 is off (ONe = ON)
How many bits make a byte ?
8 bits
Kilo
1,000 (Thousand)
Mega
1,000,000 (Million)
Giga
1,000,000,000 (Billion)
Tera
1,000,000,000,000 (Trillion)
The order of the prefixes
Kilo, mega, giga, and tera
The difference between Kb and KB
- the small b is bit
- the big B is byte
Hardware - Memory - Bytes
- Bytes can represent any type of data as long as you have the software to translate them
- 01011010 could be:
- Shade of green
- 90
- z
- C# (music)
What is 00100100 in Decimal ?
36
What is 01100011 in Decimal ?
99
What is 90 in binary code ?
01011010
What is 101 in binary code ?
01100101
What is 201 in binary code ?
11001001
Name three output devices
Printer, monitor, speaker, and projector
Name four input devices
Keyboards, mouse, microphone, and scanner
What is 00011100 in decimal ?
28
What is 00000111 in decimal ?
7
What is 50 in binary code ?
00110010
What is 31 in binary code ?
00011111
ASCII vs Unicode
ASCII:
- is 7 bit
- This takes care of 0-9 A-Z, a-z and punctuation...
- One byte system
- Can not be used to represent everything
UNICODE:
- Includes ASCII
- Can go up to 4 bytes
- Displays all languages and some non languages
- Used by every machine in the world to display characters
Hardware - Memory (Volatile vs Non- volatile)
- Volatile vs Non- volatile
- RAM/main memory vs ROM/secondary storage
- RAM - temporary memory that stores bytes of data and program instructions for the CPU to access
- ROM - permanent storage for data and instructions that do not change (like firmware) and for instructions needed for tasks such as booting your computer
- ROM stores data, using circuits with states that are fixed. Therefore, the data represented by this combination is not lost when the power is removed
Volatile vs Non-volatile Memory
- Volatile - data is wiped clean when the power is lost to the computer
- Non- volatile - keeps the data in storage when power is lost to the computer
What is an example of volatile memory ?
RAM
What is an example of non-volatile memory ?
ROM
What is another name for RAM ?
Main Memory
What is another name for ROM ?
Secondary Storage
Hardware - Processing
- CPU - processor and brain of the computer
- Directs and coordinates operations in the computer
- Performs arithmetic, comparison, and logical operators
- Control Unit is the brain of the computer and controls all the operations in the computer
- The ALU handles anything math related
What is system software ?
Used to run the computer's hardware and applications
Two categories of system software (descriptions of each)
- OS (operating system)
- controls your computer's hardware and acts as a user interface
- Utility programs
- Used to maintain, protect, and improve your computer's device (security software or networking software)
What is the definition of software ?
The electronic instructions that govern a computer's actions to provide a computing service
What are the two categories of software ?
System software and application software
What are the two different types of system software ?
OS (operating system) and utility programs
Software - Operating systems (OS)
An operating system is a set of computer programs that controls the computer hardware, and acts as a user interface
Operating Systems List
- Controls computer hardware
- Manage RAM
- Manage processor
- Manage programs
- Monitors performance
- Control input/output devices
- Provide a user interface
- Provide networking functionality
Software - Programming
- Machine language - programming language understood by computers comprised of only 1s and 0s
- High level languages - languages used by programmers to simplify computer programming
- Contains easy to read syntax that is converted into a low level language readable by a CPU
- Converted using a complier
- Complier- takes the source code for HLL and converts it into a machine level module called an object file. A "translator" will check for syntax errors and report problems
- All languages fit into two categories: low level (machine language and assembly language) and high level (Java, C, and Python)
What is automation ?
Automation is a series of steps that are predetermined and are executed automatically with minimal human interaction
Birth of automation
- Printing Press
- Manufacturing
Where is automation being used in homes ?
- Video camera (automatically set so if there is movement, you get an alert)
- Lighting (you can have a system where when you walk in a room, the lights might turn on or dim at a certain time)
- Washing machine
- Sprinkler System (automatically set so your lawn is being watered at a certain time)
Where is automation being used in the work/industry environment ?
- Robots cooking hamburgers
- The machines shaping the pots
- The assembly line used for the production of cars
- Warehouses where they have robots pack groceries
Benefits and downsides to automation
Benefits
- Speed (faster)
- Quality/consistency (gives you the same result each time)
- Safety (save human lives)
- Lower costs (the machines don't take vacations or need health insurance)
- Higher production yields
Downsides
- Impact on labor (humans lost their jobs)
- The robots might get hacked
Impact on Labor (automation)
- Limited human interaction translates to limited dependence on human capital
- Fewer workers
- New Jobs (training ?)
- Robots and machines can not modify to tasks
- Humans are flexible (For example: at a gas station, a human can be the cashier and make sandwiches)
- Human can react to change
- Humans can take on additional tasks
Autonomous Systems (the definition)
- Can act pseudo independently
- System that is goal oriented
- Contains intelligence to react to environment
The tenets of autonomous systems
- Have a way to examine the environment -> Sensors
- Contains a logic system (AI) to determine the best action
- Contains actuators to take action