Algorithm

The study of encoding and decoding signals to ensure their security. Coding is done using a key that should ideally only be known by the message's sender and intended receiver.

An algorithm is essentially just a conceptually generalized solution to a problem that may be later used in the actual world, such as a computer program. Interface for Application Programs An API is a collection of procedures, protocols, and instruments used to create software applications. The interaction between software components is defined by an API. The programming of graphical user interface (GUI) components also uses APIs.

def get_even_numbers(numbers: List[int]) -> List[int]:
    even_numbers = []
    
    for number in numbers:
        if number % 2 == 0:
            even_numbers.append(number)
    
    return even_numbers

Binary

The study of encoding and decoding signals to ensure their security. Coding is done using a key that should ideally only be known by the message's sender and intended receiver.

One of the lowest levels of abstraction employs a base-2 numeric system that only uses combinations of the digits zero and one. Because they only use zeros and ones for data storage and computation, computers only work in binary. In boolean logic, a single binary digit can stand in for True (1) or False (0), but many binary digits can be combined to store enormous amounts of data and carry out intricate operations. Computers convert between binary and the real data you need, such numbers and

def decimal_to_binary(n: int) -> str:
    binary_digits = []
    
    while n > 0:
        binary_digits.append(n % 2)
        n = n // 2
    
    return "".join(str(d) for d in binary_digits[::-1])

Binary Search

The study of encoding and decoding signals to ensure their security. Coding is done using a key that should ideally only be known by the message's sender and intended receiver.

Only applicable when the list is sorted, this search technique finds the location of a target value within a sorted array by continually halving the search interval. The amount of effort needed to discover an object rises considerably more slowly with Binary Search than with Sequential Search due to its divide-and-conquer strategy. With this logarithmic tendency, in reality.

def binary_search(arr: List[int], target: int) -> int:
    low = 0
    high = len(arr) - 1

    while low <= high:
        mid = (low + high) // 2
        
        if target < arr[mid]:
            high = mid - 1  # Narrow the search range to the lower half
        elif target > arr[mid]:
            low = mid + 1  # Narrow the search range to the upper half
        else:
            return mid  # Return the index of the target element
        return -1

Boolean Function

of libraries

the study of encoding and decoding signals to ensure their security. Coding is done using a key that should ideally only be known by the message's sender and intended receiver.

any function that is based on AND, OR, and NOT and whose constituent parts fall under the purview of boolean algebra. a function that takes values from a two-element set (often 0 and 1) for both its inputs and the function itself. Processing Unit Central The computer's brain, also known as the processor, is where the majority of computations are performed. Contains the hardware required to understand and carry out software instructions.

def bool_func(x: bool, y: bool) -> bool:
    if x and not y:
        return True
    else:
        return False

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 study of encoding and decoding signals to ensure their security. Coding is done using a key that should ideally only be known by the message's sender and intended receiver.

Numbers in Floating Points Numbers with floating decimal points are known as floating point numbers, as the name suggests. The figures 5.5, 0.001, and -2,345.6789 are some examples. Integers are numbers that have no decimal places. Real numbers with embedded fractions are recognized as floating point numbers by computers.

print('Plaintext:  THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG')
print('Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD')
Plaintext:  THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Ciphertext: QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD

Hexadecimal

Integers can be positive, negative, or zero and are full numbers, not fractions. A datum of integral data type, or data type that represents a limited subset of the mathematical integers, is what is known as an integer in computer science. Different widths and the ability to include negative values are both options for integral data types.

print('FF6699')
FF6699

Integers

An integer is a whole number that can be positive, negative, or zero and is not a fraction. A data type that represents a limited subset of the mathematical numbers is known as an integer in computer science. Different widths and the presence of negative values are also possible for integral data types.

x = 10
print(x)  # prints 10
print(type(x))  # prints <class 'int'>

# Perform arithmetic operations with integers
y = x + 5
print(y)  # prints 15
z = x * y
print(z)  # prints 150
10
<class 'int'>
15
150

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.

numbers = [1, 2, 3, 4, 5]
for number in numbers:
    print(number)

words = ["apple", "banana", "cherry"]
for word in words:
    print(word)
1
2
3
4
5
apple
banana
cherry

Libraries

A library in computer science is a collection of non-volatile data that a program may often access to create new software. Due to the fact that you do not have to manually link routines to every application that utilizes them, libraries are particularly helpful for storing frequently used functions. When the linker cannot find a procedure elsewhere, it automatically searches libraries for it. Data, documentation, message templates, pre-written code, classes, and values are examples of resources that may be found in libraries.

import math
x = math.sqrt(9)
print(x)  # prints 3.0

y = math.sin(math.pi / 2)
print(y)  # prints 1.0

import random

data = [1, 2, 3, 4, 5]
random.choice(data)
3.0
1.0
4

Linear/Sequential Search

A method that progressively examines each element in the list until the target element is discovered or every element has been examined. can be applied to any list type. performs linearly.

def linear_search(data, target):
    for i in range(len(data)):
        if data[i] == target:
            return i
    return -1

# Test the search function
data = [1, 2, 3, 4, 5]
target = 3

index = linear_search(data, target)

if index == -1:
    print(f"{target} not found in data")
else:
    print(f"{target} found at index {index}")
3 found at index 2

Lossless Data Compression

When a file is compressed without any loss of quality, all of the original data is still present when the file is decompress. The information has been fully recovered. This method is typically used for text or spreadsheet files where the loss of words or financial information might be problematic. A format for images that offers lossless compression is PNG.

compressed_data = zlib.compress(data)
decompressed_data = zlib.decompress(compressed_data)
assert data == decompressed_data

Lossy compression

Reduces a file by permanently removing certain data, particularly superfluous data. Upon file uncompression, just a portion of the original data remains (although the user may not notice it). Lossy compression is typically employed for video and sound since most users won't notice a certain degree of information loss. The lossy compression offered by JPEG.

from PIL import Image
image = Image.open("image.jpg")
image_data = image.getdata()
quality = 50
compressed_image = Image.new("RGB", image.size)
compressed_image.putdata(image_data)
compressed_image.save("image_compressed.jpg", "JPEG", quality=quality)

Metadata

Information about other information. Basic information about data is summarized in metadata, which can facilitate identifying and interacting with specific instances of data. It offers details on an item's content, such as the size and resolution of the images.

# title, toc, etc.

Pseudocode

A thorough yet understandable specification of what an algorithm or computer program must accomplish. It might also be used to define a working principle. Instead of being represented in a programming language made for humans, it is done so in a professionally stylized natural language. Normal programming practices continue.

maxValue = 0
FOR each number in list:
  IF number > maxValue:
    maxValue = number
OUTPUT maxValue

Sequencing

The process of carrying out each step/action in a particular algorithm in the exact sequence that is specified...

numbers = [100, 300, 500, 700, 900]
sequenced_numbers = []
for number in numbers:
  sequenced_numbers.append(number)

print(sequenced_numbers)  
[100, 300, 500, 700, 900]