GithubHelp home page GithubHelp logo

mtsac-algorithm's Introduction

mtsac-algorithm

These are the coding activities that I was doing during the Assembly Language classes. All information about class info has been masked, please get in touch with the repo owner for more information. The following text is the quick notes done during the class.

02222022

Searching
    hash map
    skip list: logn

map ADT - Entry <k, v>
    Array/Vector
        Sorted
            find O(logn)
            insert: O(n)
            remove: O(n)
        Unsorted
            find O(n)
            insert: O(1)
            remove: O(n)
    Linked list
        Sorted
            find: O(n)
            insert: O(n)
            remove: O(n)
    BST(Simple): O(n)
    balanced BST: O(logn) -> O(1)
        AVL
        RB
        
Hashing
    find <k, v> -> Use k to determine the address
    hash function - h(k) = x
    hash table
        [0][1][2][][][][][][][][]...[N - 1]
        
    key - 0 to 999				0 to 9999
    table size(N) = 1000		size(N) = 1000
    k % 1000					k % 1000 -> collision
    Seperate chaining
    Open addressing
        linear problems
        
need good load factors
    n / N, 8 / 13
    good hash function
    
S.C. good result up to lf 0.75
L.P. up to 0.25
P.H. up to 0.5

expected performance
open addressing
    1 / (1 - alpha) ~ 2
    
C++ map
    ordered map - class map (balance BST logn)
    unordered map - class unorderedmap (hashing, expected average O(1))

03012022

unordered vs ordered maps<k, v>
    HashTable
        average O(1)
        cannot obtain a sorted list
    Balanced BST O(logn)
    Sorted List
        Obtain a sorted list
    set<k>
    like an ordered map w/o value
        C++ STL set
    
Skip list
    - a list of sorted linked list
    
Dictionary ADT
    - Same as Map ADT
    - add findAll(k)
    - hash map impl.
        - seperate chaining
            insert/put
            always insert new entry
            findAll(k)
            O(1 + s)
        - open addressing (x)
    - Balance BST
        insert same O(logn)
        findAll(k) O(logn + s)
    - Sorted array/vector
        insert O(n)
        findAll(k) O(logn + s)

03172022

Some descriple sorting properties
    - In-place - no extra memory
        - merge sort (F)
        - insertion sort (T)
        - quick sort (depend)
    - Predictable performance
        - merge sort O(nlogn)
        - selection sort O(n^2)
    - Stable
        - shell sort (F)
        - insertion sort (can be)
        - merge sort (T)
        - quick sort (depend)

03082022

Divide-and-conquer Strategy
    Divide into 2 sections
    Recursion - solve each section the same way
    COunquer - combine the 2 sections into one section

03222022

quickSelect(S, k)
    if |S| is 1
        return first element of S'
    pick a pivot - random pivot or middle value (median of 3)
    partition S into L, E, G
    if k <= |L|
        quickSelect(L, k)
    else if k <= |L| + |E|
        return an element in E
    else
        quickSelect(G, k - (|L|+|E|))

04052022

- clistinct sets
    makeSet(e) - a new set w/ one element
    union(a, b) - combine into a new set, destroy old set
    find(p) - position of one element, return which set

04192022

Components of a DP Solution
    - Simple subproblems
        - Break global optimization problem into subproblems
        - Define subproblems using indices like A_(i,j), L_(i,j)
    - Subproblem optimization
        - Optimal solution to the problem must be a composition of optimal subproblems solutions (same as greedy method)
    - Subproblem overlap
        - Revisit the same subproblems already solved and stored in a table
A recursice approach
    - Almost like divide-and-conquer
    - Define subproblems
    - Subproblem optimaity

05102022

- Diagraphs
    Incoming != Outgoing
    Directed cyclic graph - diagraph w/ no cycle
- Transitive Closure
    Floyd-Warshall Transitive Closure

05172022

- Minimum Spanning Trees (MST) 
    a.k.a. MCSP, C - cost

mtsac-algorithm's People

Contributors

0x4e65726f avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.