c++学习
乐观的Zqq
谁在呼叫舰队
展开
-
C++ 中set的用法
1.关于set C++ STL 之所以得到广泛的赞誉,也被很多人使用,不只是提供了像vector, string, list等方便的容器,更重要的是STL封装了许多复杂的数据结构算法和大量常用数据结构操作。vector封装数组,list封装了链表,map和set封装了二叉树等,在封装这些数据结构的时候,STL按照程序员的使用习惯,以成员函数方式提供的常用操作,如:插入、排序、删除、查找等。让用户在...转载 2018-09-28 11:06:06 · 120 阅读 · 0 评论 -
【Leetcode刷题笔记】669. Trim a Binary Search Tree
Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You might need to change the root of the tree, so the re...原创 2019-01-30 15:29:21 · 110 阅读 · 0 评论 -
【Leetcode刷题笔记】c++ map的排序方式
按Key排序 map默认的排序方式就是按key进行排序 按Value排序 当需要按Value排序时,装入vector<pari<int,int>>中,再进行vector的排序,需要自写排序函数,然后进行排序。 int cmpByValue(const pair<int,int>& p1,const pair<int,int>& p2)...原创 2019-03-22 08:55:44 · 315 阅读 · 0 评论