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
/* | |
Problem | |
Implement a circular queue of integers of user-specified size using a simple array. | |
Provide routines to initialize(), enqueue() and dequeue() the queue. Make it thread safe. | |
Please implement this with your own code and do not use any class libraries or library calls. | |
*/ | |
#include <malloc.h> |
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 <cstdio> | |
#include <cstring> | |
#include <memory> | |
#include <algorithm> | |
#define N 1000 | |
#define OK 0 | |
#define ERROR 1 | |
struct Node { |
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
/* | |
Given a string of characters, print its permutations in alphbetic order. | |
Sample input: bbjd; | |
Sample output: bbdj, bbjd, bdbj, ..., jbdb, jdbb | |
*/ | |
#include <iostream> | |
#include <string> | |
#include <algorithm> |
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<map> | |
#include<string> | |
#include<iostream> | |
#include<cassert> | |
typedef std::map<int, std::string> Map; | |
int main() { | |
Map m; | |
Map::iterator it; |
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
//============================================================================ | |
// Name : trie.cpp | |
// Author : dagang.wei | |
// Version : | |
// Copyright : | |
// Description : Hello World in C++, Ansi-style | |
//============================================================================ | |
#include <algorithm> | |
#include <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
/* | |
http://oj.leetcode.com/problems/largest-rectangle-in-histogram/ | |
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, | |
find the area of largest rectangle in the histogram. | |
*/ | |
class Solution { | |
private: | |
struct Record { |
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 | |
PROCS=(zygote installd keystore mediaserver netd powerbtnd servicemanager ueventd vold) | |
OUT=/android/data/system/android_pmap.txt | |
rm -f $OUT | |
date >> $OUT | |
echo cat /sys/fs/cgroup/memory/android-start/memory.limit_in_bytes >> $OUT |
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
struct Node { | |
int m_value; | |
int m_row; | |
int m_column; | |
Node() { | |
} | |
Node(int value, int row, int column) { | |
m_value = 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
# Generate image by: dot -Tpng -o probability_tree.png probability_tree.dot | |
digraph probability_tree { | |
s [label=""] | |
male [label="男"] | |
female [label="女"] | |
y1 [label="穿凉鞋"] | |
y2 [label="穿凉鞋"] | |
n1 [label="不穿凉鞋"] | |
n2 [label="不穿凉鞋"] |
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> | |
template<int N, int M> | |
struct Pow { | |
enum { value = N * Pow<N, M-1>::value }; | |
}; | |
template<int N> | |
struct Pow<N, 0> { | |
enum { value = 1 }; |
OlderNewer