Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
RodneyShag committed May 1, 2017
1 parent 9b6ef0f commit 7145449
Show file tree
Hide file tree
Showing 57 changed files with 287 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,15 @@ public Pair(int i, double v) {

/* This lets us sort Pairs based on their value field */
class PairValueComparator implements Comparator<Pair> {
double epsilon = 0.0001; // shouldn't use " == " to compare "doubles"
@Override
public int compare(Pair p1, Pair p2) {
return Double.compare(p1.value, p2.value);
if (Math.abs(p1.value - p2.value) < epsilon) {
return 0;
} else if (p1.value < p2.value) {
return -1;
} else {
return 1;
}
}
}
122 changes: 40 additions & 82 deletions Algorithms/README.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cracking the Coding Interview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

| Topic | Challenge | Points | Solution |
|:---------------------:|:--------------------------------------------------------------------------------------------------------:|:------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Techniques / Concepts | [Time Complexity: Primality](https://www.hackerrank.com/challenges/ctci-big-o) | 15 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Time%20Complexity%20-%20Primality/Solution.java) |
| Techniques / Concepts | [Recursion: Fibonacci Numbers](https://www.hackerrank.com/challenges/ctci-fibonacci-numbers) | 20 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Recursion%20-%20Fibonacci%20Numbers/Solution.java) |
| Techniques / Concepts | [Recursion: Davis' Staircase](https://www.hackerrank.com/challenges/ctci-recursive-staircase) | 30 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Recursion%20-%20Davis'%20Staircase/Solution.java) |
| Techniques / Concepts | [DP: Coin Change](https://www.hackerrank.com/challenges/ctci-coin-change) | 30 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/DP%20-%20Coin%20Change/Solution.java) |
| Techniques / Concepts | [Bit Manipulation: Lonely Integer](https://www.hackerrank.com/challenges/ctci-lonely-integer) | 60 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Bit%20Manipulation%20-%20Lonely%20Integer/Solution.java) |
| Data Structures | [Arrays: Left Rotation](https://www.hackerrank.com/challenges/ctci-array-left-rotation) | 20 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Data%20Structures/Arrays%20-%20Left%20Rotation/Solution.java) |
| Data Structures | [Strings: Making Anagrams](https://www.hackerrank.com/challenges/ctci-making-anagrams) | 25 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Data%20Structures/Strings%20-%20Making%20Anagrams/Solution.java) |
| Data Structures | [Hash Tables: Ransom Note](https://www.hackerrank.com/challenges/ctci-ransom-note) | 25 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Data%20Structures/Hash%20Tables%20-%20Ransom%20Note/Solution.java) |
Expand All @@ -17,8 +22,3 @@
| Algorithms | [Binary Search: Ice Cream Parlor](https://www.hackerrank.com/challenges/ctci-ice-cream-parlor) | 45 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Algorithms/Binary%20Search%20-%20Ice%20Cream%20Parlor/Solution.java) |
| Algorithms | [DFS: Connected Cell in a Grid](https://www.hackerrank.com/challenges/ctci-connected-cell-in-a-grid) | 45 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Algorithms/DFS%20-%20Connected%20Cell%20in%20a%20Grid/Solution.java) |
| Algorithms | [BFS: Shortest Reach in a Graph](https://www.hackerrank.com/challenges/ctci-bfs-shortest-reach) | 45 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Algorithms/BFS%20-%20Shortest%20Reach%20in%20a%20Graph/Solution.java) |
| Techniques / Concepts | [Time Complexity: Primality](https://www.hackerrank.com/challenges/ctci-big-o) | 15 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Time%20Complexity%20-%20Primality/Solution.java) |
| Techniques / Concepts | [Recrusion: Fibonacci Numbers](https://www.hackerrank.com/challenges/ctci-fibonacci-numbers) | 20 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Recursion%20-%20Fibonacci%20Numbers/Solution.java) |
| Techniques / Concepts | [Recursion: Davis' Staircase](https://www.hackerrank.com/challenges/ctci-recursive-staircase) | 30 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Recursion%20-%20Davis'%20Staircase/Solution.java) |
| Techniques / Concepts | [DP: Coin Change](https://www.hackerrank.com/challenges/ctci-coin-change) | 30 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/DP%20-%20Coin%20Change/Solution.java) |
| Techniques / Concepts | [Bit Manipulation: Lonely Integer](https://www.hackerrank.com/challenges/ctci-lonely-integer) | 60 | [Solution.java](https://github.com/rshaghoulian/HackerRank-solutions/blob/master/Cracking%20the%20Coding%20Interview/Techniques%2C%20Concepts/Bit%20Manipulation%20-%20Lonely%20Integer/Solution.java) |
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ class Node {
// of the list, have it jump to the beginning of the other list. Create
// 2 of these pointers, pointing to 2 different list heads. The pointers
// will collide at the merge point after 1 or 2 passes.
//
// Runtime: O(n)

// Time Complexity: O(n + m)
// Space Complexity: O(1)

int FindMergeNode(Node headA, Node headB) {
Node currA = headA;
Node currB = headB;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
// HackerRank: hackerrank.com/rshaghoulian

/*
Merge two linked lists
Node is defined as
class Node {
int data;
Node next;
}
*/

// Time Complexity: O(n)
// Time Complexity: O(n + m)
// Space Complexity: O(1)

Node MergeLists(Node currA, Node currB) {
if (currA == null) {
return currB;
Expand Down
Loading

0 comments on commit 7145449

Please sign in to comment.