Array
Array คือ โครงสร้างที่เป็นช่องสำหรับเก็บข้อมูล ซึ่งมักมีหลายช่องเรียงติดต่อกันในหน่วยความจำ เช่น array of Integer (array ของจำนวนเต็ม)array of character(array ของอักขระ,อักษร) array of text (array ของข้อความ)
คุณสมบัติของ array มีดังนี้
1ข้อมูลของarray ต้องเป็นชนิดเดียวกัน
2สมาชิกของแต่ละช่องต้องมีขนาดเท่ากันทุกช่อง
3สามารถนำข้อมูลที่จัดเก็บออกมาแสดงแบบเรียงลำดับได้
4สามรถแก้ไข เพิ่มลบข้อมูลใน array ได้
5ต้องเรียงติดกัน
ประเภทของarray
Array มี 3 ประเภท
-array แบบ 1 มิติ
การหาจำนวนช่องของแถวลำดับ 1 มิติ
สูตรน่ะค่ะ
U-L+1 = จำนวนช่องของแถวลำดับ 1 มิติ
ตัวอย่างค่ะ
จงหาจำนวนช่องของแถวลำดับ 1 มิติ ต่อไปนี้
A (a) = A(1:9) = 9-1+1 = 9ช่อง
B(3:8) = 3-8+1 = 6ช่อง
num(-8:3) = 3-(-8)+1 = 3+8+1 = 12 ช่อง
การคำนวณหาตำแหน่ง(Address) ของลำดับแถว
สูตรค่ะ
loc (A[i]) = Address เริ่มต้นของ array + c(i-l)
c = ขนาดของสมาชิกแต่ล่ะช่อง (byte)
i = ดัชนีของสมาชิกที่จะหาตำแหน่ง
l = lower bound
มีตัวอย่างด้วยค่ะ
กำหนด A(-5:8) มีตำแหน่งเริ่มต้นที่ 3500 และสมาชิกแต่ละช่องมีขนาด 16 bit จงหา Address ของ
A[1], A[3], A[8]
A[1] = 3500+2 (1-(-5)) = 3512
A[3] = 3500+2(3-( -5)) = 3516
A[8] = 3500+2(8-(-5)) = 3526
-array แบบ 2 มิติ
-array แบบ 3 มิติ
วันพุธที่ 23 มิถุนายน พ.ศ. 2553
my self
Name : PORNSAK MUSOYAENA
Address : 77/1 Ramkhamheang 53 ,Ramkhamheang Rd. Huamark, Bangkapi, Bangkok 10240 .
Place of birth : Chana , Songklah , Thailand
Birthdate : 30 Novamber 1987
Marital Status : Single
Health : Excellent
Religion : Islamic
Activities : Imagine and Decorate the novel
Special Interest : Art and History
OTHER QUALIFICATIONS
Ability to use many computer program : MS Office,
MS Word .
EDUCATION
I am a third year student at Chandrakasem Rajabhat University .
Major : Business Computer .
WORKING EXPERIENCE
I am a student helps the work , academic section ,
management science faculty .
THE ACTIVITY REACHES THE CAMPS
The camp volunteer develop the community .
The camp trains the morality .
The camp we are all the brothers .
The camp we are all the brothers 2 .
Address : 77/1 Ramkhamheang 53 ,Ramkhamheang Rd. Huamark, Bangkapi, Bangkok 10240 .
Place of birth : Chana , Songklah , Thailand
Birthdate : 30 Novamber 1987
Marital Status : Single
Health : Excellent
Religion : Islamic
Activities : Imagine and Decorate the novel
Special Interest : Art and History
OTHER QUALIFICATIONS
Ability to use many computer program : MS Office,
MS Word .
EDUCATION
I am a third year student at Chandrakasem Rajabhat University .
Major : Business Computer .
WORKING EXPERIENCE
I am a student helps the work , academic section ,
management science faculty .
THE ACTIVITY REACHES THE CAMPS
The camp volunteer develop the community .
The camp trains the morality .
The camp we are all the brothers .
The camp we are all the brothers 2 .
สมัครสมาชิก:
ความคิดเห็น (Atom)