This file contains 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 random | |
class Item: | |
next = None | |
data = 0 | |
def __init__(self): | |
self.data = random.random() |
This file contains 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 <stdlib.h> | |
#include <stdio.h> | |
/** | |
Structure for storing an individual node in the list. | |
**/ | |
typedef struct Node | |
{ | |
int data; | |
struct Node* next; |
This file contains 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.lang.Runnable; | |
import java.lang.Thread; | |
/** | |
* The Main Class. | |
**/ | |
public class Collision { | |
/** | |
* Main entry point into the application. |
This file contains 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.Iterator; | |
public class LinkedList<T>{ | |
private Node head; | |
private int length; | |
public LinkedList(){ | |
this.length = 0; |
This file contains 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 <iostream> | |
#include <cstdlib> | |
class Node | |
{ | |
public: | |
Node* next; | |
int data; | |
}; |
This file contains 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 main{ | |
public static void main(String[] args) { | |
//WORKS | |
SingletonDemo s = SingletonDemo.getInstance(); | |
s.setValue(12); | |
//FAILS | |
SingletonDemo ss = SingletonDemo.getInstance(); | |
System.out.println(ss.getValue()); | |
} | |
} |
This file contains 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 <iostream> | |
using namespace std; | |
class Singleton | |
{ | |
public: | |
static Singleton* getSingleton(); | |
int getValue(); | |
void setValue(int i); |
This file contains 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 <stdlib.h> | |
struct SLNode { | |
struct SLNode *next; | |
long value; | |
}; | |
void sl_push_front(struct SLNode **list, long v){ | |
//Create new node, add the value. |
This file contains 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 Queue | |
import threading | |
import tinderClient | |
import json | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
PRODUCER_THREADS = 5 | |
CONSUMER_THREADS = 10 |
This file contains 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 Queue | |
import threading | |
import tinderClient | |
import json | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
PRODUCER_THREADS = 3 | |
CONSUMER_THREADS = 10 |
OlderNewer