Unit 3 Vocab
Vocab from weeks 13-16 (Unit 3 presentations)
Definitions
Term | Definition |
---|---|
Algorithm | At its core, an algorithm is really just a generalized, conceptual solution to a problem that can later be implemented in some real-world form like a computer program. |
Application Program Interface | Application program interface (API) is a set of routines, protocols, and tools for constructing software applications. An API specifies how software components should interact. In addition, APIs are used when programming graphical user interface (GUI) components. |
Binary | A numeric system of base 2 that only uses combinations of the digits zero and one; this is used in one of the lowest levels of abstraction. Computers operate in binary, as they store data and perform calculations using only zeros and ones. While a single binary digit can be used to represent True (1) or False (0) in boolean logic, multiple binary digits can be used in conjunction to store large numbers and perform complex functions. Computers translate between binary and what you actually work with such as numbers and text. |
Binary Search | A search algorithm that locates the position of a target value within a sorted array by repeatedly dividing the search interval in half; can only be used when the list is sorted. Because of its divide-and-conquer approach, the amount of work required to find an item grows much more slowly with Binary Search than with Sequential Search. In fact, with this logarithmic behavior |
Boolean Function* | Any function based on the operations AND, OR, and NOT, and whose elements are from the domain of Boolean algebra. A function whose arguments, as well as the function itself, assume values from a two-element set (usually {0,1}) Central Processing Unit CPU, or processor, is the brains of the computer where most calculations take place. Contains the circuitry necessary to interpret and execute program instructions. |
Computational Artifact | Something created by a human using a computer and can be, but is not limited to, a program, an image, an audio, a video, a presentation, or web page file |
Cryptography | The science of coding and decoding messages in order to keep them secure. Coding takes place using a key that ideally is known only by the sender and intended recipient of the message. |
Floating Point Numbers | As the name implies, floating point numbers are numbers that contain floating decimal points. Examples include, the numbers 5.5, 0.001, and -2,345.6789. Numbers without decimal places are called integers. Computers recognize real numbers that contain fractions as floating point numbers. |
Hexadecimal | Hexadecimal describes a base-16 number system. That is, it describes a numbering system containing 16 sequential numbers as base units (including 0) before adding a new position for the next number. The hexadecimal numbers are 0-9 and then use the letters A-F. Used to represent digital data because it utilizes fewer digits than binary. |
Integers | An integer is a whole number (not a fraction) that can be positive, negative, or zero. In computer science, an integer is a datum of integral data type, a data type that represents some finite subset of the mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values. |
Iterations | Iteration is the repetition of part of an algorithm until a condition is met or for a specified number of times. This is often called a ‘loop’. Recursive functions repeatedly execute themselves as part of their operation. Upon completing all instructions and resetting to the first one iteration has been completed. |
Libraries | In computer science, a library is a collection of non-volatile resources that a program can use often to develop software. Libraries are particularly useful for storing frequently used routines because you do not need to explicitly link them to every program that uses them. The linker automatically looks in libraries for routines that it does not find elsewhere. Resources which may be found in libraries include data, documentation, message templates, pre-written code, classes, or values. |
Linear/Sequential Search | A process that checks every element in the list sequentially until the desired element is found or all elements have been searched. Can be used in any type of list. Has linear performance. |
Lossless Data Compression | With lossless compression, every single bit of data that was originally in the file remains after the file is uncompressed. All of the information is completely restored. This is generally the technique of choice for text or spreadsheet files, where the loss of words or financial data could pose a problem. PNG is an image format that provides lossless compression. |
Lossy Data Compression | Lossy compression reduces a file by permanently eliminating certain information, especially redundant information. When the file is uncompressed, only a part of the original information is still there (although the user may not notice it). Lossy compression is generally used for video and sound, where a certain amount of information loss will not be detected by most users. JPEG provides lossy compression. |
Metadata | Metadata is data that describes other data. Metadata summarizes basic information about data, which can make finding and working with particular instances of data easier. It provides information concerning an item’s content such as image resolution and size. |
Pseudocode | Pseudocode is a detailed yet readable description of what a computer program or algorithm must do. It may also describe an operating principle. It is expressed in a formally-styled natural language rather than in a programming language intended for humans. The conventions of normal programming continue. |
Sequencing | The execution of each step/action of an algorithm in the precise order in which the statements are given. |
# converts decimal to binary
def decimal_to_binary(num):
# Create an empty list to store the binary digits
binary_digits = []
# Create a loop that continues until the number is zero
while num > 0:
# Use the modulo operator to find the remainder when the number is divided by 2
remainder = num % 2
# Divide the number by 2 and store the result in the same variable
num = num // 2
# Insert the remainder at the beginning of the list
binary_digits.insert(0, remainder)
# Return the list of binary digits as a string
return "".join([str(x) for x in binary_digits])
# calling the code
decimal_num = 14
binary_num = decimal_to_binary(decimal_num)
print(binary_num) # Output: 1110
Binary search:
# Binary search
def binary_search(arr, target):
# Set the initial bounds of the search area
low = 0
high = len(arr) - 1
# Continue searching until the bounds are the same or cross each other
while low <= high:
# Find the midpoint of the search area
mid = (low + high) // 2
# Check if the target is the midpoint
if arr[mid] == target:
return mid
# If the target is greater than the midpoint, narrow the search area to the right
elif arr[mid] < target:
low = mid + 1
# If the target is less than the midpoint, narrow the search area to the left
else:
high = mid - 1
# If the target was not found, return -1
return -1
# calling the code
arr = [1, 3, 5, 7, 9, 11, 13, 15]
target = 7
index = binary_search(arr, target)
print(index) # Output: 3
Boolean function:
# Is the number even or odd? (using Boolean)
num = 7
def is_even(num):
if num % 2 == 0:
return True
else:
return False
if is_even(num):
print(num, "is even.")
else:
print(num, "is odd.")
result = is_even(num) # Output: Boolean value (true for even, false for odd)
print(result) # Output: False
Computer Artifact:
# Calculates factorial of a given number
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
result = factorial(5)
print(result) # prints 120
Floating point numbers:
a = 3.14
b = 1.0
# perform some arithmetic operations on the numbers
c = a + b # c is 4.14
d = a * b # d is 3.14
e = a / b # e is 3.14
# c, d, and e are also floating point numbers
Hexadecimal:
decimal_num = 59302
# convert the decimal number to hexadecimal
hex_num = hex(decimal_num)
# print the hexadecimal number
print(hex_num) # prints "0xe7a6"
Integers, iterations, and libraries:
import math
def sum_of_squares(n):
# initialize the sum to 0
sum = 0
# iterate over the first n positive integers
for i in range(1, n+1):
# add the square of the current integer to the sum
sum += math.pow(i, 2)
# return the sum
return sum
result = sum_of_squares(5)
print(round(result)) # prints 55
Linear/Sequential Search:
def linear_search(numbers, target):
# iterate over the numbers in the list
for number in numbers:
# if the current number is the target, return True
if number == target:
return True
# if the target was not found, return False
return False
numbers = [1, 2, 3, 4, 5]
target = 3
result = linear_search(numbers, target)
print(result) # prints True
Lossless data compression:
import zlib
# define the string to compress
data = "Hello, world! This is a test of the data compression algorithm."
# compress the string
compressed_data = zlib.compress(data.encode("utf-8"))
# print the compressed data
print(compressed_data) # prints a byte sequence representing the compressed data
decompressed_data = zlib.decompress(compressed_data)
# print the decompressed data
print(decompressed_data.decode("utf-8")) # prints "Hello, world! This is a test of the data compression algorithm."
Metadata:
front matter is a form of metadata. This is what front matter for Fastpages looks like in html
toc: true
layout: post
description: Description here!
image: /images/image.jpg
categories: [tag]
title: Type the title here!
permalink: /example
Pseudocode:
Sequencing:
numbers = [3, 1, 4, 1, 5, 9, 2, 6]
# create an empty list for the sequenced numbers
sequenced_numbers = []
# iterate over the numbers in the list
for number in numbers:
# append the current number to the sequenced numbers list
sequenced_numbers.append(number)
# print the sequenced numbers
print(sequenced_numbers) # prints [3, 1, 4, 1, 5, 9, 2, 6]