由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 请教一个算法问题!
相关主题
one question about initializaiton list一道C++面试编程题
c preprocess question有人能解释一下这段C++代码吗
mem_fun_ref为什么必须引用?shortest path algorithm(dijkstra)的变形
Go adopts JavaScript’s idea of semicolon insertionIs this correct?
When are data members initialized? what about static data m帮帮看看这段tree insertion
[合集] 为什么 const member 不能是 static.[合集] Debugging large macro
Question about vector as a class member[合集] 如何得到一个指向STL元素的指针?
static initialization dependency c++STL的问题(C++)
相关话题的讨论汇总
话题: operations话题: member话题: insert话题: constant话题: algorithm
进入Programming版参与讨论
1 (共1页)
j********6
发帖数: 135
1
Design an algorithm for the following problem and provide an analysis of the
algorithm:
Suppose you are given n+k words of memory to use and a sequence of n INSERT,
DELETE, and MEMBER operations to process. The integers 1 through k are the
values of the operations (e.g., INSERT 1, MEMBER k,...).
Explain how to do each of the three operations in constant time, using at
most a constant amount of additional storage space beyond the alloted n+k
words.
Note: You cannot use preprocessing to initialize memory.
先谢过了!是不是要找一种特殊的数据结构?
w********m
发帖数: 1137
2
嵌套的hash?
network = {1: {2, 3, 9}}
j********6
发帖数: 135
3
谢谢!我也考虑hash table呢. 还没有什么进展

【在 w********m 的大作中提到】
: 嵌套的hash?
: network = {1: {2, 3, 9}}

1 (共1页)
进入Programming版参与讨论
相关主题
STL的问题(C++)When are data members initialized? what about static data m
请高人解释一下为啥这个输出总是"HELLO-ERR"[合集] 为什么 const member 不能是 static.
深情的呼唤师傅们!C++做题做不出来啦!Question about vector as a class member
how to initialize associate data in STL mapstatic initialization dependency c++
one question about initializaiton list一道C++面试编程题
c preprocess question有人能解释一下这段C++代码吗
mem_fun_ref为什么必须引用?shortest path algorithm(dijkstra)的变形
Go adopts JavaScript’s idea of semicolon insertionIs this correct?
相关话题的讨论汇总
话题: operations话题: member话题: insert话题: constant话题: algorithm