Wednesday, January 10th, 2024

Through pride we are ever deceiving ourselves. But deep down below the surface of the average conscience a still, small voice says to us, something is out of tune.

— Carl Jung

  • PostgreSQL database object (e.g. unique constraint) naming convention: StackOverflow
  • PortSwigger Web Security Academy
    • I should probably continue doing this (thanks Lance for reminding me in Discord announcement XD). Seems like the site got an overhaul.
    • I’m more interested in API testing, so that’s where I’ll start.

MUS106 Discussion 1: Intro & BeepBox Project

  • song listening session
    • ”Ward Riders”
      • distorted, powerful
      • very active bass drum
      • energetic
    • ”Make it Right”
      • began with syncopated rhythm section (drums)
      • synthesized sounds
      • 6/8
      • chorus, harmonized vocals in bridge section
      • use of sampled vocals
    • similarities
      • percussion (drums)
      • groove-oriented
  • contrast 2 songs
  • BeepBox project
    • 2 phrases minimum per track, 4 vertical phrases total

ECS165A Lecture 2: Intro to DBMS

  • typical DBMS functionalities
    • maintenance
    • access control
    • transaction
    • concurrent access
    • versioning
    • persistence & recovery
    • logging
    • indexing & query optimization
  • Why DBMS?
    • DBMS helps provide an abstraction layer between application and data—modifying / improving the database software should not affect the application code, i.e. DBMS enables lower coupling.
    • Reduces application development time: no need to worry about data access.
    • Data integrity & security guarantees (e.g. via limiting privileges)
    • Universal interface for data adminstration across all databases & applications
    • Concurrent access with crash recovery: DBMS uses in-memory pages/cache to prevent having to write the disk every time. This protects the database file from being corrupted during concurrent access.
  • There’s a need for specialized database software, e.g. videos, Human Genome project, etc.
  • making a database

ECS122A Lecture 2: Recurrence via Substitution

Basic Terminology

Recurrences

ECS122A quiz 1 study guide

Caution: Answers might be wildly wrong XD

Q1

Prove that

Use the definition of big-Theta notation. Find that makes and that makes .

Guess a constant , we need to find such that this relationship is true for .

For , left-hand side is , whereas the right-hand side is , so the inequality holds from now on. Technically induction is needed, but I’m too lazy for this.

For the other constant:

Guess a constant , we need to find such that the relationship is true for .

For , left-hand side is , and the right-hand side is , so the inequality holds for .

Q2

Prove via limit lemma

Assuming the is the natural log for simplicity.

Since and , .

Q3 i)

Prove via limit lemma that

Assuming is the natural log.

Since , via the limit lemma.

Q3 ii)

Can you prove for some ? Explain why or why not.

Yes, this works for . For instance, given , we have:

Since , we know via limit lemma.

is sublinear time, so we know that this works for all .

Q4 i-iii

Provide sample code for i-iii i) ii) iii)

Skipped.

Q4 iv

Write a recurrence for the code below:

foo(int n)
    foo(n/2)
    for(i=1 to n^2)
        print hello

Each problem has one subproblem foo(n/2) and has some work with time complexity . We can write the recurrence as .

Q5

i) Write pseudocode that lists the subsets of an array of ints. ii) Write psuedocode finds the smallest number of an array of ints. iii) Write psudedocode the list all possible substring of a string S. iv) Given you have two sort lists write pseudocode that returns a new merged sorted

Since we’re working on divide and conquer, I used recursion as much as possible. The code is quite literally crap.

i)

def subsets(arr):
    result = set()
    result.add(set())
    result.add(set(arr))
    for idx from 0 to arr.length:
        result.append(subset(arr.remove(idx)))
    return result

ii)

def min_elem(arr):
    known_min = int.max
    for idx from 0 to arr.length:
        if arr[idx] < known_min:
            known_min = arr[idx]
    return known_min

iii)

def substrs(str):
    result = set()
    result.append(str)
    if str.length > 1:
        result.extend(substrs(str.remove(0)))
        result.extend(substrs(str.remove(str.length-1)))
    return result

iv)

def merge(left, right):
    i = 0
    j = 0
    result = []
    while i < left.length and j < right.length:
        if i == left.length:
            result.append(right[i])
        else j == right.length:
            result.append(left[i])
        else if left[i] < right[i]:
            result.append(left[i])
            i += 1
        else:
            result.append(right[i])
            i += 1
    return result