Posts

Algorithm of sorting

An algorithm to sort an elements using Insertion Sort. Algorithm for Insertion sort:- Step 1 : START Step 2 : Input N Step 3 : For I←0 to N -1 Read A [ I ] ( end of I for loop ) Step 4 : For I←1 to N -1 Do Step 5 : J = I Step 6 : While ( J > = 1 ) and ( A[ J ] < A [ J -1 ] ) Step 7 : TEMP = A [ J ] Step 8 : A [ J ] = A [ J - 1 ] Step 9 : A[ J - 1 ] = TEMP Step 10 : J = J - 1 [ end of While loop ] [ end of step I For loop ] Step 11 : For I←0 to N -1 Step 12: Print A [ I ] Step 13 : Stop Consider the elements A[0 ]    20 A[1]    16 A[2]    4 A [3]    3 Pass 1: A[1],A[0]>16,20,4,3 Pass 2: A[2],A[1]> 16,4,20,3 A[1],A[0]>4,16,20,3 Pass 3: A[3],A[2]> 4,16,3,20 A[2],A[1]>4,3,16,20 A[1],A[0]> 3,4 16,20 Sorted order is 3,4,16,20 Algorithm for bubble sort:- Step 1 : START Step 2 : Input N Step 3 : For I←0 to N -1 Step 4 : Read ( A [ I ] ) ( end of for loop ) Step 5 : F...

Memristor

Image
Memristor Definition:- According to the original 1971 definition, the memristor was the fourth fundamental circuit element, forming a non-linear relationship between electric charge and magnetic flux linkage. What is memristor? Ans.As its name implies, the memristor can "remember" how much current has passed through it. And by alternating the amount of current that passes through it, a memristor can also become a one-element circuit component with unique properties. Most notably, it can save its electronic state even when the current is turned off, making it a great candidate to replace today's flash memory.  The memristor definition is based solely on the fundamental circuit variables of current and voltage and their time-integrals, just like the resistor, capacitor and inductor. Unlike those three elements however, which are allowed in linear time-invariant or LTI system theory, memristors of interest have a dynamic function with memory and may be d...