p***y 发帖数: 637 | 1 我这statics大概就是面试官说的multiSet |
|
|
|
k****p 发帖数: 9 | 4 那样可以用priority_queue。priority_queue的函数名和stack一样的,pop,push,top很
好记。
面试官怎么看,我也不清楚。面试经验不多。。。
另外那个题也可以两两merge。假设总长度N,heap复杂度O(Nlog(K))。 两两merge的话
,每轮最多2N(list奇数2N,偶数N)。有log(K)轮。 |
|
|
x*******9 发帖数: 138 | 6 SPOJ MDOLLS
4A(有点蠢
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define print(x) cout << x << endl
#define input(x) cin >> x
int n;
vector > vec;
int main() {
int T;
int a, b;
input(T);
while (T--) {
input(n);
vec.clear();
multiset st;
for (int i = 0; i < n; i++) {
input(a >> b);
vec.push_back({a, b})... 阅读全帖 |
|
w*********e 发帖数: 49 | 7 距离是按在array里的index算的,这题的point在于可以有重复的word
binary search tree也可以有重复key,看你怎么定义了,比如c++std里的multiset就
是有重复key的rb tree |
|
A*******e 发帖数: 2419 | 8 1.明白了。
2.直接在普通rb-tree上加个计数器不就好了吗?何必重复key?而且一直没搞懂,
multiset/multimap有什么必需应用么? |
|
w*********e 发帖数: 49 | 9 multimap比较好理解,就是一样的key不同的value
multiset确实等同于可key-count的map,但是据说在combinatorics里有应用,看了看
wiki没看懂 |
|
w*********e 发帖数: 49 | 10 距离是按在array里的index算的,这题的point在于可以有重复的word
binary search tree也可以有重复key,看你怎么定义了,比如c++std里的multiset就
是有重复key的rb tree |
|
A*******e 发帖数: 2419 | 11 1.明白了。
2.直接在普通rb-tree上加个计数器不就好了吗?何必重复key?而且一直没搞懂,
multiset/multimap有什么必需应用么? |
|
w*********e 发帖数: 49 | 12 multimap比较好理解,就是一样的key不同的value
multiset确实等同于可key-count的map,但是据说在combinatorics里有应用,看了看
wiki没看懂 |
|
|
n*********h 发帖数: 264 | 14 如果是multiset,题目倒是合理的;要是是集合,纯粹坑爹。 |
|
S**I 发帖数: 15689 | 15 Of course; for example, C++ STL has multiset and multimap, which allow
existence of elments with equivalent keys. Also, both of them have a member
function equal_range, which does exactly what you want.
a |
|
C*******e 发帖数: 41 | 16 Thanks!
Since I was looking at relational/object DBMS, CAST
now is extended to user defined data type also, I guess,
in SQL extensions. And probabely MULTISET serves similar
function together with CAST, but I really couldn't find
this guy. |
|
q*****g 发帖数: 72 | 17 string is sequential container
associative container: set, multiset, map, multimap |
|
|
|
|
B*********h 发帖数: 800 | 21 ☆─────────────────────────────────────☆
zhuxi (主席) 于 (Fri Mar 9 21:09:04 2007) 提到:
发信人: zhuxi (主席), 信区: JobHunting
标 题: STL面试问题
发信站: BBS 未名空间站 (Fri Mar 9 13:29:12 2007)
如何往set(注意不是multiset)中insert多个相同的key?
没答上来。
☆─────────────────────────────────────☆
waterside (春波碧草) 于 (Fri Mar 9 21:12:46 2007) 提到:
可以这么做吗?
☆─────────────────────────────────────☆
alan (Super Colts!) 于 (Fri Mar 9 21:13:33 2007) 提到:
insert也没用啊
☆─────────────────────────────────────☆
wass (DoubleQuant) 于 (F |
|
S*****H 发帖数: 90 | 22 1. What is Object?
2. What is Polymorphism? How to implement polymorphism?
3. What is Dynamic Binding and Static Binding?
4. What is OOP?
5. What are important features of OOP? Why OOP are better?
6. What is Class?
7. Difference between class and object.
8. What is enum? What is enum's limitation?
9. What are interface and abstract class?
10. How would you choose between an abstract class and interface?
11. What are struct and union?
12. What is the difference... 阅读全帖 |
|
S*****H 发帖数: 90 | 23 1. What is Object?
2. What is Polymorphism? How to implement polymorphism?
3. What is Dynamic Binding and Static Binding?
4. What is OOP?
5. What are important features of OOP? Why OOP are better?
6. What is Class?
7. Difference between class and object.
8. What is enum? What is enum's limitation?
9. What are interface and abstract class?
10. How would you choose between an abstract class and interface?
11. What are struct and union?
12. What is the difference... 阅读全帖 |
|