Skip to content

Instantly share code, notes, and snippets.

View guiyang882's full-sized avatar
💭
I may be slow to respond.

GuiYang guiyang882

💭
I may be slow to respond.
View GitHub Profile
@guiyang882
guiyang882 / Computer Science Students.md
Last active June 25, 2020 05:10
主要描述下计算机领域对于职业技能的准备点,希望大家多多补充!

该如何学习?

  • 建议给自己制定一个计划,计划应该细致一些,细致到这一周的目标最好,太细不好,因为工程师会被新技术,新方向给吸引,因此给自己留足溜号的时间
  • 不要排斥新东西,新技术
  • 思考问题要有深度(这一点自己做的不好)

该学什么?

这里按照自己熟悉和了解的领域进行编写,大家轻轻拍砖😄

操作系统

  • 除了学习先修课程,其中推荐一些课程
@guiyang882
guiyang882 / # opencv3 - 2017-01-12_19-59-03.txt
Created January 17, 2017 07:10
opencv3 (homebrew/science/opencv3) on macOS 10.12.2 - Homebrew build logs
Homebrew build logs for homebrew/science/opencv3 on macOS 10.12.2
Build date: 2017-01-12 19:59:03
  • install python3
brew install python3 
brew install homebrew/dupes/tcl-tk
brew uninstall python3
# brew install python3 --with-brewed-tk
brew install python3 --with-tcl-tk
brew linkapps python3

brew uninstall freetype
@guiyang882
guiyang882 / shutil_get_terminal_size.md
Created December 20, 2016 11:08
主要是解决pip 安装ipython 后启动不起来,发生了shutil_get_terminal_size ?
/usr/lib/python2.7/site-packages/IPython/utils/terminal.py

from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
from shutil_backports import get_terminal_size as _get_terminal_size
@guiyang882
guiyang882 / socket-python.md
Last active December 8, 2016 11:18
socket-python.md
  • server
#coding=utf-8

#创建SocketServerTCP服务器:
import SocketServer
from SocketServer import StreamRequestHandler as SRH
from time import ctime
@guiyang882
guiyang882 / install_python.sh
Created November 7, 2016 06:32 — forked from andriisoldatenko/install_python.sh
Install local Python 2.7.10 on CentOS 7
TMP_PATH=~/tmp_install_python
# Versions section
PYTHON_MAJOR=2.7
PYTHON_VERSION=$PYTHON_MAJOR.10
mkdir $TMP_PATH && cd $TMP_PATH
# Update yum and libraries
yum -y update
@guiyang882
guiyang882 / copyDirs.md
Created August 14, 2016 13:50
使用Python拷贝文件夹中的文件,并对文件进行些操作!
#!/usr/bin/env python
# coding=utf-8

import os
import pandas as pd

saveDir = "/home/fighter/imageretrievedata/for_train/"

def deal_cluster(filePaths):
@guiyang882
guiyang882 / TrieTree.md
Created August 14, 2016 09:33
使用C++创建TrieTree数据结构,也就是所说的字典树结构!
#include <iostream>
#include <vector>

using namespace std;

const int NodeMax = 26;
typedef struct _TrieNode {
    int cnt;
    struct _TrieNode* next[NodeMax];
@guiyang882
guiyang882 / Design_DataStruct.md
Last active August 4, 2016 04:52
在数据结构设计中的重要思路,替换原则
  • 对于一个单链表,我们假设这样一种情况,我们不知道单链表的头节点,我们只是知道单链表中某一个节点的指针,现在我们想删除这个节点,我们如何做到?

    • 第一个方案,我们假设一个Flag,确定当我们访问链表中的数据为Flag标志信息的时候,我们可以认为这个节点是我们已经被标志的删除节点;
    • 第二个方案(替换原则),我们可以将该节点的后继节点的信息拷贝到当前的节点上,然后将当前的节点的后继节点删除即可;
  • 在我做leetcode是遇到这样的一个问题,设计一个数据结构,实现插入、删除、随机获取一个数据的均需要咋O(1)的时间完成。

class RandomizedSet {
public:
    /** Initialize your data structure here. */
@guiyang882
guiyang882 / Learning STL 03.md
Last active August 4, 2016 04:26
使用STL中的Map和Hash_Map和Unordered_Map的底层细节区别
  • unordered_map在迭代器遍历时候key,value出现的顺序是未定义
  • 在STL中的Map底层的实现是红黑树,其插入和查找效率较低,对于插入和查找效率较高的HashMapC11推荐使用unordered_map
  • 在MSDN中又这样的描述

Internally, the elements in the unordered_map are not sorted in any particular order with respect to either their key or mapped values, but organized into buckets depending on their hash values to allow for fast access to individual elements directly by their key values (with a constant average time complexity on average).

unordered_map containers are faster than map containers to access individual elements by their key, although they are generally less efficient for range iteration through a subset of their elements.

这段英文按我的理解就是unordered_map的快速插入和快速查找都是没有问题的,只不过对于迭代器遍历的速度恐怕会相比低效一些。