Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 8

Q2

Aray col size=600=no:of:pixels


1 pixels=1 Byte=8 Bit (0-255)=grayscale value

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

// Subriotine for save byte in an Array


Algorithem savebyteinanArray ( row,col)
r< 1,c< 1; n10 1
boolean check< false; n11 1
if (r<row) n12 n/600
if( c<600) n13 n/600*600
while(!check) do n14 n
int save< filebyte; n15 n
if(filebyte=0) then n16 1
return -1; n17 1
check true; n18 1
else n19 1
save ( r)( c) < save; n20 n
end if; n21 1
end while; n22 1
c< c+1; n23 n
end if; n24 1
r< r+1; n25 n
end if; n26 1

// subroutine for find delete point


Algorithem deletepoint(col,nodeleteelement)
col< 600,nodeleteelement< 200; n27 1
int d< c-200; n28 1
if (d<0) then n29 1
d< d*(-1); n30 1
d< 600-d; n31 1
r< r-1; n32 1
else n34 1
pr< r; n35 1
pc< d; n36 1
end if; n37 1
end if; n38 1
//subrotine for copy 200 pixels from array to new array
Algorithem copy(int i)
boolean check < false; n39 1
int i< 0, n40 1
while (!check) do n41 200
if(int e< no of copy rows) n42 r
if (int f< 599) n43 600
if(i<200) n44 200
copy[i]< save[e] [f]; n45 200
end if n46 1
f< f++; n47 600
end if n48 1
e< e++; n49 r
end if n50 1

end do while n51 1


end n52 1

//subroutine for delete Array item


Algorithem delete ( row,col)
int count< 0; n53 1
while (count<=200) do n54 201
save [pr][pc]< [pr][pc+1]; n55 200
if(pc<600) n56 600
pc< pc+1; n57 600
else n58 1
pc< 0; n59 1
pr< pr+1; n60 1
end if n61 1
count< count+1; n62 200
end do while n63 1
2.5

//subroutine for insert Array element


Algorithem insert(100)
create an array a [600];
index< 300; n1
value< 200; n2
if (index<500) then n3
a[index]< value; n4
index++; n5
end if n6

//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
}

Algorithem totnoimgbyte(no of img byte,col )


3.2 col< 600; n1
n< noimgbyte; n2
rem< n%600; n3
row< n/600; n4
if(rem>0) n5
row< row+1; n6
else n7
row< row; n8
col< col; n9
Do save byte in an Array;
end if n10

Algorithem savebyteinanArray( row,col)


r< 1; n11
c< 1; n12
boolean check< false; n13
if(r<row) n14
if(c<600) n15
while(!check) do n16
int save< filebyte; n17
if(filebyte==0) then n18
return -1; n19
check true; n20
else n21
save[r ] [c ]< save; n22
Do addvaluetolinklist;
end if n23
end do while n24
c< c+1; n25
end if n26
r< r+1; n27
end if n28

//subroutine for add value to link list


Algorithem addvaluetolinklist( value)
value< save[r] [c]; n29
n< node(value); n30
if(head== Ф) n31
head< n; n32
tail< n; n34
else n35
tail.next< n; n36
tail< n; n37
end if n38
end addvaluetolinklist n39

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

//subroutine for finding the list element 50


Algorithem listnodefind( key)
listnode< current; n17
curent< head; n18
while(current.data=key) do n19
if(count.link==null) n20
return null; n21
else n22
current< current.link; n23
call subroutine insert; n24
end if n25
return; n26
end do while n27
end n28
Q4
4.2 //subrotine for recursion
Algorithem count( )
create a algorithem for insert 100 pixels to link list,list element 50 onward
count< 0;
link current< first;
while (current.data!<value)
if(current.next++null)
return null;
else
current< current.next;
end if
return current;
count< count+1;
end while do

You might also like