Skip to content

Instantly share code, notes, and snippets.

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

GuiYang liuguiyangnwpu

💭
I may be slow to respond.
View GitHub Profile
@kylemcdonald
kylemcdonald / Triplet Loss.ipynb
Last active November 29, 2022 20:42
Experimenting with triplet loss embeddings.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@liuguiyangnwpu
liuguiyangnwpu / Computer Science Students.md
Last active June 25, 2020 05:10
主要描述下计算机领域对于职业技能的准备点,希望大家多多补充!

该如何学习?

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

该学什么?

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

操作系统

  • 除了学习先修课程,其中推荐一些课程
@liuguiyangnwpu
liuguiyangnwpu / 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):
@liuguiyangnwpu
liuguiyangnwpu / 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];
@liuguiyangnwpu
liuguiyangnwpu / Design_DataStruct.md
Last active August 4, 2016 04:52
在数据结构设计中的重要思路,替换原则
  • 对于一个单链表,我们假设这样一种情况,我们不知道单链表的头节点,我们只是知道单链表中某一个节点的指针,现在我们想删除这个节点,我们如何做到?

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

class RandomizedSet {
public:
    /** Initialize your data structure here. */
@liuguiyangnwpu
liuguiyangnwpu / 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的快速插入和快速查找都是没有问题的,只不过对于迭代器遍历的速度恐怕会相比低效一些。

@liuguiyangnwpu
liuguiyangnwpu / STL_Heap_Struct.md
Last active August 3, 2016 11:25
使用STL容器构造堆数据结构
  • 使用STL中的优先级队列进行堆数据结构的建立
priority_queue<Type, Container, Functional>
Type - 数据类型
Container - 保存数据的容器
Functional - 用来指定数据之间的比较规则

STL中的默认的priority_queue是存储类型为vector的大顶堆,使用方式如下
priority_queue<int, vector<int>, less<int>> high_heap;
@liuguiyangnwpu
liuguiyangnwpu / Learning STL 02.md
Created August 2, 2016 07:45
How to free the pointer which allocated on the heap, use different method !
  • when using containers of newed pointers, remember to delete the pointers before the container is destroyed.
void doSomething() {
	vector<Widget*> vwp;
	for(int i=0;i<NUMS;++i) {
		vwp.push_back(new Widget);
	}
}
// Widgets are leaked here !
@liuguiyangnwpu
liuguiyangnwpu / Learning STL 01.md
Last active August 2, 2016 07:10
How to write a class with STL
class Widget { ... };
vector<Widget> vw;
Widget bestWidget;
vector<Widget>::iterator it =find(vw.begin(), vw.end(), bestWidget);

you should write this