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
#!/bin/bash | |
FILES="./*.txt" | |
DEST="/afs/dropbox" | |
SUFIX=".txt" | |
for f in $FILES | |
do | |
echo "${f:2}" | |
TMP=${f:2} |
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 org.apache.spark.graphx._ | |
import org.apache.spark.{SparkConf, SparkContext} | |
object StackOverFlow { | |
def main(args: Array[String]) { | |
val conf = new SparkConf().setAppName("HDTM") | |
.setMaster("local[4]") | |
val sc = new SparkContext(conf) |
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
#!/usr/bin/python3 | |
import csv | |
import os | |
import sys | |
from lxml import etree | |
if len(sys.argv) is not 5: | |
print("Usage simple_parser.py dblp.xml article.csv author.csv citation.csv") | |
exit(1) |
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
#ifndef SOLUTION_UNIQUE_STR_CPP | |
#define SOLUTION_UNIQUE_STR_CPP | |
#include <string> | |
// Github Repository https://github.com/bxshi/interview-code/blob/master/src/CtCI5/1_1_unique_char.cpp | |
size_t _partition(std::string& str, size_t i, size_t j) { | |
size_t low = i; | |
size_t high = j; |
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
#ifndef SOLUTION_REVERSE_CHAR_STRING | |
#define SOLUTION_REVERSE_CHAR_STRING | |
/** | |
* Reverse a \0 terminated char* string. | |
* | |
* Keep two pointers, one at the beginning and the other one | |
* at the end of this char* string. Swap the values that these | |
* two pointers points too, and then move them to the middle by 1. | |
* |
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
/* | |
* CareerCup 150 4/16-4/22 1.1 | |
* | |
* slaink@1point3acres | |
* | |
*/ | |
/* | |
* 首先想到的是排序,如果可以用其他数据结构的话,我倾向于使用一个二叉树,遇到重复节点时候,计算结束。 | |
* 既然不能使用其他数据结构,那么还是使用排序呗。剩下的就是算法复杂度的问题了。 |
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
/* | |
* Reference | |
* [1] http://programminggeeks.com/c-code-for-quick-sort/ | |
* | |
* just add some comments, ALL CODES WAS DONE BY reference[1]. | |
* If that's not cool, just tell me and I'll delete this. | |
*/ | |
#include "stdio.h" | |
int split ( int*, int, int ) ; |
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
/* | |
* CareerCup 150 4/16-4/22 1.2 | |
* | |
* slaink@1point3acres | |
* | |
*/ | |
/* | |
* 反转字符串的话最容易的就是从两端(用i,j)开始swap,最后到i,j重合或者i>j. | |
* 这样会有一个问题就是strlen是怎么算出来的?如果是遍历寻找\0的话,那么这就有了一个n了. |
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
/* | |
* CareerCup 150 4/16-4/22 1.3 | |
* | |
* slaink@1point3acres | |
* | |
*/ | |
/* | |
*感觉上和1.1类似,但是不需用任何其他的buffer,只能一两个变量。这样说来bitmap就肯定不行了。 | |
*再考虑一下qsort的可能性,qsort的确可以nlogn时间找到dup,但是另一个问题是如何删除字符串。 |
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
/* | |
* CareerCup 150 4/16-4/22 1.4 | |
* | |
* slaink@1point3acres | |
* | |
*/ | |
/* | |
* 两个字符串是回文的话,应该是类似abcde edcba 这样子吧? | |
* 如果真的如此,那么直接从字符串a开头开始于字符串b结尾开始比较,如果遇到不相同则输出 |
OlderNewer