This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
class HM<K, V> { | |
private static class HashNode<K, V> { | |
private K key; | |
private V value; | |
private HashNode<K, V> next; | |
HashNode(K key, V value) { | |
this.key = key; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedList; | |
import java.util.Queue; | |
class GraphBFS { | |
private int vertices; | |
private LinkedList<Integer> adjacency[]; | |
GraphBFS(int v) { | |
vertices = v; | |
adjacency = new LinkedList[v]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.LinkedList; | |
import java.util.Stack; | |
class GraphDFS { | |
private int vertices; | |
private LinkedList<Integer> adjacency[]; | |
GraphDFS(int v) { | |
vertices = v; | |
adjacency = new LinkedList[v]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Queue<T> { | |
private static class Node<D> { | |
private D data; | |
private Node<D> previous; | |
private Node<D> next; | |
private Node(D data) { | |
this.data = data; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int num1; | |
int num2; | |
printf("Feed me two numbers and I will store them in a single variable: "); | |
if (scanf("%d %d", &num1, &num2) != 2) { | |
printf("Enter two numbers\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Stack<E> { | |
private class Node<V> { | |
private V data; | |
private Node<V> next; | |
Node(V data) { | |
this.data = data; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"flag" | |
"fmt" | |
) | |
// Time: O(2^n) | |
// Space: O(n) | |
func FibRecursive(n uint64) uint64 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char **argv) { | |
char buff[15]; | |
int auth = 0; | |
printf("\nEnter password: "); | |
gets(buff); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func Swap(a, b int) int { | |
a = a ^ b | |
b = b ^ a | |
a = a ^ b | |
return a | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
namespace BinarySearchTree | |
{ | |
class Node | |
{ | |
public int value; | |
public Node left; | |
public Node right; |