Professional Documents
Culture Documents
Q2 Aray Col Size 600 No:of:pixels 1 Pixels 1 Byte 8 Bit (0-255) Grayscale Value 2.2
Q2 Aray Col Size 600 No:of:pixels 1 Pixels 1 Byte 8 Bit (0-255) Grayscale Value 2.2
2.2
2.3
2.3
First we have to check the total number of Image byte
Algotithem TotNoImgByte( )
Input-noimgbyte,col
col< 600,n< noimgbyte n1 1
row< n/600; n2 1
rem< n%600; n3 1
if(rem>0) n4 1
row< row+1; n5 1
else n6 1
row< row; n7 1
col< col; n8 1
Do save byte in an Array;
end if; n9 1
//subroutine for count the no of items ,grayscale value=50 appers in the array
2.6 Algorithem findcount(key=50,n element)
int count< 0; n1
for(col=0;col<n;col++) n2n
if(a[index]==key) n3
count++; n4
else n5
return count; n6
end if n7
return 0; n8
end n9
Q3 //subroutine for create a link list
3.1 create listnode
int name; //datapart n1
listnode link; //link part n2
n3
create list n4
listnode head;//only reference n5
int length; n6
list( )
{
head< null; n7
length< 0; n8
}
3.3
//subroutine for insert element to the list
Algorithem insert(value)
listnode prev,next; n1
next< head; n2
prev< null; n3
while((next!=null) &&(next.data<100)) n4
if(next< head) n5
temp.link< head; //insert beginning of the lin6
head< temp; n7
else if(next==null) n8
temp.link< null; //insert end of the list n9
prev.link< temp; n10
else n11
temp.link< next; //insert mid of the list n12
prev.link< temp; n13
end if n14
end do while n15
end insert n16