Skip to content

Commit

Permalink
added pictures and runtime analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
kdn251 committed Mar 1, 2017
1 parent a28e137 commit ebd2bb8
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 3 deletions.
Binary file modified Images/BST.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/bellman-ford.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/bigO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/bigOmega.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/bucketsort.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/dfsbfs.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/dijkstra.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/hash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/heap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/mergesort.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/quicksort.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/theta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 52 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ Interviews
- [Online Judges](#online-judges)
- [Directory Tree](#directory-tree)
- [Live Coding Practice](#live-coding-practice)
- [Computer Science News](#computer-science-news)
- [Data Structures](#data-structures)
- [Algorithms](#algorithms)
- [Runtime Analysis](#runtime-analysis)
- [Computer Science News](#computer-science-news)

## Online Judges
* [LeetCode](https://leetcode.com/)
Expand Down Expand Up @@ -85,6 +86,8 @@ A heap can be classified further as either a "max heap" or a "min heap". In a ma
than or equal to those of the children and the highest key is in the root node. In a min heap, the keys of parent nodes are less than
or equal to those of the children and the lowest key is in the root node

![Alt text](/Images/heap.png?raw=true "Max Heap")

### Hashing
* *Hashing* is used to map data of an arbitrary size to data of a fixed size. The values return by a hash
function are called hash values, hash codes, or simply hashes. If two keys map to the same value, a collision occurs
Expand All @@ -97,6 +100,9 @@ or equal to those of the children and the lowest key is in the root node
hashed-to-slot and proceeding in some sequence, until an unoccupied slot is found. The name open addressing refers to
the fact that the location of an item is not always determined by its hash value


![Alt text](/Images/hash.png?raw=true "Hashing")

### Graph
* A *Graph* is an ordered pair of G = (V, E) comprising a set V of vertices or nodes together with a set E of edges or arcs,
which are 2-element subsets of V (i.e. an edge is associated with two vertices, and that association takes the form of the
Expand All @@ -106,15 +112,21 @@ or equal to those of the children and the lowest key is in the root node
* **Directed Graph**: a graph in which the adjacency relation is not symmetric. So if there exists an edge from node u to node v
(u -> v), this does *not* imply that there exists an edge from node v to node u (v -> u)

![Alt text](/Images/graph.png?raw=true "Graph")

## Algorithms

### Sorting

#### Quicksort
* Stable: `No`
* Time Complexity:
* Best Case: `O(nlog(n))`
* Worst Case: `O(n^2)`
* Average Case: `O(nlog(n))`

![Alt text](/Images/quicksort.gif?raw=true "Quicksort")

#### Mergesort
* *Mergesort* is also a divide and conquer algorithm. It continuously divides an array into two halves, recurses on both the
left subarray and right subarray and then merges the two sorted halves
Expand All @@ -124,14 +136,18 @@ or equal to those of the children and the lowest key is in the root node
* Worst Case: `O(nlog(n))`
* Average Case: `O(nlog(n))`

![Alt text](/Images/mergesort.gif?raw=true "Mergesort")

#### Bucket Sort
* *Bucket Sort* is a sorting algorithm that works by distributing the elements of an array into a number of buckets. Each bucket
is then sorted individually, either using a different sorting algorithm, or by recursively applying the bucket sorting algorithm
* Time Complexity:
* Best Case: `Ω(n + k)`
* Worst Case: `O(n<sup>2</sup>)`
* Worst Case: `O(n^2)`
* Average Case:`Θ(n + k)`

![Alt text](/Images/bucketsort.png?raw=true "Bucket Sort")

#### Radix Sort
* *Radix Sort* is a sorting algorithm that like bucket sort, distributes elements of an array into a number of buckets. However, radix
sort differs from bucket sort by 're-bucketing' the array after the initial pass as opposed to sorting each bucket and merging
Expand All @@ -146,11 +162,15 @@ or equal to those of the children and the lowest key is in the root node
* *Depth First Search* is a graph traversal algorithm which explores as far as possible along each branch before backtracking
* Time Complexity: `O(|V| + |E|)`

![Alt text](/Images/dfsbfs.gif?raw=true "DFS / BFS Traversal")

#### Breadth First Search
* *Breadth First Search* is a graph traversal algorithm which explores the neighbor nodes first, before moving to the next
level neighbors
* Time Complexity: `O(|V| + |E|)`

![Alt text](/Images/dfsbfs.gif?raw=true "DFS / BFS Traversal")

#### Topological Sort
* *Topological Sort* is the linear ordering of a directed graph's nodes such that for every edge from node u to node v, u
comes before v in the ordering
Expand All @@ -160,6 +180,8 @@ or equal to those of the children and the lowest key is in the root node
* *Dijkstra's Algorithm* is an algorithm for finding the shortest path between nodes in a graph
* Time Complexity: `O(|V|^2)`

![Alt text](/Images/dijkstra.gif?raw=true "Dijkstra's")

#### Bellman-Ford Algorithm
* *Bellman-Ford Algorithm* is an algorithm that computes the shortest paths from a single source node to all other nodes in a weighted graph
* Although it is slower than Dijstra's, it is more versatile, as it is capable of handling graphs in which some of the edge weights are
Expand All @@ -168,6 +190,8 @@ or equal to those of the children and the lowest key is in the root node
* Best Case: `O(|E|)`
* Worst Case: `O(|V||E|)`

![Alt text](/Images/bellman-ford.gif?raw=true "Bellman-Ford")

#### Floyd-Warshall Algorithm
* *Floyd-Warshall Algorithm* is an algorithm for finding the shortest paths in a weighted graph with positive or negative edge weights, but
no negative cycles
Expand All @@ -176,7 +200,32 @@ or equal to those of the children and the lowest key is in the root node
* Best Case: `O(|V|^3)`
* Worst Case: `O(|V|^3)`
* Average Case: `O(|V|^3)`


## Runtime Analysis

#### Big O Notation
* *Big O Notation* is used to describe the upper bound of a particular algorithm. Big O is used to describe worst case scenarios

![Alt text](/Images/bigO.png?raw=true "Theta Notation")

#### Little O Notation
* *Little O Notation* is also used to describe an upper bound of a particular algorithm; however, Little O provides a bound
that is not asymptotically tight

#### Big Ω Omega Notation
* *Big Omega Notation* is used to provide an asymptotic lower bound on a particular algorithm

![Alt text](/Images/bigOmega.png?raw=true "Theta Notation")

#### Little ω Omega Notation
* *Little Omega Notation* is used to provide a lower bound on a particular algorithm that is not asymptotically tight

#### Theta Θ Notation
* *Theta Notation* is used to provide a bound on a particular algorithm such that it can be "sandwiched" between
two constants (one for an upper limit and one for a lower limit) for sufficiently large values

![Alt text](/Images/theta.png?raw=true "Theta Notation")

## Computer Science News
* [Hacker News](https://news.ycombinator.com/)

Expand Down

0 comments on commit ebd2bb8

Please sign in to comment.