Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Image picture description, Study notes of Digital Logic Design and Programming

Digital circuits and wave form

Typology: Study notes

2017/2018

Uploaded on 06/22/2018

mano-ranjani
mano-ranjani 🇮🇳

1 document

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1

Partial preview of the text

Download Image picture description and more Study notes Digital Logic Design and Programming in PDF only on Docsity!

all] al2] al3]oaf4] all 5] LEE After Reverse | 9 : ‘ Figure 1.6(b) oa «= a{5] (Swap element 5 value with element 1 value) al2\ 2 al4] Pa va see the suffixes/subscripts on left hand ane eae cae suffixes /subscripts on right hand side are in decreasing order. ( A re is a yy ; st 1 For determining the reverse-array subscript values, we can PSS iginal array. | where ‘n’ is total number of elements an ‘i’ is the subscript of the element 7 Bie oe n-i+l ; / , eth! as toa 5-141=5 ee <= cn he st 5-2+ 1=4 YP hi (ned Ba 5 wx wie 5-3+1=3 : gi paeniae : % LAr} wh Jar O48 tah Swapping the values of that elements in the array would thus be reversed. “es To exchange the values of the elements of the array, we need one temporary variabl Then we do the swapping as given below: “. temp =al[i] a{i] =a[n -i+ 1) aln -i+ 1] =temp Algorithm 1. Begin 2. Get the values and store them in an arr where n is the number of elements. 3. Compute r, 1/2. 4. Exchange the i element with [n - i + 1 temp =al[i] ay with elements a[1], a[2], a[3. } the number of exchange needed to reverse the ar a ] using | ‘ ali] =a[n -i+ 1] a[n-it+l=temp 5. Carry step 4, r times increasing i by 1. “a Fy