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 Tree<K, V> | |
where K : class, IComparable<K> | |
where V : class | |
{ | |
private Node<K, V> root; | |
public V BFS(K key) | |
{ | |
Queue<Node<K, V>> queue = new Queue<Node<K, V>>(); | |
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
/** | |
* The <code>StreamTokenizer</code> class takes an input stream and | |
* parses it into "tokens", allowing the tokens to be | |
* Read one at a time. The parsing process is controlled by a table | |
* and a number of flags that can be set to various states. The | |
* stream tokenizer can recognize identifiers, numbers, quoted | |
* strings, and various comment styles. | |
* <p> | |
* Each byte Read from the input stream is regarded as a character | |
* in the range <code>'\u0000'</code> through <code>'\u00FF'</code>. |
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
// Copyright (c) 2012-2013, Riyad Parvez | |
// All rights reserved. | |
// | |
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | |
// | |
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | |
// | |
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | |
// | |
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. |
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 static bool FloydCycleDetection<T>(LinkedList<T> list) | |
{ | |
var tortoise = list.First; | |
var hare = list.First; | |
while (tortoise != null && hare != null) | |
{ | |
if(tortoise == hare) | |
{ | |
return true; |
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
FROM python:3 as build-system | |
RUN pip install -U pip | |
COPY requirements.txt requirements.txt | |
### create temporary image used to download and vendor packages using private key ### | |
FROM build-system as intermediate | |
# add credentials on build |
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
/// <summary> | |
/// Utilties for reflection | |
/// </summary> | |
public static class ReflectionUtils | |
{ | |
/// <summary> | |
/// Get all the fields of a class | |
/// </summary> | |
/// <param name="type">Type object of that class</param> | |
/// <returns></returns> |
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
# Thanking everyone who wished me on my birthday | |
import requests | |
import json | |
from time import strftime | |
AFTER = #convert your time to iso 8601 time | |
TOKEN = ' <insert token here> ' | |
def get_posts(): |
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 static class CSV | |
{ | |
public static string ToCSV(this DataTable table) | |
{ | |
var columnHeaders = (from DataColumn x in table.Columns | |
select x.ColumnName).ToArray(); | |
StringBuilder builder = new StringBuilder(String.Join(",", columnHeaders)); | |
builder.Append("\n"); | |
foreach (DataRow row in table.Rows) |
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 Tree<K, V> | |
where K : class, IComparable<K> | |
where V : class | |
{ | |
private Node<K, V> root; | |
public V DFS(K key) | |
{ | |
Stack<Node<K, V>> stack = new Stack<Node<K, V>>(); | |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Queue | |
{ | |
class FixedSizeQueue<T> |
NewerOlder