Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CSE310 Final Review: Algorithms and Data Structures, Cheat Sheet of Computer Science

Data structures and algorithms

Typology: Cheat Sheet

2022/2023

Uploaded on 10/26/2023

brian-72
brian-72 🇺🇸

1 document

1 / 32

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE310 Final Review
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download CSE310 Final Review: Algorithms and Data Structures and more Cheat Sheet Computer Science in PDF only on Docsity!

CSE310 Final Review

Materials covered

  • Anything from Test 1, 2, and
  • Quiz 5-
  • Recitation 5-
  • Assignment 4-

Asymptotic

Notation

General rule:

● Constant

● Logarithms

○ log(log(n)), log(n), log2(n)

● Linears

● Polynomials

○ n^2, n^

● Exponential

○ (3/2)^n, 2^n, n2^n

● Factorials

○ (log(n))!, n!

Divide and Conquer

Merge Sort: T(n) = 2T(n/2) + Ө(n) T(n/2) for left T(n/2) for right Ө(n) for merge Recursion Tree gets you 2k(c(n/2k) + b) *On next slide

Priority Queue

Heaps

Counting Sort

Running time = Ө(n)

Stable and unstable sorting algorithms:

5

Median and Order Statistic

Order Statistic ith order statistic is the ith smallest element in A[1…n]

Hash Tables

Hash by division: h(k) = k mod m (k is key, m is table size) Hash by multiplication: h(k) = floor(m = (k * A mod 1)) Open Addressing - all elements stored inside hash table stored directly (no linked list)

Linear probe (m probe sequences)

  • h’(k) = ordinary hash function
  • h(k, i) = (h’(k) + i) mod m Quadratic probe (m probe sequence)
  • h(k, i) = (h’(k) + c1i + c2i2) mod m Double hashing (m2 probe sequence)
  • h1(k) and h2(k)
  • h(k, i) = (h1(k) + i*h2(k)) mod m

Binary Search Trees

RBT Insertion

RBT Deletion