| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 586 人关注过本帖
标题:上海一家软件公司笔试题
只看楼主 加入收藏
ww84020209
Rank: 1
等 级:新手上路
帖 子:190
专家分:0
注 册:2006-8-21
收藏
 问题点数:0 回复次数:0 
上海一家软件公司笔试题


Problem 1 : Fast one-hot checker
A bit vector is one-hot if and only if there is at most one 1 in the
vector. For example, 0000 and 00100 are one-hot and 00110 is not one-hot.
Please find the fastest way to check whether a bit vector is one-hot or not.


Problem 2 : 3-Inverter
Assume that a logical blackbox has three Boolean inputs x, y, z and
three Boolean outputs X, Y, Z where the outputs are defined as

X = ~x

Y = ~y

Z = ~z

Note that ~ stands for a NOT gate. Please realize this blackbox using
only two NOT gates, and as many as possible AND and OR gates.

Problem 3 : Is it a loop ?
Assume that we have a head pointer to a link-list. Also assume that
we know the list is single-linked. Can you come up an algorithm to check
whether this link list includes a loop by using O(n) time and O(1) space
where n is the length of the list? Furthermore, can you do so with O(n)
time and only one register?

Problem 4 : Detect same sequence
Assume that we have a m*n matrix A where both m >= 1K and n >= 100K. X_i is

a row vector of A where 1 <= i <= m. In other words, A = {X_1, X_2, ..., X_m}.

Please find a fastest algorithm to detect all pairs (X_i, X_j), where X_i == X
_j.

搜索更多相关主题的帖子: 上海 笔试 软件 
2006-09-11 15:48
快速回复:上海一家软件公司笔试题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026745 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved