human
Write me a code to vertical and Horizontal retrieval ( MRT ) on Tapes and the other steps required given the following:
Vertical and Horizontal retrieval ( MRT ) on Tapes | Python3 program to print Horizontal filling.
It is used for checking whether tape is full or not.
It is used for calculating total retrieval time.
It is used for calculating mean retrieval time.
vector is used because n number of records can insert in one tape with size constraint.
Null vector obtained to use fresh vector 'v.
initialize variables to 0 for each iteration.
sum is used for checking whether i 'th tape is full or not.
check sum less than size of tape.
increment in j for next record.
calculating total retrieval time.
MRT formula.
calculating mean retrieval time using formula.
v . size ( ) is function of vector is used to get size of vector.
Driver Code.
store the size of records [ ].
store the size of tapes [ ].
sorting of an array is required to attain greedy approach of algorithm"
Solution in Python:
assistant
#Here is code to vertical and Horizontal retrieval ( MRT ) on Tapes and the other steps required.
 def horizontalFill ( records , tape , nt ) :
	sum = 0 ;
	Retrieval_Time = 0 ;
	current = 0 ;
	v = [ ] ;
	for i in range ( nt ) :
'
	v . clear ( ) ;
	Retrieval_Time = 0 ;
	sum = 0 ;
	print ( " tape " , i + 1 , " : ▁ [ ▁ " , end = " " ) ;
	sum += records [ current ] ;
	while ( sum <= tape [ i ] ) :
		print ( records [ current ] , end = " ▁ " ) ;
		v . append ( records [ current ] ) ;
		current += 1 ;
		sum += records [ current ] ; print ( " ] " , end = " " ) ;
	for i in range ( len ( v ) ) :
		Retrieval_Time += v [ i ] * ( len ( v ) - i ) ;
	Mrt = Retrieval_Time / len ( v ) ;
	print ( " tMRT ▁ : " , Mrt ) ;
if __name__ == " _ _ main _ _ " :
	records = [ 15 , 2 , 8 , 23 , 45 , 50 , 60 , 120 ] ;
	tape = [ 25 , 80 , 160 ] ;
	n = len ( records ) ;
	m = len ( tape ) ;
	records . sort ( ) ;
	horizontalFill ( records , tape , m ) ;