Comprehensive Guide to Sorting Algorithms and Data Structures

1. Lower Bound on Sorting Algorithm Complexity

Any correct sorting algorithm, regardless of its type (comparison-based or otherwise), has a lower bound on its worst-case complexity of Ω(n).

2. In-Place Sorting Algorithms and Auxiliary Storage

Statement: Sorting algorithms that sort objects “in place” require O(1) auxiliary storage (on top of the space needed to store the values to be sorted).

Assessment: Valid

3. Sorting Algorithms and In-Place Sorting

Question: All of these sorting algorithms sort objects

Read More

Lab 5: Configuring GRUB Boot and Kernel Modules

Overview

This lab covers configuring the GRUB boot loader and inserting/removing modules onto a running kernel. It is recommended to perform these steps in a controlled environment like the 401lab to allow for rebooting in case of errors.

Key Concepts

  • rpm (Red Hat Package Manager): Installs, verifies, and queries packages.
  • Hot-plugging: A feature (especially in SuSE Linux) that allows the system to detect newly added hardware like USB or FireWire devices.
  • lsmod: Lists all loaded modules.
  • diff: Compares
Read More

Learn Go in Y Minutes: A Crash Course in Golang Programming

Learn Go in Y Minutes

Introduction

This is a crash course in the Go programming language. It covers the basics of syntax, data types, control flow, and concurrency.

Getting Started

Go is a statically typed, compiled language with a focus on simplicity and efficiency. It’s known for its built-in concurrency features and fast compilation times.

Package Declaration

Every Go source file starts with a package declaration. The main package is special and declares an executable program.

package main

Import Declaration

Import

Read More

Pipeline Performance and Hazard Detection in Computer Architecture

Given a non-pipelined architecture running at 2.5GHz that takes 5 cycles to finish an instruction. You want to make it pipelined with 5 stages. The increase in hardware forces you to run the machine

at 2GHz. The only stalls are caused by:

  • memory – (30% of the total instructions) a stall of 50 cycles happens in 2% of the memory instructions
  • branch – (20% of the total instructions) a stall of 2 cycles happens in 20% of the branch instructions

What is the speedup? Clearly show all work.

Equation

For the following

Read More

Functional Programming Examples: Recursion, Streams, and More

Bisection Method & Polynomial Root Finding

fun bisection (f,a,b) =
let val mid = (a+b) / 2.0 in
if Math.abs (a-b) < 0.00001 then mid
else
if (f mid) * (f a) < 0.0 then bisection (f,a,mid)
else bisection (f,mid,b)
fun mypoly x = x*x*x -7
val root = bisection (mypoly, 6.0, 0.0, 7.0)

Cube and Sum of Cubes

fun cube a = a*a*a
fun sumCubes (a,b) =
if (a>b) then 0 else cube (a) + sumCubes (a+1,b)

Tree Traversal and Filtering

fun gather (p : int -> bool) (T : string tree)

Read More

Understanding Computer Systems: A Deep Dive into Operating Systems, Memory Management, and Assembly Language

1. For the following questions circle True or False The operating system has the power to suspend your program when it is running. TRUE FALSE The only reason the operating system is “special” is because it is the first program Loaded. TRUE FALSE In a time sharing system multiple process take turns running on the CPU. TRUE FALSE Caches would work well for a program that randomly accesses locations in memory.
TRUE FALSE An an Interrupt Drive I/O system the hardware is responsible for doing all

Read More