Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sarbjit87
sarbjit87 / Linear_Regression.ipynb
Created June 20, 2019 00:32
Linear_Regression.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sarbjit87
sarbjit87 / descriptive_stats.ipynb
Created June 13, 2019 02:04
descriptive_stats.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sarbjit87
sarbjit87 / queues.c
Created March 2, 2019 21:44
Queues implementation in C using Linked List
#include <stdio.h>
#include <stdlib.h>
typedef struct QNode {
int data;
struct QNode *next;
} QueueNode;
typedef struct QueueStruct {
int size;
@sarbjit87
sarbjit87 / binarysearchtreee.c
Last active March 3, 2019 23:40
Binary Search Tree implementation using C
#include<stdio.h>
#include<stdlib.h>
#define MAX(x,y) ((x) > (y) ? (x) : (y))
typedef struct Node {
int data;
struct Node *left;
struct Node *right;
} BSTNode;
@sarbjit87
sarbjit87 / hotdeals.py
Created January 27, 2019 14:36
Scrapy Example - Redflagdeals
import scrapy
class HotDeals(scrapy.Spider):
name = "hotdeals"
def start_requests(self):
urls = [
'https://forums.redflagdeals.com/hot-deals-f9/'
]
for url in urls:
@sarbjit87
sarbjit87 / single_linked_lists_stacks.py
Created August 15, 2018 01:10
Stacks using Single Linked Lists - Python Implementation
# Stack ADT implementation using Lists
# S.push(e) : Add element 'e' to the top of Stack S
# S.pop() : Remove element from the top of Stack S and return the removed element, error if empty
# S.top() : Return the reference of the top element of S without removing it, error if empty
# S.isEmpty() : Return True if stack is empty
# len(S) : Return number of elements in Stack S
class EmptyStackException(Exception):
pass
@sarbjit87
sarbjit87 / deques.py
Created August 5, 2018 21:31
Double Ended Queues
# Deque : Deque or Double-Ended Queue supports insertion or deletion at both front and rear
# Deque ADT :-
# D.add_first(e) : Add an element e to the front of Deque
# D.add_last(e) : Add an element e to the rear of Deque
# D.delete_first() : Remove and return the first element, error if empty
# D.delete_last() : Remove and return the last element, error if empty
# D.first() : Return the reference of the first element, error if empty
# D.last() : Return the reference of the last element, error if empty
# D.isEmpty() : Returns True if Deque is empty
# D.size() : Returns the size of Deque
import unittest
from queues import Queue, FullQueueException, EmptyQueueException
class TestQueues(unittest.TestCase):
def setUp(self):
self.Q = Queue(N=5)
def test_setup(self):
"Test for Empty Queue"
self.assertEqual(self.Q.size(),0)