開始用pixnet到現在已經天了 當你(妳)閒的發慌時,就留下你(妳)的足跡吧
※相逢即是有緣,可以加我成為你(妳)的好友,3Q VERY 麻吉。
音樂饗宴:
ღ 來到這個畫面,千萬要在 左邊的 "揮完衣袖..留下雲彩記憶:吸-爸渴死" 留言唷 ღ
現在過的生活是幾年前做的決定所造成的,如果幾年後要過不一樣的生活,現在就要做改變
- Nov 12 Wed 2008 00:39
蔣幹曹操老掉牙
- Nov 11 Tue 2008 01:29
很久以前的,但還是想笑XD
- Nov 10 Mon 2008 16:15
min-max heap
今天要說的是min-max heap的問題
12 -------min
╱ ╲
30 29 -------max
╱ ╲ ╱ ╲
13 14 15 16 -------min
╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲
17 18 19 21 22 23 24 25 -------max
assumpt that node X=12 belongs to min-level so that node12 is the minimum
in both left and right subtrees of node12.
assumpt that node X=26 belongs to max-level so that node29 is the maximum
in both left and right subtrees of node29.
12
╱ ╲
TL(30) TR(29) 12 is the minimum
29
╱ ╲
TL(15) TR(16) 29 is the maximum
If Tree is:
19 ----------min
╱ ╲
30 35 ----------max
╱ ╲ ╱ ╲
20 21 22 23 ----------min
╱ ╲ ╱ ╲ ╱ ╲ ╱ ╲
24 25 26 27 28 29 31 36
we see the node36 > node35, so error occurs,
node36 should be amended. Becoming the node that its number is smaller than 35
以上, 有錯請指教^^
- Nov 09 Sun 2008 11:04
我和妳是220和284
- Nov 08 Sat 2008 18:45
Excess-3 and complement
某位問的
標題: [問題] 負99的Excess-3碼該怎麼求?!(8bit)
時間: Fri Nov 7 10:49:48 2008
負99的Excess-3碼該怎麼求?!(8bit)
1.我知道Excess-3碼是由BCD碼加3而來,但是當負的時候應該怎麼求?
2.我知道補數的應用在減法,如計算M-N時,需先將N取補數,再與M相加,
所以表示如果單獨想知道負N,應該可以對N取補數,但是有r補數減法與r-1補數減法
,所以當求負數N的時候該選擇對N取哪個補數呢?
以上可能觀念錯誤~~請多多指教~~
以下是我的回答:
以下發表個人淺見:
首先,超三碼(Excess-3)是屬於二進位碼十進制
與8421碼(權位碼)的二進位碼二進制不同
8 4 2 1 Excess-3
_________________________________________
0 0 0 0 0 0 0 1 1 (3)
1 0 0 0 1 0 1 0 0 (4)
2 0 0 1 0 0 1 0 1 (5)
3 0 0 1 1 0 1 1 0 (6)
4 0 1 0 0 0 1 1 1 (7)
5 0 1 0 1 1 0 0 0 (8)
6 0 1 1 0 1 0 0 1 (9)
7 0 1 1 1 1 0 1 0 (10)
8 1 0 0 0 1 0 1 1 (11)
9 1 0 0 1 1 1 0 0 (12)
10 1 0 1 0 01000011
我認為若以Excess-3表示 -99 : -11001100
若以有號數表示 : SXXXXXXX 其中,S is a Sigh bit
故 99以符號大小表示 : 01100011
-99以符號大小表示 : 11100011
99以符號1補數表示 : 01100011
-99以符號1補數表示 : 10011100
99以符號2補數表示 : 01100011
-99以符號2補數表示 : 10011101
利用加法與補數可以取代減法
如同原PO所說可使用r補數或是r-1補數進行減法
其實兩種方法皆可使用,所得答案會相同
差別在於利用r-1補數進行減法運算時
若有End Carry,EC(端進位)
r-1補數必須將其結果加1
r補數則不需要
For example,M = 1010100B N = 1000100B ,M-N?
(1) Using r's complement
Step1: N取2補數
1000100 → 0111100
Step2: M + the 2's complement of N
1010100
+ 0111100
____________
1 0010000
"EC"
Because that is using r's complement method, ignoring the end carry.
Therefore, the answer is 0010000
(2) Using r-1's complement
Step1:N取1補數
1000100 → 0111011
Step2: M + the 1's complement of N
1010100
+ 0111011
___________
1 0001111
"EC"
+ 1 Becauase that is using r-1's complement method, we need to
___________ add 1 again. The answer is 0010000
0010000
以上
希望各位指教
----------------------------------------------------------------------------------------------
歡迎大家批評指教唷^^
- Nov 05 Wed 2008 00:45
非你莫屬
- Nov 04 Tue 2008 02:51
妳和我
是說...這次真的要切斷了..就
讓
一切成了Ash...
在鐵窗裡,獨自抬頭望著城裡的月光,讓思念妳的寂寞感持續蔓延.我對自己說:還是會寂寞
很遺憾..
就讓我在回憶裡繼續夢幻