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
.data | |
str1: .asciiz "Enter String: " | |
#.align 2 | |
getc: .asciiz "Enter char: " | |
#.align 2 | |
ret: .asciiz "Character <ch> occurs in string <string> <n> times" | |
buffer: .space 100 #space to store our string | |
L1: .space 2 #space for our char | |
L2: .space 4 #space for our char’s frequency in string |
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 string import ascii_lowercase as alphabet | |
d = {"dog","dig", "din", "dag","fog", | |
"god", "fig", "ape", "dot", "got", | |
"bog", "bag","bat","cat" | |
} | |
def transform(w1, w2): | |
frontier = [[w1]] | |
explored = set() |
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 CheckSubTre { | |
TreeNode<Integer> t1, t2; | |
//t2 might be subset of t1 | |
public CheckSubTre(TreeNode<Integer> t1, TreeNode<Integer> t2){ | |
this.t1 = t1;this.t2=t2; | |
} | |
public boolean check(TreeNode<Integer> t1, TreeNode<Integer> t2){ | |
if(t1 == t2){ |
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
//No data structures except an extra stack can be used to sort our original stack. smallest elements on top. | |
import java.util.Arrays; | |
import java.util.Stack; | |
public class SortStack<T extends Comparable> { | |
private Stack<T> main, storage; | |
private T temp; | |
public SortStack(Stack<T> s){ | |
main = s; |
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.HashSet; | |
public class IntersectingNodes { | |
HashSet<NodeCustom> hs = new HashSet<>(); | |
NodeCustom head1; | |
NodeCustom head2; | |
public IntersectingNodes(NodeCustom n1, NodeCustom n2){ | |
this.head1 = n1; | |
this.head2 = n2; |
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> | |
#define B_SIZE 8 | |
using std::cout; | |
using std::cin; | |
using std::endl; | |
bool checkBounds(int currentRow, int currentCol, int horiz, int vert); | |
int move(int currentRow, int currentCol, int * newCoordinates, int step); | |
void recordMove(int row, int col); |
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
<script> | |
$(document).ready( function () { | |
$('#customerTripsTable').DataTable(); | |
$('#customerNotesTable').DataTable(); | |
} ); | |
//reset all children nodes in tree if the parent is clicked | |
document.getElementById("contacttype").onclick = destroyChildren; | |
//listener for contact type dropdown | |
document.getElementById("contacttype").onchange = function() { | |
var selected = document.getElementById("contacttype").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
function reverseInt($n){ | |
return reverseIntAcc(0, $n); | |
} | |
function reverseIntAcc($acc, $n){ | |
if ($n == 0){ | |
return $acc; | |
} | |
$acc *= 10; | |
return reverseIntAcc($acc + ($n % 10) , floor($n / 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 os | |
#File extensions to scrape | |
EXT = '.txt' | |
#filter out files to parse within entire directory | |
files = [ | |
file for file in os.listdir('.') | |
if os.path.isfile(file) | |
and file.endswith('.txt') | |
and file.startswith('no_') |
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
abbvr = { | |
"lol": "laugh out loud", | |
"dw": "don't worry", | |
"hf": "have fun", | |
"gg": "good game", | |
"brb": "be right back", | |
"g2g": "got to go", | |
"wtf": "what the fuck", | |
"wp": "well played", | |
"gl": "good luck", |