由买买提看人间百态

topics

全部话题 - 话题: bit
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
C**********n
发帖数: 100
1
来自主题: JobHunting版 - 怎么倒序一个整数的bit位?
假如某整数,有n位(bit),要把它倒序,
那么最快的方法是什么?能比O(n)还快吗?
r****o
发帖数: 1950
2
来自主题: JobHunting版 - how to reverse the bits of an integer?
n是bits的位数.
G**********s
发帖数: 70
3
来自主题: JobHunting版 - 再来一道简单的bit运算题
An array A[1...n] contains all the integers from 0 to n except for one
number which is
missing. In this problem, we cannot access an entire integer in A with a
single operation.
The elements of A are represented in binary, and the only operation we can
use to access
them is “fetch the jth bit of A[i]”, which takes constant time. Write code
to find the
missing integer. Can you do it in O(n) time?
s********a
发帖数: 1447
4
来自主题: JobHunting版 - 问个bit struct的面试题 急
请教一下 如何写一个struct
这个struct里面只有 4个项 每个占 1bit
我写了一个
struct {
unsigned char priority :1;
unsigned char nonpriority :1;
unsigned char empty :1;
unsigen char full :1;
}flag;
但是这个占了bit 因为是char
如何写这个struct只占4bit
谢谢
r****o
发帖数: 1950
5
来自主题: JobHunting版 - 问个bit struct的面试题 急
恩,好像用unsigned int占用空间更大。
问一下,怎么看一个struct 占用了多少bit啊?用sizeof()好像只能看byte。
多谢。
B*******1
发帖数: 2454
6
来自主题: JobHunting版 - 问个bit struct的面试题 急
谁出的面试题,用Bit Field写的Code都是Platform Specificde,移植性很低
r****o
发帖数: 1950
7
来自主题: JobHunting版 - 问个bit struct的面试题 急
楼主的题目是写个struct只占4个bit,是不是没法实现了?
H*X
发帖数: 281
8
来自主题: JobHunting版 - 问个bit struct的面试题 急
可以啊, 如果要求就是4项,每个1bit,用bit field标明是:1就可以了, 只不过实际上占
用了1byte而已
你如果说,只能用4bit的空间来存储,这就不太现实了吧
w******1
发帖数: 520
9
来自主题: JobHunting版 - 问个bit struct的面试题 急
这个问题, 我也很困惑啊。
如果是普通的PC机器, 下面的这个STRUCT 改是多少BIT 和BYTE 呢?
struct {
char priority :1;
int abc :3;
float fff:7;
double ddd:8;
}flag;
Z*****Z
发帖数: 723
10
来自主题: JobHunting版 - 来个bit题
【 以下文字转载自 InterviewHackers 俱乐部 】
发信人: ZhangBZ (向日葵), 信区: InterviewHackers
标 题: 来个bit题
发信站: BBS 未名空间站 (Fri Jul 2 13:22:29 2010, 美东)
感觉这几个是相关的:
1. Let f(k) = y where k is the y-th number in the increasing sequence of non
-negative integers with the same number of ones in its binary representation
as y, e.g. f(0) = 1, f(1) = 1, f(2) = 2, f(3) = 1, f(4) = 3, f(5) = 2, f(6)
= 3 and so on. Given k >= 0, compute f(k).
2. There is a series of numbers in ascending order. All these numbers have t
he sam
i**********e
发帖数: 1145
11
来自主题: JobHunting版 - [牛文] Bit Twiddling Hacks
对面试最有用就应该是这几个了:
Determining if an integer is a power of 2
Counting bits set
Swapping Values
一些常见面试题的答案与总结 -
http://www.ihas1337code.com
h******3
发帖数: 351
12
来自主题: JobHunting版 - bit manipulation 小题
一个老题
Given an integer, print the next smallest and next largest number that have
the same number of 1 bits in their binary representation.
关于next smallest, next largest, 我的理解是比如
a = 347 = 101011011
next smallest = 111111 = 63
next largest = 111111000 = 504
career cup书的solution 运行了一下
next smallest = 343 = 101010111
next largest = 349 = 101011101
给我解释一下吧, 如果以前讨论过, 给个连接, 多谢.
g*********s
发帖数: 1782
13
google "bit map" and "stl map".
t**********n
发帖数: 145
14
bit map和map是完全两个东西。
建议wiki一下就很清楚。
l*****a
发帖数: 559
15
wiki上对bitmap的解释是图形上的。
lz问的是类似于bloom filter里bit array的bitmap。
h*****g
发帖数: 944
16
given 10001110
want to get 01110001
只能用 and/or这两种 bit operation
s**x
发帖数: 405
17
来自主题: JobHunting版 - switch odds and evens bits of an integer
this is incorrect because right-shift of signed integer duplicates the most
significant bit.
c**********e
发帖数: 2007
18
Find the bits that are one in a byte (in C)
t****y
发帖数: 27
19
This is actually not a good way.
A better way would be:
http://hackipedia.org/Algorithms/Optimization/html/Bit%20twiddl
H****r
发帖数: 2801
20
还以为是用 std bit vector呢...

/8
g***j
发帖数: 1275
21
来自主题: JobHunting版 - 问一个bit operation的题目
how to reverse the bit in an int as fast as possible?
any trick?
o****o
发帖数: 1398
22
来自主题: JobHunting版 - 问一个bit operation的题目
看我这个贴
http://www.mitbbs.com/article/JobHunting/32182835_4.html
另外补充一下:
3.1 求一个二进制数中1的个数
利用
int countOne(int x) {
int cnt = 0;
while(x > 0) {
x = x&(x-1);
cnt++;
}
}
3.2 给两个正整数A和B,问把A变为B需要改变多少bits?
这个等价于A和B的二进制表示中有多少位是不同的
C=A^B;
countOne(C);
S**I
发帖数: 15689
23
max of a, b and c is 2^n-1; (2^n-1) * (2^n-1) + (2^n-1) = 2^2n - 2^n. 2n
bits is enough.
c******3
发帖数: 60
24
peking2 大牛的blog让人仰视啊。
请问能不能也总结一下bit operation有关的题?
p*****2
发帖数: 21240
25
其实我倒是感觉bit operation的题面试中出现不算多。我好像还没碰到过。不知道大
家什么感觉。我想最近搞搞多线程。
c******3
发帖数: 60
26
bit operation 还是蛮哟用的。象leetcode上的 gray code,find missing one or
two numbers, etc.
谁要是有个系统的复习大纲就好了
k*******t
发帖数: 144
27
来自主题: JobHunting版 - 问一下CC150上1.1的bit vector解法
1.1 貌似不是bit vector啊
l*******0
发帖数: 63
28
之前是用一个int来标记是否见到过这个char,现在是用一个bit标记一个char是否见过
。原来需要256个int,现在需要256/8 个bytes.
A*********t
发帖数: 64
29
来自主题: JobHunting版 - 这个bit counting是怎么实现的?
太牛了,一点都看不明白。
http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSe
// option 3, for at most 32-bit values in v:
c = ((v & 0xfff) * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f;
c += (((v & 0xfff000) >> 12) * 0x1001001001001ULL & 0x84210842108421ULL) %
0x1f;
c += ((v >> 24) * 0x1001001001001ULL & 0x84210842108421ULL) % 0x1f;
m*********a
发帖数: 3299
30
来自主题: JobHunting版 - 问道题leetcode的题,关于bit运算的
你的这个和我的是一样,我递交了leetcode都能通过。
居然通不过我的笔记本的测试,太让人抓狂了
但是第一个写的居然都能过测试。 其实Bit[i]是0的时候不用加了,加了和原来的数一样
f****n
发帖数: 208
31
来自主题: JobHunting版 - 问道题leetcode的题,关于bit运算的
int size might not be 32 bits on the running platform?
p*********g
发帖数: 2998
32
来自主题: JobHunting版 - 求问leetcode新题reverse bits的follow up
bit manu的操作, 要毛hashmap啊
H******7
发帖数: 1728
33
这个题目有什么思路大家 :猜数字的游戏 8 bits 数字 有一个函数可以返回猜中的位
数 让用最少的次数猜中
c****h
发帖数: 4968
34
来自主题: Living版 - Lock a little bit early
My current rate is 5.00% + no closing cost, not locked yet. My broker
indicated that rate might go down a little bit in the next few days.
Hopefully he will be able to lock it at 4.8*% in next two days. Fingers
crossed.
T*********e
发帖数: 9208
35
砖头墙要用hammer drill+masonry drill bit
j***j
发帖数: 4878
36
哦,那么你说的masonry drill bit应该也可以用来往木墙上钻洞了吧,suppose应该更硬
一点的是吧
g*****9
发帖数: 4125
37
来自主题: Living版 - which drill bits is better deal?
Dewalt is the high end line of black and decker, their product is better.
Depending how often you use them and how you treat your tools (some people
loose them before they are worn out)
I'd go with dewalt if you use more often and don't loose them. Better bits
last longer and don't strip the screws.
just my 2 cents.
s***y
发帖数: 2607
38
来自主题: Living版 - which drill bits is better deal?
hmm... that I agree. already jumped the b&d yesterday before saw the dewalt.
also jumped the $10 hitachi last week. I will only keep one and return the
other(s) anyways... but if I got the dewalt and keep it, it seems I finally
triple my cost on drill bits from 10 to 30. LOL
f****i
发帖数: 20252
39
来自主题: Living版 - Lowes今天drill bits打折
bosch和irwin drill bits
f****i
发帖数: 20252
40
来自主题: Living版 - Lowes今天drill bits打折
irwin 318015 drill bits, lowes卖11刀加税,amazon价格很差
f****i
发帖数: 20252
41
来自主题: Living版 - Lowes今天drill bits打折
俺前面说的是bits,不是drill。
这个18V 的无线bosch drill lowes 卖 $99
http://www.amazon.com/Bosch-36618-02-18-Volt-Compact-Tough-Batt
w********r
发帖数: 1842
42
来自主题: Living版 - 电钻上用的Bit Sets差别大吗?
版上电钻有个神器榜,但是不同牌子的Bit Sets差别大吗?还是都查不多?有没有什么
好推荐的?
还有很多套装里的电钻的尾巴好像都是细的,好像直接夹在电钻里用够呛。
谢谢。
p**********g
发帖数: 9558
43
来自主题: Living版 - router bit实在太贵了。。。
哇哈哈哈好,我屯了不少,clearance的时候
你缺啥bit啊
m*f
发帖数: 8162
44
来自主题: Living版 - router bit实在太贵了。。。
刚花了一百刀下了单,一套cmt的ogee raised panel bit...心里还肉痛得渗血。。。
领导想要一个customized shoe cabinet,做成一个nook的样子,尺寸比较麻烦,决定
自己上了。。
p**********g
发帖数: 9558
45
来自主题: Living版 - router bit实在太贵了。。。
我现在有2套raised panel bit,一套是cmt的6件,一套是diablo freud的
多好啊,可以自己试试,我还没有时间
p**********g
发帖数: 9558
46
来自主题: Living版 - router bit实在太贵了。。。

raised panel router bit本来就贵
f****i
发帖数: 20252
47
来自主题: Living版 - router bit实在太贵了。。。
有一次我家门口的OSH要搬家,里面的工具开始减价,先10%,然后20%。。。
盯上了一套irwin cobalt drill bit,想等50%,结果到了40%就没了
p**********g
发帖数: 9558
48
router/router bits HF当然有了
d**********0
发帖数: 13081
49
来自主题: Living版 - 买了 Lowes Screwdrive Bit Set
http://slickdeals.net/f/6054778-Back-Again-Kobal-44-pc-Screwdri
俺的那个 driller 还非得用 Screwdrive-Bit 不可。 买那种简单的钻条还用不了。。
n*****e
发帖数: 2318
50
来自主题: Living版 - 买了 Lowes Screwdrive Bit Set
靠,附近全没了,丁丁,是不是你干的。昨天刚断了根bit
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)