<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9168209982739874163</id><updated>2024-12-19T08:54:26.940+05:30</updated><title type='text'>CodeWordBlog</title><subtitle type='html'>Computer Programming algorithms</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>15</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-8637751723221888492</id><published>2011-08-10T14:19:00.025+05:30</published><updated>2011-08-10T15:22:42.861+05:30</updated><title type='text'>Sorting by Selection</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;span style=&quot;font-size: small;&quot;&gt;&lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-priority:1;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:&quot;Times New Roman&quot;;
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-bidi-font-size:10.0pt;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:&quot;Times New Roman&quot;;
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section 
&lt;/style&gt;&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;/span&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;


&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;
   &lt;m:smallfrac m:val=&quot;off&quot;&gt;
   &lt;m:dispdef&gt;
   &lt;m:lmargin m:val=&quot;0&quot;&gt;
   &lt;m:rmargin m:val=&quot;0&quot;&gt;
   &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;
   &lt;m:wrapindent m:val=&quot;1440&quot;&gt;
   &lt;m:intlim m:val=&quot;subSup&quot;&gt;
   &lt;m:narylim m:val=&quot;undOvr&quot;&gt;
  &lt;/m:narylim&gt;&lt;/m:intlim&gt;
&lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
	{font-family:&quot;\0022Courier New\0022&quot;;
	panose-1:0 0 0 0 0 0 0 0 0 0;
	mso-font-alt:&quot;Times New Roman&quot;;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:auto;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:&quot;\0022serif\0022&quot;;
	panose-1:0 0 0 0 0 0 0 0 0 0;
	mso-font-alt:&quot;Times New Roman&quot;;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:auto;
	mso-font-signature:0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:781612319;
	mso-list-template-ids:-748106464;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Here explain
sorting of random ordered n integers in to ascending order using Selection.
Firstly look at unsorted and sorted arrays &amp;nbsp;It is simple and basic
algorithm with simple two steps.&lt;/span&gt;&lt;o:p style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;/o:p&gt;&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; line-height: normal;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvtKUho3z5LS_aWrVSgJj-GKYP8LxDJTuzvrT8ODkirwA1hCB5MYLffVOfhmxKhlPYJEg399rwiPJbq-gAHQLCspL6GcXxNudLRO-4_N7XOfMMXgoe-5BpZC8T8PvjrpyihIX4x-jgQVqR/s1600/arena.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;200&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvtKUho3z5LS_aWrVSgJj-GKYP8LxDJTuzvrT8ODkirwA1hCB5MYLffVOfhmxKhlPYJEg399rwiPJbq-gAHQLCspL6GcXxNudLRO-4_N7XOfMMXgoe-5BpZC8T8PvjrpyihIX4x-jgQVqR/s200/arena.JPG&quot; width=&quot;165&quot; /&gt;&lt;/a&gt;Comparing
sorted and Unsorted arrays we can see that it can be done using following steps&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;ol start=&quot;1&quot; style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; line-height: normal;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;Find the      smallest element in unsorted array . &lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; font-size: 12pt;&quot;&gt;&amp;nbsp;Place it      (smallest element ) in position a[0] . &lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;This
process is shown in figure below.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;//This code is for
sort&amp;nbsp; first element// 


&lt;div style=&quot;text-indent: 0.5in;&quot;&gt;&amp;nbsp;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Min
= a[0];&lt;/span&gt;&lt;/div&gt;&lt;u1:p style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/u1:p&gt;



&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
for(j=1;j&amp;lt;=n;j++){&lt;/div&gt;&lt;u1:p style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/u1:p&gt;



&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-indent: 0.5in;&quot;&gt;&amp;nbsp;if(a[j]&amp;lt;min){&lt;/div&gt;&lt;u1:p style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;/u1:p&gt;



&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-indent: 0.5in;&quot;&gt;&amp;nbsp;min
= a[j];&lt;u1:p&gt;&lt;/u1:p&gt;}&lt;u1:p&gt;&lt;/u1:p&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-indent: 0.5in;&quot;&gt;&lt;u1:p&gt;&amp;nbsp;a[0]=
min;&lt;/u1:p&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;
&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOINRs99okazjSdBCXIzIwMUj0_s4PPgTkvZiyC3d1qMFyedc6mjSfKrYMfQUfuFZlLB89x_36o3QgYKaWvNfjMZ0_zMh_6y9DrJpAeis9w4MR0maNeG25APuCZPoZo3CjrztR-ZwFdlFc/s1600/untitled5.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHFemkyET3mwLIiZNIyK1IQ4lsjGMtRPHnPCdLkDI65KoJAtid4H8GILR46NzCQyUtXUx0av3JDV0FVv0mAMarDbnjgAEwTPuE4Nyr7la_8knmMIVNvRUiVUw78ndYVHEVAdywTkWUXAbK/s1600/acs.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;203&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHFemkyET3mwLIiZNIyK1IQ4lsjGMtRPHnPCdLkDI65KoJAtid4H8GILR46NzCQyUtXUx0av3JDV0FVv0mAMarDbnjgAEwTPuE4Nyr7la_8knmMIVNvRUiVUw78ndYVHEVAdywTkWUXAbK/s320/acs.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&amp;nbsp;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;From the figure we can see that 3 is to be selected as smallest element and placed into a[0] .But the problem is 20 is missing that was in previous a[0] position.To avoid this problem we will save the element 20 before 3 placing into a[0]. It can done with temporary variable. After placing 3 into a[0], 20 from temporary variable need placed into &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;a[6] &lt;o:p&gt;&lt;/o:p&gt;which is &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;previous position of 3. Now we successfully sort the first element. Figure illustrate the sorted and unsorted parts. We don&#39;t want consider sorted part then. In unsorted part we need to do same process again and again. how can we write general code?.ok..Before general code just look the figure that an array is sorted by selection in step by step. We can easily grasp the algorithm. Also from figure we can see that the array taking 7 steps to sort 8 element array.So in general case we need (n-1) iteration to sort n element array.&amp;nbsp; &lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;







&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt; &lt;/span&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/o:p&gt;&lt;/span&gt;







&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5olKS6bQpyGmIu8_m6_uhFuzPQkqDMi03rXMOeR9YHmgmj6EohZT-rDleXSQAcE07NcCIwzzWEkQsFgdw_xOT2LNr_mXgsBNnOD4kSqqQK02NyHHHryNxpq58_C_vjYv0zN5QOHfs0EHA/s1600/steps.JPG&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5olKS6bQpyGmIu8_m6_uhFuzPQkqDMi03rXMOeR9YHmgmj6EohZT-rDleXSQAcE07NcCIwzzWEkQsFgdw_xOT2LNr_mXgsBNnOD4kSqqQK02NyHHHryNxpq58_C_vjYv0zN5QOHfs0EHA/s1600/steps.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;
   &lt;m:smallfrac m:val=&quot;off&quot;&gt;
   &lt;m:dispdef&gt;
   &lt;m:lmargin m:val=&quot;0&quot;&gt;
   &lt;m:rmargin m:val=&quot;0&quot;&gt;
   &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;
   &lt;m:wrapindent m:val=&quot;1440&quot;&gt;
   &lt;m:intlim m:val=&quot;subSup&quot;&gt;
   &lt;m:narylim m:val=&quot;undOvr&quot;&gt;
  &lt;/m:narylim&gt;&lt;/m:intlim&gt;
&lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:Courier;
	panose-1:2 7 4 9 2 2 5 2 4 4;
	mso-font-alt:&quot;Courier New&quot;;
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-format:other;
	mso-font-pitch:fixed;
	mso-font-signature:3 0 0 0 1 0;}
@font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:&quot;Times New Roman&quot;,&quot;serif&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:608242300;
	mso-list-type:hybrid;
	mso-list-template-ids:-1110961078 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt; 
&lt;/style&gt;&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;
&lt;m:smallfrac m:val=&quot;off&quot;&gt;&lt;m:dispdef&gt;&lt;m:lmargin m:val=&quot;0&quot;&gt;&lt;m:rmargin m:val=&quot;0&quot;&gt;&lt;m:defjc m:val=&quot;centerGroup&quot;&gt;&lt;b&gt;&lt;u&gt;&amp;nbsp;Algorithm Description:&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/b&gt;&amp;nbsp;
&lt;u1:p&gt;&amp;nbsp;&lt;/u1:p&gt;&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;

&lt;m:smallfrac m:val=&quot;off&quot;&gt;&lt;m:dispdef&gt;&lt;m:lmargin m:val=&quot;0&quot;&gt;&lt;m:rmargin m:val=&quot;0&quot;&gt;&lt;m:defjc m:val=&quot;centerGroup&quot;&gt;&lt;u1:p&gt;While there are still elements
in the unsorted part of the array do&lt;/u1:p&gt; &lt;u1:p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/u1:p&gt;
&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;

&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Find the minimum and place it as first element in
unsorted part of array a[n]. &lt;u1:p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/u1:p&gt;&lt;/div&gt;&lt;div style=&quot;margin-left: 0.5in; text-indent: -0.25in;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Exchange the min in the unsorted of the array with the
first element a[i] in the unsorted array. &lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;b&gt;&lt;u1:p&gt;&amp;nbsp;&lt;/u1:p&gt;&lt;/b&gt;&lt;/div&gt;&lt;b&gt;&lt;u1:p&gt;&amp;nbsp;&lt;/u1:p&gt;&lt;/b&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;u1:p&gt;Implementation in C:&lt;/u1:p&gt;&lt;/u&gt;&lt;/b&gt; 

&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;for(i=0;i&amp;lt;=n-2;i++){&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;u1:p&gt;
&lt;/u1:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
&lt;b&gt;&amp;nbsp; min=a[i];&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;
&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;
for(j=i+1;j&amp;lt;=n;j++){&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;
if(a[j]&amp;lt;min){&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; min=a[j];&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;u1:p&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/u1:p&gt;&lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;
&lt;u1:p&gt;&lt;b&gt;&amp;nbsp; a[i]=min;&lt;/b&gt;&lt;/u1:p&gt;&lt;o:p&gt;&lt;/o:p&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;

&lt;b&gt;&lt;span style=&quot;font-family: Courier; font-size: 11pt; line-height: 115%;&quot;&gt;&lt;u1:p&gt;}}&lt;/u1:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; line-height: 115%;&quot;&gt; &lt;b&gt;&lt;u1:p&gt;&amp;nbsp; &amp;nbsp;&lt;/u1:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/8637751723221888492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/08/sorting-by-selection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/8637751723221888492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/8637751723221888492'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/08/sorting-by-selection.html' title='Sorting by Selection'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvtKUho3z5LS_aWrVSgJj-GKYP8LxDJTuzvrT8ODkirwA1hCB5MYLffVOfhmxKhlPYJEg399rwiPJbq-gAHQLCspL6GcXxNudLRO-4_N7XOfMMXgoe-5BpZC8T8PvjrpyihIX4x-jgQVqR/s72-c/arena.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-742803658241570386</id><published>2011-08-08T08:11:00.001+05:30</published><updated>2011-08-10T15:18:17.558+05:30</updated><title type='text'>Google page rank algorithm</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;The original PageRank algorithm was described by Lawrence Page and  Sergey Brin in several publications. It is given by&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikV7Beiiptd4hfiex8J6jD44C8vIvlpY31GzmFXKjFBQfY9NN33YOzRPzEK8qP57RFoLO1OTaD8vzwRl-R9yjPshbaDtd7gzZYvqrZcdGbxLL4MDclapPUakOII9pFaZ7L2n-Sz2XSqf-o/s1600/google-pagerank.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikV7Beiiptd4hfiex8J6jD44C8vIvlpY31GzmFXKjFBQfY9NN33YOzRPzEK8qP57RFoLO1OTaD8vzwRl-R9yjPshbaDtd7gzZYvqrZcdGbxLL4MDclapPUakOII9pFaZ7L2n-Sz2XSqf-o/s1600/google-pagerank.png&quot; /&gt;&lt;/a&gt;&lt;b&gt;PR(A) = (1-d) + d (PR(T1)/C(T1) + ... + PR(Tn)/C(Tn))&lt;/b&gt;&lt;br /&gt;
where&lt;br /&gt;
&lt;table&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td class=&quot;list&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://pr.efactory.de/i/dot.gif&quot; /&gt;&lt;/td&gt;&lt;td style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;PR(A)&lt;/b&gt; is the  PageRank of page A,&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;list&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://pr.efactory.de/i/dot.gif&quot; /&gt;&lt;/td&gt;&lt;td style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;PR(Ti)&lt;/b&gt; is the  PageRank of pages Ti which link to page A,&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;list&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://pr.efactory.de/i/dot.gif&quot; /&gt;&lt;/td&gt;&lt;td style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;C(Ti)&lt;/b&gt; is the  number of outbound links on page Ti and&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;list&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://pr.efactory.de/i/dot.gif&quot; /&gt;&lt;/td&gt;&lt;td style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;d&lt;/b&gt; is a damping  factor which can be set between 0 and 1.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/742803658241570386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/08/google-pagr-rank-algorithm.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/742803658241570386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/742803658241570386'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/08/google-pagr-rank-algorithm.html' title='Google page rank algorithm'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikV7Beiiptd4hfiex8J6jD44C8vIvlpY31GzmFXKjFBQfY9NN33YOzRPzEK8qP57RFoLO1OTaD8vzwRl-R9yjPshbaDtd7gzZYvqrZcdGbxLL4MDclapPUakOII9pFaZ7L2n-Sz2XSqf-o/s72-c/google-pagerank.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-2748564113717647759</id><published>2011-08-06T07:18:00.000+05:30</published><updated>2011-08-06T07:18:53.958+05:30</updated><title type='text'>Algorithm to find smallest divisor of an integer</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:11492621;
	mso-list-type:hybrid;
	mso-list-template-ids:1551271990 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:Symbol;}
@list l0:level2
	{mso-level-number-format:bullet;
	mso-level-text:o;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;
	font-family:&quot;Courier New&quot;;}
@list l1
	{mso-list-id:267737185;
	mso-list-type:hybrid;
	mso-list-template-ids:-1522382848 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l1:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp; To find smallest divisor of an integer n is very straight forward. Just take the numbers 2, 3, 4, …,n and divide n with each of number in ascending order. But not efficient method, &amp;nbsp;because it need more iteration ( loops) .&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;To efficiently calculate this problem we must reduce the loops by various techniques. And are follows.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraph&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;color: #404040; font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;All exact divisors of an integer are paired. What it means?. Nothing !. &amp;nbsp;for example&amp;nbsp; an integer 24 have following divisors&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2, 3, 4, 6, 8, 12. And each divisor have pair.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Here 2 and 12 are paired. In other word &amp;nbsp;they are linked because &amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24/2&amp;nbsp;&amp;nbsp; = &amp;nbsp;&amp;nbsp;12&lt;/span&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt; ;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;2, 12 are smaller and bigger factors &amp;nbsp;respectively .&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Same way&amp;nbsp; 3&amp;nbsp; and 8 are paired,&amp;nbsp;&amp;nbsp;&amp;nbsp; i.e. &amp;nbsp;(24/3&amp;nbsp;&amp;nbsp;&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp; 8;) &lt;/span&gt;&lt;span style=&quot;color: #404040; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;and so on.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableLightList&quot; style=&quot;border-collapse: collapse; border: medium none; margin-left: 59.4pt;&quot;&gt;&lt;tbody&gt;
&lt;tr style=&quot;height: 3pt;&quot;&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% black; border-color: black -moz-use-text-color -moz-use-text-color black; border-style: solid none none solid; border-width: 1pt medium medium 1pt; height: 3pt; padding: 0in 5.4pt; width: 189pt;&quot; valign=&quot;top&quot; width=&quot;252&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Smaller factor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% black; border-color: black black -moz-use-text-color -moz-use-text-color; border-style: solid solid none none; border-width: 1pt 1pt medium medium; height: 3pt; padding: 0in 5.4pt; width: 1.5in;&quot; valign=&quot;top&quot; width=&quot;144&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: white; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Bigger factor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: black -moz-use-text-color black black; border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 0in 5.4pt; width: 189pt;&quot; valign=&quot;top&quot; width=&quot;252&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: black black black -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 1.5in;&quot; valign=&quot;top&quot; width=&quot;144&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color -moz-use-text-color -moz-use-text-color black; border-style: none none none solid; border-width: medium medium medium 1pt; padding: 0in 5.4pt; width: 189pt;&quot; valign=&quot;top&quot; width=&quot;252&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color black -moz-use-text-color -moz-use-text-color; border-style: none solid none none; border-width: medium 1pt medium medium; padding: 0in 5.4pt; width: 1.5in;&quot; valign=&quot;top&quot; width=&quot;144&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: black -moz-use-text-color black black; border-style: solid none solid solid; border-width: 1pt medium 1pt 1pt; padding: 0in 5.4pt; width: 189pt;&quot; valign=&quot;top&quot; width=&quot;252&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: black black black -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 1.5in;&quot; valign=&quot;top&quot; width=&quot;144&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #595959;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in;&quot;&gt;&lt;span style=&quot;color: #595959; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Here we can see that smallest divisor 2 is paired with largest divisor 12. 2&lt;sup&gt;nd&lt;/sup&gt; smallest divisor is paired with 2&lt;sup&gt;nd&lt;/sup&gt; largest divisor. And so on . if the integer is 36 we can see divisor 6 is paired with 6 itself. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in;&quot;&gt;&lt;span style=&quot;color: #595959; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;In general &amp;nbsp;case we have to consider only less than or equal to biggest smaller divisor, now the problem!.how can we take that limit?.simple take √n,&amp;nbsp; all smaller divisors of an integer are less &lt;/span&gt;&lt;span style=&quot;color: #595959; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;√n.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraph&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;color: #595959; font-family: Symbol;&quot;&gt;·&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #595959; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;If n is an even number then its&amp;nbsp; smallest divisor is 2. Now we need consider only odd numbers. If we get n is the smallest divisor of n then it’s a prime ,i.e. one is smallest divisor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&lt;span style=&quot;color: #6aa84f;&quot;&gt;Algorithm steps:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Establish the integer n&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;If n is even then 2 is smallest divisor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;a.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Compute &amp;nbsp;r = √n;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;b.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Initialize divisor d = 3;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;c.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;While not an exact divisor and r ≠ √n&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.5in; text-indent: -1.5in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Generate next divisor d in odd sequence by &amp;nbsp;d = d +2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;d.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;If d is exact divisor and d ≠ n, then d is the smallest divisor of n&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-indent: 0.5in;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Else n is prime&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/2748564113717647759/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/08/algorithm-to-find-smallest-divisor-of.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/2748564113717647759'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/2748564113717647759'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/08/algorithm-to-find-smallest-divisor-of.html' title='Algorithm to find smallest divisor of an integer'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-4053549492471494469</id><published>2011-08-01T06:57:00.000+05:30</published><updated>2011-08-01T06:57:56.691+05:30</updated><title type='text'>Counting</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:60569266;
	mso-list-type:hybrid;
	mso-list-template-ids:322488560 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:60569266;
	mso-list-type:hybrid;
	mso-list-template-ids:322488560 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Problem&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Given a set of &lt;i&gt;n&lt;/i&gt; students ‘s &amp;nbsp;examination marks &amp;nbsp;(in range 0 to100) make account of number of students that passed in the examination. A pass is awarded for all marks of 50 and above.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Algorithm development&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Counting mechanism are very frequently used in computer algorithms. Generally a count must be made of number of item in a set which possess some particular property or which satisfy some particular condition or conditions. This class problem is typified by the “examination marks” problem.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;As starting point for developing computer algorithm for this problem we can consider how we might solve a particular example by hand. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Suppose that we are given set of marks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 1in; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;55, 42, 77, 29, 57, 89&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;To make the count of passes for this set we can start at the left , examine the first mark (55), see if it is ≥50,and remember that one student has passed so far.&amp;nbsp; The second mark is then examined and no adjustment is made to the count . &amp;nbsp;when we arrive at the third mark we is it is ≥50 and so we add one to our previous &amp;nbsp;count. The process &amp;nbsp;continues in similar manner until all marks have been tested.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;In more detail we have:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableLightShading&quot; style=&quot;border-collapse: collapse; border: medium none;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td rowspan=&quot;8&quot; style=&quot;border-color: black -moz-use-text-color; border-style: solid none; border-width: 1pt medium; padding: 0in 5.4pt; width: 117.9pt;&quot; valign=&quot;top&quot; width=&quot;157&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;Order in which marks are   examined&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: black -moz-use-text-color; border-style: solid none; border-width: 1pt medium; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Marks &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: black -moz-use-text-color; border-style: solid none; border-width: 1pt medium; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;Counting details for passes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border: medium none; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 55&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border: medium none; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 0 &amp;nbsp;current count = 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border: medium none; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border: medium none; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 1 &amp;nbsp;current count = 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border: medium none; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 77&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border: medium none; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 1 &amp;nbsp;current count = 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border: medium none; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 63&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border: medium none; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 2 &amp;nbsp;current count = 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border: medium none; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 29&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border: medium none; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 3 &amp;nbsp;current count = 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border: medium none; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 57&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border: medium none; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 3 &amp;nbsp;current count = 4&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border-color: -moz-use-text-color -moz-use-text-color black; border-style: none none solid; border-width: medium medium 1pt; padding: 0in 5.4pt; width: 85.5pt;&quot; valign=&quot;top&quot; width=&quot;114&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 89&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% silver; border-color: -moz-use-text-color -moz-use-text-color black; border-style: none none solid; border-width: medium medium 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;color: black; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;Previous count = 4 &amp;nbsp;current count = 5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;After each mark has been processed the current count reflect the no of students that have passed in the marks list so far encountered &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;We must now ask, how can the counting&amp;nbsp; be achieved ? from our example of above we see that every time we need increase the count we build on the previous value. That is &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;Current _count&amp;nbsp; = &amp;nbsp;previous_count +1&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;When for example &amp;nbsp;we arrive at mark 57, we have&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;Previou_count = 3&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Current_count&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt; therefore becomes 4. &amp;nbsp;This means that when ever a new &lt;i&gt;current_count&lt;/i&gt; is generated it must then assumed the role of &lt;i&gt;previous_count&lt;/i&gt; before the next mark is considered. The two step in this process can be represented by&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;Current_count &amp;nbsp;= &amp;nbsp;previous_count + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;i&gt;&lt;span style=&quot;background: none repeat scroll 0% 0% yellow; font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; previous_count &amp;nbsp;= &amp;nbsp;Current_count&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;;&quot;&gt;algorithm description&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Prompt then read the number of marks to be processed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Initialize the count to zero.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;While there are still marks to be processed repeatedly do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;a.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Read next mark,&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;b.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;If it is pass (i.e. ≥50) then add one to count.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;Write out total number of passes.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;  &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/4053549492471494469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/07/counting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/4053549492471494469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/4053549492471494469'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/07/counting.html' title='Counting'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-7758036462405383775</id><published>2011-07-30T11:12:00.000+05:30</published><updated>2011-07-30T11:12:54.844+05:30</updated><title type='text'>Counting Sort</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:1661738005;
	mso-list-template-ids:918061978;}
@list l1
	{mso-list-id:1954290817;
	mso-list-template-ids:-1008424768;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; line-height: normal;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; C&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;ounting sort assumes that each of the elements is an integer in the range 1 to &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;k&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;, for some integer &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;k&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;. When &lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;k = O(n)&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;, the Counting-sort runs in &lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;O(n)&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt; time. The basic idea&lt;span style=&quot;color: magenta;&quot;&gt; &lt;/span&gt;of Counting sort is to determine, for each input elements &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;x&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;, the number of elements less than &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;x&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;. This information can be used to place directly into its correct position. For example, if there 17 elements less than &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;x&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;, than &lt;/span&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt; belongs in output position 18.&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; line-height: normal;&quot;&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;In the code for Counting sort, we are given array &lt;/span&gt;&lt;span style=&quot;font-size: 16pt;&quot;&gt;A[1 . . n]&lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt; of length &lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-size: 18pt;&quot;&gt;n&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-size: 13.5pt;&quot;&gt;. We required two more arrays, the array &lt;i&gt;B&lt;/i&gt;[1 . . &lt;i&gt;n&lt;/i&gt;] holds the sorted output and the array &lt;i&gt;c&lt;/i&gt;[1 . . &lt;i&gt;k&lt;/i&gt;] provides temporary working storage.&lt;/span&gt;&lt;span style=&quot;font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; COUNTING_SORT&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 18pt;&quot;&gt; (&lt;i&gt;A&lt;/i&gt;, &lt;i&gt;B&lt;/i&gt;, &lt;i&gt;k&lt;/i&gt;)&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;for &lt;i&gt;i&lt;/i&gt; ← 1 to &lt;i&gt;k&lt;/i&gt; do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;[&lt;i&gt;i&lt;/i&gt;] ← 0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;for &lt;i&gt;j&lt;/i&gt; ← 1 to &lt;i&gt;n&lt;/i&gt; do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;4.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;[A[&lt;i&gt;j&lt;/i&gt;]] ← &lt;i&gt;c&lt;/i&gt;[A[&lt;i&gt;j&lt;/i&gt;]] + 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;5.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;//c[&lt;i&gt;i&lt;/i&gt;] now contains the number of elements equal to &lt;i&gt;i&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;6.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;for &lt;i&gt;i&lt;/i&gt; ← 2 to &lt;i&gt;k&lt;/i&gt; do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;7.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[&lt;i&gt;i&lt;/i&gt;] ← c[&lt;i&gt;i&lt;/i&gt;] + c[&lt;i&gt;i&lt;/i&gt;-1]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;8.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;// c[&lt;i&gt;i&lt;/i&gt;] now contains the number of elements ≤ &lt;i&gt;i&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;9.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;for j ← &lt;i&gt;n&lt;/i&gt; downto 1 do&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;10.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; B[c[A[&lt;i&gt;i&lt;/i&gt;]]] ← A[&lt;i&gt;j&lt;/i&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 2in; text-indent: -0.25in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;11.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 14pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c[A[&lt;i&gt;i&lt;/i&gt;]] ← c[A[&lt;i&gt;j&lt;/i&gt;]] - 1&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;Each line below shows the step by step operation of counting sort.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;width: 80%;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;A&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;C&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;width: 42%;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp;C&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;width: 80%;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;C&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;width: 80%;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;C&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;6&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;width: 80%;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 5%;&quot; width=&quot;5%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;/td&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;C&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;7&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;width: 54%;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;B&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp;3&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;background: none repeat scroll 0% 0% yellow; padding: 0.75pt; width: 6%;&quot; width=&quot;6%&quot;&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&amp;nbsp;6&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 18pt;&quot;&gt;Analysis&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;ol start=&quot;1&quot; type=&quot;1&quot;&gt;&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;The loop of lines 1-2&amp;nbsp;&amp;nbsp; takes &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(&lt;i&gt;k&lt;/i&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;      time&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;The loop of lines 3-4&amp;nbsp;&amp;nbsp; takes &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(&lt;i&gt;n&lt;/i&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;      time&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;The loop of lines 6-7&amp;nbsp;&amp;nbsp; takes &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(&lt;i&gt;k&lt;/i&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;      time&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;The loop of lines 9-11 takes &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(&lt;i&gt;n&lt;/i&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;      time&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;Therefore, the overall time of the counting sort is &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(&lt;i&gt;k&lt;/i&gt;)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 18pt;&quot;&gt; + &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(n) + O(k) + O(n)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 18pt;&quot;&gt; = &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(k + n)&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;In practice, we usually use counting sort algorithm when have &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;k = O(n),&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; in which case running time is &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;O(n).&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;The Counting sort is a stable sort i.e., multiple keys with the same value are placed in the sorted array in the same order that they appear in the input array.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;Suppose that the for-loop in line 9 of the Counting sort is rewritten:&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;line-height: normal; text-align: center;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp; for j ← 1 to n &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;then the stability no longer holds. Notice that the correctness of argument in the CLR does not depend on the order in which array &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;A[1 . . n]&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; is processed. The algorithm is correct no matter what order is used. In particular, the modified algorithm still places the elements with value&lt;i&gt; &lt;/i&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 18pt;&quot;&gt;k&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; in position &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;c[k - 1] + 1&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; through &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;c[k],&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; but in reverse order of their appearance in &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;A[1 . . n].&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt;Note that Counting sort beats the lower bound of&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 16pt;&quot;&gt;Ω(n lg n),&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 13.5pt;&quot;&gt; because it is not a comparison sort. There is no comparison between elements. Counting sort uses the actual values of the elements to index into an array.&lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;,&amp;quot;serif&amp;quot;; font-size: 12pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/7758036462405383775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/07/counting-sort.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/7758036462405383775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/7758036462405383775'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/07/counting-sort.html' title='Counting Sort'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-3696511525452681974</id><published>2011-07-25T16:02:00.000+05:30</published><updated>2011-07-25T16:02:01.097+05:30</updated><title type='text'>Algorithm to Generate Prime Numbers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:0in;
	margin-left:.5in;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:.5in;
	mso-add-space:auto;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:677854490;
	mso-list-type:hybrid;
	mso-list-template-ids:-1290792630 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level2
	{mso-level-number-format:alpha-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
@list l0:level3
	{mso-level-number-format:roman-lower;
	mso-level-tab-stop:none;
	mso-level-number-position:right;
	text-indent:-9.0pt;}
@list l0:level4
	{mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-.25in;}
ol
	{margin-bottom:0in;}
ul
	{margin-bottom:0in;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent: -0.25in;&quot;&gt;&lt;b&gt;Algorithm Description &lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot; style=&quot;text-indent: -0.25in;&quot;&gt;1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Initialize and write out the first three primes . Also initialize the square of the 3&lt;sup&gt;rd&lt;/sup&gt; prime.&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Initialize &lt;i&gt;x &lt;/i&gt;to 5.&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;text-indent: -0.25in;&quot;&gt;3.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;While &amp;nbsp;x less than n do&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;a.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Get next x value excluding multiple of 2 and 3&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;b.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If not past end of multiple then&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.5in; text-indent: -1.5in;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If x≥ square of largest prime then&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 2in; text-indent: -0.25in;&quot;&gt;1.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Include next prime multiple as its square,&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 2in; text-indent: -0.25in;&quot;&gt;2.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Update square by squaring next prime &amp;nbsp;&amp;gt; √x.&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;c.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;While have not established x is non prime with valid prime multiples do &lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.5in; text-indent: -1.5in;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;While current prime multiple is less than x ,increment by current prime value doubled,&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1.5in; text-indent: -1.5in;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;ii.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Do prime test by comparing x with current multiple;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot; style=&quot;margin-left: 1in; text-indent: -0.25in;&quot;&gt;d.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;If current x prime then&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot; style=&quot;margin-left: 1.5in; text-indent: -1.5in;&quot;&gt;&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;i.&lt;span style=&quot;font: 7pt &amp;quot;Times New Roman&amp;quot;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Write out x and if it is less than √n store it&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/3696511525452681974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/07/algorithm-to-generate-prime-numbers.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/3696511525452681974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/3696511525452681974'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/07/algorithm-to-generate-prime-numbers.html' title='Algorithm to Generate Prime Numbers'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-8293510395899896617</id><published>2011-07-24T21:33:00.000+05:30</published><updated>2011-07-24T21:33:19.080+05:30</updated><title type='text'>Find largest number in a list</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_editdata.mso&quot; rel=&quot;Edit-Time-Data&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:&quot;Times New Roman&quot;;
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;&lt;b&gt;Algorithm&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;Step 1:&amp;nbsp; Establish an array a[0],a[1],….a[N-1]&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where &amp;nbsp; n≥1.&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;Step2:&amp;nbsp;&amp;nbsp; Set &amp;nbsp;temporory largest to first array element. &amp;nbsp;Ie&amp;nbsp; a[0].&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;Step3:&amp;nbsp;&amp;nbsp; While less than N array elements have been considered &amp;nbsp;do&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 0.25in; text-indent: 0.5in;&quot;&gt;If next element is greater &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-left: 0.25in; text-indent: 0.5in;&quot;&gt;than &amp;nbsp;current maximum large then assign it to large&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal;&quot;&gt;Step4:&amp;nbsp;&amp;nbsp; Return maximum large for the array of n elements&lt;/div&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; line-height: 115%;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxsNbGS37Vq4EPL3Cj67ND3mFeOZDBMI3R2RM3BWj43Sr1pKcb3Z5oJTCniBobabV0rOZ50Y3H5yzbUv1kHNaObjfLnjKMBFzYqbntlVkZVUpYg7iNM-DDbnP9SnJHZREYqdFQZ1yvoWze/s1600/find-largest-number.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxsNbGS37Vq4EPL3Cj67ND3mFeOZDBMI3R2RM3BWj43Sr1pKcb3Z5oJTCniBobabV0rOZ50Y3H5yzbUv1kHNaObjfLnjKMBFzYqbntlVkZVUpYg7iNM-DDbnP9SnJHZREYqdFQZ1yvoWze/s640/find-largest-number.png&quot; width=&quot;443&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;C implementation &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;#include&lt;/span&gt;&amp;lt;stdio.h&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;int&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; &lt;b&gt;main&lt;/b&gt;(){&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;b&gt;int&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; a[50],size,i,big;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; printf(&lt;/span&gt;&quot;\n Enter the size of the array: &quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;);&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; scanf(&lt;/span&gt;&quot;%d&quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;,&amp;amp;size);&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; printf(&lt;/span&gt;&quot;\n Enter %d elements in to the array: ”, size);&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;b&gt;for&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;(i=0;i&amp;lt;size;i++)&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp; scanf(&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&quot;%d&quot;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;,&amp;amp;a[i]);&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; big=a[0];&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;b&gt;for&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;(i=1;i&amp;lt;size;i++){&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp; &lt;/span&gt;&lt;b&gt;if&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;(big&amp;lt;a[i])&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &amp;nbsp; big=a[i];&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; }&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; printf(&lt;/span&gt;&quot;\n Biggest: %d&quot;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;,big);&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: black; line-height: normal; margin-bottom: 0in;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;b&gt;return&lt;/b&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt; 0;&lt;/span&gt;&lt;span style=&quot;font-family: &#39;Courier New&#39;;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;color: black; font-family: &#39;Courier New&#39;; line-height: 115%;&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/8293510395899896617/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/07/find-largest-number-in-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/8293510395899896617'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/8293510395899896617'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/07/find-largest-number-in-list.html' title='Find largest number in a list'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxsNbGS37Vq4EPL3Cj67ND3mFeOZDBMI3R2RM3BWj43Sr1pKcb3Z5oJTCniBobabV0rOZ50Y3H5yzbUv1kHNaObjfLnjKMBFzYqbntlVkZVUpYg7iNM-DDbnP9SnJHZREYqdFQZ1yvoWze/s72-c/find-largest-number.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-4468942240505466810</id><published>2011-07-23T22:01:00.001+05:30</published><updated>2011-08-05T19:18:59.957+05:30</updated><title type='text'>Generation Of Pseudo-Random Numbers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;
	mso-bidi-font-family:&quot;Times New Roman&quot;;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-size:10.0pt;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	mso-ascii-font-family:Calibri;
	mso-hansi-font-family:Calibri;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div&gt;&lt;table align=&quot;left&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; height=&quot;25&quot; hspace=&quot;0&quot; vspace=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td align=&quot;left&quot; height=&quot;25&quot; style=&quot;padding: 0in;&quot; valign=&quot;top&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml&quot; rel=&quot;File-List&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx&quot; rel=&quot;themeData&quot;&gt;&lt;/link&gt;&lt;link href=&quot;file:///C:%5CDOCUME%7E1%5CADMINI%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml&quot; rel=&quot;colorSchemeMapping&quot;&gt;&lt;/link&gt;    &lt;m:smallfrac m:val=&quot;off&quot;&gt;    &lt;m:dispdef&gt;    &lt;m:lmargin m:val=&quot;0&quot;&gt;    &lt;m:rmargin m:val=&quot;0&quot;&gt;    &lt;m:defjc m:val=&quot;centerGroup&quot;&gt;    &lt;m:wrapindent m:val=&quot;1440&quot;&gt;    &lt;m:intlim m:val=&quot;subSup&quot;&gt;    &lt;m:narylim m:val=&quot;undOvr&quot;&gt;   &lt;/m:narylim&gt;&lt;/m:intlim&gt; &lt;/m:wrapindent&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:&quot;Cambria Math&quot;;
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:&quot;&quot;;
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
	mso-fareast-font-family:&quot;Times New Roman&quot;;
	mso-bidi-font-family:&quot;Times New Roman&quot;;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	font-size:10.0pt;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	mso-ascii-font-family:Calibri;
	mso-hansi-font-family:Calibri;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;  &lt;/m:defjc&gt;&lt;/m:rmargin&gt;&lt;/m:lmargin&gt;&lt;/m:dispdef&gt;&lt;/m:smallfrac&gt;&lt;br /&gt;
&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Random number generators are frequently used in computing for among other things, testing and analyzing the behavior of algorithms. A sequence of random numbers should exhibit the following behavior.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;1. The sequence should appear as though each number had occurred by chance .&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;2. Each number should have a specified probability of falling with in a given range.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;The approach is generally taken in computing science for random number generation is to simulate random process by deterministically producing a sequence of number that appear to exhibit random behavior. These sequence are predictable in advance and for this reason they are usually referred to as pseudo random sequences. There are many methods to generating pseudo random numbers. Perhaps the most widely used of these algorithms is the linear congruential method. When this method is approximately parameterized it will generate pseudo random sequences that for practical purposes, satisfy statistical criteria required of uniformly distributed random variables. In uniform distribution each possible number is equally probable.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;The implementation of linear congruential method is very straightforward. Successive members of the linear congruential sequence {x} are generated using expression&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;X&lt;sub&gt;n+1&lt;/sub&gt; &amp;nbsp;= &amp;nbsp;(ax&lt;sub&gt;n&lt;/sub&gt;+b) &lt;b&gt;mod&lt;/b&gt; m &amp;nbsp;&amp;nbsp;&amp;nbsp;for n ≥0&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Where parameters a, b, m and x&lt;sub&gt;0 &lt;/sub&gt;must be carefully chosen in advance according to certain criteria. The parameters a , b and m are referred to as the multiplier ,increment and modulus respectively. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; All parameters should be integers greater than or equal to zero and m should be greater than x&lt;sub&gt;0&lt;/sub&gt; ,a ,and b.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Parameter &lt;i&gt;x&lt;sub&gt;0&lt;/sub&gt;&lt;/i&gt;&lt;sub&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/sub&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;The parameter &amp;nbsp;x&lt;sub&gt;0 &amp;nbsp;&lt;/sub&gt;can be chosen&lt;sub&gt; &lt;/sub&gt;&amp;nbsp;arbitrarily within the range &lt;i&gt;0 ≤ x&lt;sub&gt;0 &lt;/sub&gt;&amp;lt; m.&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Parameter m&lt;sub&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/sub&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;The value of m should be greater than or equal to the length of random sequence required. In addition it must be possible to do the computation (a*x+b) mod m without round off.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Parameter a&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;The choice of a depends on choice of m. If m is a power of 2 then a should &amp;nbsp;be satisfy the condition: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;a &lt;b&gt;mod&lt;/b&gt; 8 = 5&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;If m is power of 10 ,then a should be chosen such that :&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0.0001pt 0.5in; text-indent: 0.5in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0.0001pt 1.5in; text-indent: 0.5in;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;a &lt;b&gt;mode&lt;/b&gt; 200 = 21&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin: 0in 0in 0.0001pt 1.5in; text-indent: 0.5in;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Further requirement on a are that it should be larger than √m and less than m - √m , (a -1) should be a multiple of every prime dividing to m, and m is multiple of 4 then (a -1) should be multiple of 4.these conditions together with the requirement that b should be relatively prime to m are needed to guarantee that the sequence has period of m.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;Parameter b&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;The constant b should be odd and not multiple of 5.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;line-height: normal; margin-bottom: 0.0001pt;&quot;&gt;&lt;span style=&quot;font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/4468942240505466810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2011/07/generation-of-psedo-random-numbers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/4468942240505466810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/4468942240505466810'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2011/07/generation-of-psedo-random-numbers.html' title='Generation Of Pseudo-Random Numbers'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-3639548493993943436</id><published>2010-12-03T20:37:00.000+05:30</published><updated>2010-12-16T18:42:40.027+05:30</updated><title type='text'>Algorithm To Find Square Root Of A Number</title><content type='html'>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Algorithm to find square root of a number is absolutely a Guess work. To improve our algorithm we must start with simple examples. we know that square root of&amp;nbsp; &lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;4&lt;/span&gt; is 2, square root of&amp;nbsp; 9 is 3 so on.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i.e&amp;nbsp; 4 = 2*2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 9 = 3*3&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; so we can generate a general formula from above equations .if x is the square root of&amp;nbsp; y .then the general formula is ,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x * x&amp;nbsp; = y&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Next step to our algorithm is guessing. For example we want to find square root of&amp;nbsp; 36. We guess 9 is the square root of 36.Using our general equation ,9*9 = 81 and is greater than 36. So decrease 1 from guessed square root .&amp;nbsp; i.e 8 * 8 = 64 which is also greater than the 36 but closer ,So decrease 1.&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Now it can be generalize . choose a number x which must be less y which is the number to find square root.&lt;br /&gt;
if square of x is greater than y ,then decrease x by 1.Then the &lt;i&gt;x&lt;/i&gt;² is less than y increase &lt;i&gt;x&lt;/i&gt; by 0.1. Then x² is greater than y increase x by 0.01 and so on until we get the &lt;i&gt;x&lt;/i&gt;² = &lt;i&gt;y&lt;/i&gt; approx.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; The above method is so expansive because the huge number of&amp;nbsp; iteration. if&amp;nbsp; y is greater then more iteration will be needed. So we must find an alternative method.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; For best way,Consider example of 36, the first guess is 9 and its square is 81 which is greater than 36. Now we divide 36 with 9 give 4.And we choose it as second guessing square root. but 4² is less than 36.But we know that the exact square root is in between 4 and 9.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;(9 + 4)&lt;/u&gt;&amp;nbsp; =6.5&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; So the next step of algorithm is to find the average of 4 and 9 .which is to be 6.5. Now&amp;nbsp; take square of 6.5 ,6.5² =42.25 which is greater than 36 .i.e Divide 6.5 into 36.which give 5.53. we can see that 5.53² is less than 36.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Now take average of&amp;nbsp; previous two guess roots&amp;nbsp; as by previously.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;( 6.5 + 5.53 )&lt;/u&gt;&amp;nbsp;&amp;nbsp; = 6.015&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2&lt;br /&gt;
&amp;nbsp; Now 6.015² = 36.6025 which has only slight difference with 36. repeat the step of averaging until to get the more approx square root. So by this method we get root with few iteration.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; Next step is the generalization of algorithm.if&amp;nbsp; &lt;i&gt;f1&lt;/i&gt;&amp;nbsp; is the initial guess ,in our example &lt;i&gt;f1&lt;/i&gt; = 9&amp;nbsp; .i.e general case of complementary value (36/9&amp;nbsp; = 4 ) is&amp;nbsp; y/&lt;i&gt;f1&lt;/i&gt;.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Average of initial guess and complementary value give next approx root &lt;i&gt;f2&lt;/i&gt;.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;i&gt;f2&amp;nbsp;&lt;/i&gt; =&amp;nbsp; ( &lt;i&gt;f1&lt;/i&gt; + (y/&lt;i&gt;f1&lt;/i&gt; )) / 2&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Our &lt;i&gt;f2&lt;/i&gt; = 6.5,we must repeat the above step, So we assume &lt;i&gt;f2&lt;/i&gt; as &lt;i&gt;f1&lt;/i&gt;&amp;nbsp; .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  &lt;i&gt;f2&amp;nbsp;&lt;/i&gt; =&amp;nbsp; ( &lt;i&gt;f1&lt;/i&gt; + (y/&lt;i&gt;f1&lt;/i&gt; )) / 2&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;i&gt;&amp;nbsp;&amp;nbsp; f1&amp;nbsp; =&amp;nbsp; f2&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Last step of our algorithm is termination of&amp;nbsp; loop. To terminate the loop ,we must set condition .which is the difference between f1 and f2 less than some value (such as0.0001). Take y/2 as initial guess which decrease.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/3639548493993943436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/12/algorithm-to-find-squre-root-of-number.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/3639548493993943436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/3639548493993943436'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/12/algorithm-to-find-squre-root-of-number.html' title='Algorithm To Find Square Root Of A Number'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-4320046604998730330</id><published>2010-11-25T07:57:00.000+05:30</published><updated>2010-11-27T19:17:41.663+05:30</updated><title type='text'>Two Way merging</title><content type='html'>&amp;nbsp; Merging is the process to be used for organizing data. here explain   two way merging technique or merge two array of integers , both with   with their elements have in ascending order array&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Consider two   array with ascending order elements a and b have l and m elements   respectively &lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNhRX7nPKZ5XGQsvuL-X5QBTCSIHv98J0sH0hmWZjq63vYyHWXRybSxv1Sc4vDA2uowzj4zhKOOHZs_5ZV6foJpBi7RxuzCXB-iyFSCa7R1geeYuGbP_PZSHuNy4KFedG0w9Zkvicg5qmf/s1600/pic+1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;126&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNhRX7nPKZ5XGQsvuL-X5QBTCSIHv98J0sH0hmWZjq63vYyHWXRybSxv1Sc4vDA2uowzj4zhKOOHZs_5ZV6foJpBi7RxuzCXB-iyFSCa7R1geeYuGbP_PZSHuNy4KFedG0w9Zkvicg5qmf/s320/pic+1.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After   emerging we get a single merged array c with&amp;nbsp; ascending order  elements.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnH45hNpfLC6Ml9WpFcy0JauttleJ_NHjLQg_lew-4rFurY-6MInyw1uxnQCBazG4fy5narxWByTq1HaNWhubdr1bJIINpNG-YR-Shsq6uEXCfW7VwkCN-_GN3OoR6H1fM_4gy26J5j788/s1600/pic-2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;65&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnH45hNpfLC6Ml9WpFcy0JauttleJ_NHjLQg_lew-4rFurY-6MInyw1uxnQCBazG4fy5narxWByTq1HaNWhubdr1bJIINpNG-YR-Shsq6uEXCfW7VwkCN-_GN3OoR6H1fM_4gy26J5j788/s320/pic-2.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   Now the question.How can we create emerging array generally? To   evaluate this we simply take two single elements arrays a and b&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivreKUkWIeyFBLWgK_E1fDxHCaEobA7bUAKXfFdAq-ddfXEEEvdqQCwlAr2DG_pbyHdio0K_tInXcyzd30dj3Wq_3P7UALj6-MiC2xR2n3FnMBxCNtlFtz-hKEbpBbnucxfNdpbm9uVdkG/s1600/pic3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;70&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivreKUkWIeyFBLWgK_E1fDxHCaEobA7bUAKXfFdAq-ddfXEEEvdqQCwlAr2DG_pbyHdio0K_tInXcyzd30dj3Wq_3P7UALj6-MiC2xR2n3FnMBxCNtlFtz-hKEbpBbnucxfNdpbm9uVdkG/s200/pic3.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;   Compare a and b and move smaller value into c. In this 7 is less than   15 so 7 move to c array as first element then 15. so 7 is go in to c[1]   and 15 is to c[2].&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIqGLhHAfFwXkN8z25BL26bjPIZwNuVucM6aB5uBrq1oZWE3Vd-8Cs_VUVsb_zbjliqzi9_R7swejViMeoLILfnIowUsR62IBUVVLHP1hswZBtXO9TKV6ZI_nQpDTC5jpdeomwsRP-EGmm/s1600/new.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;62&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIqGLhHAfFwXkN8z25BL26bjPIZwNuVucM6aB5uBrq1oZWE3Vd-8Cs_VUVsb_zbjliqzi9_R7swejViMeoLILfnIowUsR62IBUVVLHP1hswZBtXO9TKV6ZI_nQpDTC5jpdeomwsRP-EGmm/s200/new.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;   &amp;nbsp;&amp;nbsp; Now we can able to create start to first problem with m and l   elements. The comparison between a[1] and b[1] set c[1]. so in our case   b[1] is go to c[1].so next we compare a[1] and b[2]. and less element   going &lt;br /&gt;
c[2] and so on.&lt;br /&gt;
&lt;br /&gt;
&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqADbY_KwyUb4a1hhM44fyVLzliVRD8zc09qTJ7SYa7OS6m9jlZJQbwck73QwOtrWPDH05dS3Mfmtav6IHuniRrHPjn61kCExsIywhOvYmpe5MqA5HF7hyhxNc4_v-kJvG3gLzW_huLe-I/s1600/4x.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqADbY_KwyUb4a1hhM44fyVLzliVRD8zc09qTJ7SYa7OS6m9jlZJQbwck73QwOtrWPDH05dS3Mfmtav6IHuniRrHPjn61kCExsIywhOvYmpe5MqA5HF7hyhxNc4_v-kJvG3gLzW_huLe-I/s400/4x.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;tr-caption&quot; style=&quot;text-align: center;&quot;&gt;Merging Process&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If we   follow the step by step merging ,we may get run out of element in one of   an array and we can&#39;t make comparison between elements in the two   arrays.i.e we must have a way to detecting one of array runs out. so   here is the method,&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;while((i&amp;lt;=l)&amp;amp;&amp;amp;(j&amp;lt;=m)){&lt;/b&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt;Compare a[i] and b[j] and merge.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt;Increment appropriate pointers.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; if(i&amp;lt;l)&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt;Copy the rest of a array elements in to c in order.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;   else&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;=&amp;gt;Copy rest of b array  elements  into c in order.&lt;/b&gt;&lt;/div&gt;For easy implementation we  use an  alternate method,The largest element in two arrays is copied  into other  array as shown by figure.&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisBQnY44qE-QBG_aocSZpPQ_I9w3LIAfqBZtrMWRbv1rrfkHeJdmHeVo7nYZ0HGVJVeDOdg3MXpkEiHX17bBB7PFTyCI3_9-5elsk-Pyc67jkw1X3zFUW0e7wWWAib4BRWHXqKg7tIf-9i/s1600/last.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;146&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisBQnY44qE-QBG_aocSZpPQ_I9w3LIAfqBZtrMWRbv1rrfkHeJdmHeVo7nYZ0HGVJVeDOdg3MXpkEiHX17bBB7PFTyCI3_9-5elsk-Pyc67jkw1X3zFUW0e7wWWAib4BRWHXqKg7tIf-9i/s320/last.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Now   we have a simple method and is implemented in c below.&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;C   implementation:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #999999;&quot;&gt;&amp;nbsp; &lt;b&gt;&amp;nbsp;if(a[l]&amp;lt;b[m])&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;a[l+1] = b[m];&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;b[m+1] = a[m];&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;int i=1,j=1;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;   &amp;nbsp;while((i&amp;lt;=l)&amp;amp;&amp;amp;(j&amp;lt;=m)){&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(a[i]&amp;lt;=b[j])&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;c[k] = a[i];&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;i++;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;c[k] = b[j];&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;j++;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #999999;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/4320046604998730330/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/11/two-way-merging1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/4320046604998730330'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/4320046604998730330'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/11/two-way-merging1.html' title='Two Way merging'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNhRX7nPKZ5XGQsvuL-X5QBTCSIHv98J0sH0hmWZjq63vYyHWXRybSxv1Sc4vDA2uowzj4zhKOOHZs_5ZV6foJpBi7RxuzCXB-iyFSCa7R1geeYuGbP_PZSHuNy4KFedG0w9Zkvicg5qmf/s72-c/pic+1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-1368821002225016891</id><published>2010-11-24T20:25:00.001+05:30</published><updated>2010-11-26T14:33:50.139+05:30</updated><title type='text'>Array Order Reversal</title><content type='html'>&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; Reversing the order of an array of numbers can be start&amp;nbsp;&amp;nbsp; by  design of algorithm&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZDZ1KLkAZflKo9e3XBtodxHE_4nc-l86Ap4UZI2X78SUrjZLJziL5NOgPXOZsSuQP-vfKdZXI8t0-m4kMGkcVvEMFiBaejN9jQcIX29He9G7Yi_5_CrX7DffKRmQsLaQ6oEWtun0pDuTO/s1600/1.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;61&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZDZ1KLkAZflKo9e3XBtodxHE_4nc-l86Ap4UZI2X78SUrjZLJziL5NOgPXOZsSuQP-vfKdZXI8t0-m4kMGkcVvEMFiBaejN9jQcIX29He9G7Yi_5_CrX7DffKRmQsLaQ6oEWtun0pDuTO/s200/1.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
before reversal &lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwJaCgCmtZt27LWClgWXB9Y7L_8AQE3TIOBR4_hcYHib9OHdZtWwm6nqduJ7AKqx_ya9oX14lwOygitsEmKiC98VL_o8ea9WoUPmdV54lRoFTpqrFb2DjZP3aiCwlxQ7I3-DXRd_1QLCz3/s1600/pic+2.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;45&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwJaCgCmtZt27LWClgWXB9Y7L_8AQE3TIOBR4_hcYHib9OHdZtWwm6nqduJ7AKqx_ya9oX14lwOygitsEmKiC98VL_o8ea9WoUPmdV54lRoFTpqrFb2DjZP3aiCwlxQ7I3-DXRd_1QLCz3/s200/pic+2.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br /&gt;
after  reversal&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
the reversing is easly observe by  following figure&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_-m8B6BdxbX0JLPwCTXZshJgSXqVEyeC4N2HE_8dbcdZ2BBIKqsSyh4ntUwj4DycpHovpeMpLZ7AQLIvQDnBkn_kwcFivwdGZqxRnrU7PJxuYNvMHrkjZGXrVbgMtEbakhl7N6RxFAtWU/s1600/pic+3.jpg&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;188&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj_-m8B6BdxbX0JLPwCTXZshJgSXqVEyeC4N2HE_8dbcdZ2BBIKqsSyh4ntUwj4DycpHovpeMpLZ7AQLIvQDnBkn_kwcFivwdGZqxRnrU7PJxuYNvMHrkjZGXrVbgMtEbakhl7N6RxFAtWU/s200/pic+3.jpg&quot; width=&quot;200&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
step[1]:&amp;nbsp;&amp;nbsp;  a[1]&amp;lt;=&amp;gt;a[7]&lt;br /&gt;
step[2]:&amp;nbsp;&amp;nbsp; a[2]&amp;lt;=&amp;gt;a[6]&lt;br /&gt;
step[3]:&amp;nbsp;&amp;nbsp;  a[3]&amp;lt;=&amp;gt;a[5]&lt;br /&gt;
step[4]:&amp;nbsp;&amp;nbsp; a[4]&amp;lt;=&amp;gt;a[4]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
and  the development of algorithm is given&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;  &amp;lt;=&amp;gt; 7-1+1 =7&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 2&amp;nbsp; &amp;lt;=&amp;gt; 7-2+1 =6&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 3&amp;nbsp;  &amp;lt;=&amp;gt; 7-3+1 =5&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 4&amp;nbsp; &amp;lt;=&amp;gt; 7-4+1 =4&lt;br /&gt;
General  term :&amp;nbsp; i&amp;nbsp; &amp;lt;=&amp;gt; n-i+1&lt;br /&gt;
Exchange can be done by following  mechanism&lt;br /&gt;
t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = a[1];&lt;br /&gt;
a[i]&amp;nbsp;&amp;nbsp;&amp;nbsp; = a[n-i+1];&lt;br /&gt;
a[n-i+1]=  t; &lt;br /&gt;
&lt;br /&gt;
we done!&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: #e06666;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Algorithm in steps:&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
1.Establish  the array a[1...n] to be reversed&lt;br /&gt;
2.Compute noumber of exchange  required to reverse&lt;br /&gt;
3.Exchange the ith element with [n-i+1]th  element</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/1368821002225016891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/11/array-order-reversal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/1368821002225016891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/1368821002225016891'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/11/array-order-reversal.html' title='Array Order Reversal'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZDZ1KLkAZflKo9e3XBtodxHE_4nc-l86Ap4UZI2X78SUrjZLJziL5NOgPXOZsSuQP-vfKdZXI8t0-m4kMGkcVvEMFiBaejN9jQcIX29He9G7Yi_5_CrX7DffKRmQsLaQ6oEWtun0pDuTO/s72-c/1.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-6419399996272979701</id><published>2010-11-24T20:20:00.001+05:30</published><updated>2010-11-27T20:24:19.135+05:30</updated><title type='text'>Sine Function Computation Algorithms</title><content type='html'>&lt;span style=&quot;color: #666666;&quot;&gt; Sine series is given ;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #999999; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #999999; text-align: left;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #444444;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;b style=&quot;color: #999999;&quot;&gt;  &lt;/b&gt;&lt;span style=&quot;color: #444444;&quot;&gt;sin(x) = (x/1!)-((x^3)/3!)+((x^5)/5!) -((x^7)/7!)+..........&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;Algorithm development:&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;span style=&quot;color: #666666;&quot;&gt;Studying the  expression for sin(x) we see the powers  and factorials of following  sequences&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;b style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;1,3,5,7..................&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;color: #666666; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;are  required. We can easily  generate this odd sequence by starting with 1  and successively adding  2. Our other problem is to compute the general  term&amp;nbsp; (x^i)/i! which can  expressed as&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;b style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt; (x^i)/i! = (x/1)*(x/2)*(x/3)*.......*(x/i) &amp;nbsp;&amp;nbsp;   for &amp;nbsp; i&amp;gt;=1&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;color: #666666;&quot;&gt;and  it can done following loop&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;fp := 1;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  j&amp;nbsp;&amp;nbsp; :=&amp;nbsp;  0;&lt;/div&gt;&lt;div style=&quot;color: black; font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   while j&amp;lt;i do&lt;/div&gt;&lt;div style=&quot;color: black; font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  begin&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   j := j +1;&lt;/div&gt;&lt;div style=&quot;color: black; font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   fp := fp*(x/j);&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  end&lt;/div&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: #666666;&quot;&gt;&amp;nbsp;  &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #666666;&quot;&gt;The program can be completed by implementing the  additions and  subtraction and appropriate termination. With this  approach each term&amp;nbsp;  (x^i)/i! is computed by smallest j value and  working upward . To  calculating n! we used the efficient approach of  calculating each term  from its predecessors .&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #666666;&quot;&gt;&amp;nbsp; To determine algorithm we  examine  specific series for example,&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;font-size: small;&quot;&gt; (x^3)/3! =  (x*x*x)/(3*2*1) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; =  (x^2)/(3*2) &amp;nbsp;&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp; (x^1)/1!&amp;nbsp;&amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; i =3&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (x^3)/3! =  (x*x*x*x*x)/(5*4*3*2*1) &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; =  (x^2)/(5*4) &amp;nbsp;&amp;nbsp; * &amp;nbsp; &amp;nbsp; (x^3)/3!&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp;&amp;nbsp; i =5&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (x^3)/3! =  (x*x*x)/(7*6*5*4*3*2*1) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;  = (x^2)/(7*6) &amp;nbsp;&amp;nbsp; * &amp;nbsp;&amp;nbsp;&amp;nbsp; (x^5)/5! &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp;&amp;nbsp; i =7&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black;&quot;&gt;&lt;b&gt; &amp;nbsp;&amp;nbsp; &lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #666666;&quot;&gt;In  each&amp;nbsp; term&amp;nbsp; &lt;i&gt;(x^2)/(3*2) ,&amp;nbsp; &lt;/i&gt;&lt;i&gt;(x^2)/(5*4)&amp;nbsp;  ,&lt;/i&gt;&lt;i&gt;(x^2)/(7*6) &lt;/i&gt;has  a general term :&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;i&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; (x^2)/i(i - 1)&amp;nbsp;&amp;nbsp;&amp;nbsp; for&amp;nbsp; i=   3,5,7,...&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;. &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #666666; text-align: left;&quot;&gt;&lt;i&gt;i.e. &amp;nbsp; generalized form of each term  is:&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt; current ith term =&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(x^2)/i(i - 1) &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; *&amp;nbsp;&amp;nbsp; (previous   term&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #666666; text-align: left;&quot;&gt;&lt;i&gt;To get the  terms&amp;nbsp; to alternate in sign we can  use&amp;nbsp;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;i&gt;&lt;br /&gt;
&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;color: black;&quot;&gt;sign := -sign&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;div style=&quot;color: #e06666;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&amp;nbsp;   &lt;/b&gt;&lt;u&gt;&lt;b&gt;algorithm description&lt;/b&gt;&lt;/u&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;ol style=&quot;color: #666666;&quot;&gt;&lt;li&gt;setup  initial conditions for the  first term that cannot be computed  iterativley .&lt;/li&gt;
&lt;li&gt;while the absolute value of current term is greater than the   acceptable error do&lt;/li&gt;
&lt;/ol&gt;&lt;div style=&quot;color: #666666;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (a).&amp;nbsp;  identify the current ith term,&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: #666666; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (b).&amp;nbsp; generate  current term  from its predecessor,&lt;/div&gt;&lt;div style=&quot;color: #666666; text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  (c).&amp;nbsp; add current term  with appropriate sign to the accumulated sum for  sine function.&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/6419399996272979701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/11/sine-function-computation-algorithms.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/6419399996272979701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/6419399996272979701'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/11/sine-function-computation-algorithms.html' title='Sine Function Computation Algorithms'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-945027332466541797</id><published>2010-11-24T07:04:00.000+05:30</published><updated>2010-11-24T07:04:03.124+05:30</updated><title type='text'>Generation Of Fibonacci Sequence Algorithm</title><content type='html'>&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;The   first few term are&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace; text-align: center;&quot;&gt;&lt;div style=&quot;color: #38761d;&quot;&gt;&lt;b&gt;0,1,1,2,3,5,8,13,...&lt;/b&gt;&lt;/div&gt;&lt;br /&gt;
&lt;div style=&quot;font-family: Georgia,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Each   term beyond the first two is derived from the sum of its nearest   predecessors.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;div style=&quot;color: #e06666;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  Algorithm development:&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #e06666;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;&lt;div&gt;From  the definition we are given that:&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;New  term = preceding term +  term before preceding term &lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;The  last sentence of the  problem statement suggest we may be able to use the  definition to  generate consecutive term (apart from the first two)  iteratively.&lt;/div&gt;&lt;div&gt;Let  us define:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;i&gt;  a)&amp;nbsp;&amp;nbsp;&amp;nbsp; As the  term before preceding term&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;  b)&amp;nbsp;&amp;nbsp;&amp;nbsp; As the  preceding term&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; c)&amp;nbsp;&amp;nbsp;&amp;nbsp; New term&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;Then   to start with we have:&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   &lt;span style=&quot;color: #38761d;&quot;&gt;a := 0&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; first Fibonacci number&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;b := 1&amp;nbsp;&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; second Fibonacci   number&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp; and&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;c  :=  a+b&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; third Fibonacci number (from definition)&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;when   the new term c has been generated we have the 3rd Fibonacci number. To   generate fourth or next Fibonacci number, we need to apply the same   definition again. Before we can make the next computation we need to   make some adjustments. The fourth Fibonacci derived from the sum of the   second and third Fibonacci numbers. With regard to the definition the   second Fibonacci number has the role of term before the preceding term   and the 3rd&amp;nbsp; Fibonacci number has the role “preceding term” therefore ,   before making the next computation we must ensure that:&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;   a)&amp;nbsp;&amp;nbsp;&amp;nbsp; New term (i.e.) assumes the role of the preceding term,&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;   b)&amp;nbsp;&amp;nbsp;&amp;nbsp; And what is currently the preceding term must assume the role of   the term&lt;br /&gt;
&lt;br /&gt;
before the preceding term.&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;That   is,&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;a := 0&amp;nbsp;&lt;/span&gt;&amp;nbsp; [1]&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; term before preceding term&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;b :=1&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [2]&amp;nbsp;&amp;nbsp;&amp;nbsp; preceding term&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;c := a+b &lt;/span&gt;[3]&amp;nbsp;&amp;nbsp;&amp;nbsp; new term&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;a := b&lt;/span&gt;&amp;nbsp;&amp;nbsp; [4]&amp;nbsp;&amp;nbsp;&amp;nbsp; term before preceding term   becomes preceding term&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;b   :=c&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [5]&amp;nbsp;&amp;nbsp;&amp;nbsp; preceding term become new term.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;After&amp;nbsp;   making step [5] we are in position where we can use the definition to   generate the next Fibonacci number. A way to do this is to loop back to   step [3]. Further investigation of steps [3]-&amp;gt;[5] indicates they  can  be placed in a loop to iteratively generate Fibonacci numbers (for   n&amp;gt;2). The essential mechanism we could use is:&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;a := 0;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;b := 1;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;i :=&amp;nbsp; 2;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;while i&amp;lt;n do&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; begin&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i := i+1;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c := a+b;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a := b;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b := c&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: #6aa84f;&quot;&gt;&lt;b&gt;end &lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&amp;nbsp;&lt;u style=&quot;color: #e06666;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial,Helvetica,sans-serif;&quot;&gt;Algorithm Description&lt;/span&gt;&lt;/i&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;1)&amp;nbsp;&amp;nbsp;&amp;nbsp;   Prompt and read n, the number of Fibonacci numbers to be&amp;nbsp;&amp;nbsp;&amp;nbsp; generated .&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;2)&amp;nbsp;&amp;nbsp;&amp;nbsp;   Assign first two Fibonacci numbers a and b.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;3)&amp;nbsp;&amp;nbsp;&amp;nbsp;   Initialize count of number generated.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;4)&amp;nbsp;&amp;nbsp;&amp;nbsp;   While less than n Fibonacci numbers have been generated do&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   a)&amp;nbsp;&amp;nbsp;&amp;nbsp; Write out next two Fibonacci numbers;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   b)&amp;nbsp;&amp;nbsp;&amp;nbsp; Generate next Fibonacci number keeping a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; relevant ;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   c)&amp;nbsp;&amp;nbsp;&amp;nbsp; Generate next Fibonacci number from most recent pair keeping b   relevant for next computation&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; d)&amp;nbsp;&amp;nbsp;&amp;nbsp;   Update count of numbers of Fibonacci numbers generated, i.&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;5)&amp;nbsp;&amp;nbsp;&amp;nbsp; If n even then   write out last two Fibonacci numbers else&lt;/span&gt; &lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;write out second last   Fibonacci number.&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/945027332466541797/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/11/generation-of-fibonacci-sequence.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/945027332466541797'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/945027332466541797'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/11/generation-of-fibonacci-sequence.html' title='Generation Of Fibonacci Sequence Algorithm'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-827760893483705989</id><published>2010-11-24T07:01:00.000+05:30</published><updated>2010-11-24T07:01:27.418+05:30</updated><title type='text'>Reversing The Digit Of An Integer</title><content type='html'>&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt; &lt;span style=&quot;color: black;&quot;&gt;Reverse   the order of digits of a positive integer.&lt;/span&gt;&lt;b&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e06666;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;Development:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt; A specific example of reversing is,&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   input no :1532&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;   &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reversed output&amp;nbsp; :2351&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp; Actually the number 1532 is&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: black;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt; &lt;b&gt;1*(10^3)+5*(10^2)+3*(10^1)+2*(10^0).&lt;/b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We can access each digits. and start the access from rightmost&lt;br /&gt;
(least significant digit). To chop off least significant digit&lt;br /&gt;
from the number, use mod 10, mod give reminder of division &lt;b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; i.e. 1532 mod 10 = 2&lt;br /&gt;
&lt;/b&gt;To get the remaining number 153, Use integer division by 10 with&lt;br /&gt;
the number&lt;b&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt; i.e, int(1532 div 10) = 153&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;Repeat   the above two steps to access each digits in the number&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt; &lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt;   To generalize above steps, imagine n is the number to be reverse&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; then,&lt;/span&gt;&lt;b&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; n mod 10 = r;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; r is the least   significant digit&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; n = int(n / 10);&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt; &lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;The next step is to reverse the number, In above example   2 is the&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; first   digit and 3 is second.We can reverse it by 2 (least significant digit)&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; is multiplying with 10 and   add it with 3(next significant digit)&lt;/span&gt;&lt;b&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; i.e, 2*10 + 3 = 23&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt; &lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;Repeat the above steps until fully reverse the number&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; Use while loop with   condition n&amp;gt;0 to repeat the steps&lt;/span&gt;&lt;b&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; 23 * 10 + 5 = 235&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 235 * 10 + 1 = 2351&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;color: black;&quot;&gt;We are done!&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt; &lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; To generalize above steps,   initialize a variable reverse with zero&lt;/span&gt;&lt;b&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; i.e,reverse = reverse * 10 + r&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e06666;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #e06666;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&lt;u style=&quot;color: #e06666;&quot;&gt;implement   in C:&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/b&gt;&lt;span style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;#include&amp;lt;stdio.h&amp;gt;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; main()&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; {&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; int reverse = 0;&lt;/span&gt;&lt;br style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot; /&gt;&lt;span style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; int   r,n;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;  printf(&quot;Enter the number to reverse&quot;);&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; scanf(%d,&amp;amp;n);&lt;/span&gt;&lt;br style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot; /&gt;&lt;span style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;   while(n&amp;gt;0){&lt;/span&gt;&lt;br style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot; /&gt;&lt;span style=&quot;color: black; font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; r = n mod 10;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; n = n / 10;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;  reverse = (reverse *10) + r;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; printf(The reversed number is :%d,reverse);&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/span&gt;&lt;br style=&quot;color: black;&quot; /&gt;&lt;span style=&quot;color: black;&quot;&gt; }&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/827760893483705989/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/11/reversing-digit-of-integer_23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/827760893483705989'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/827760893483705989'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/11/reversing-digit-of-integer_23.html' title='Reversing The Digit Of An Integer'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9168209982739874163.post-6856455002352765091</id><published>2010-11-24T06:58:00.000+05:30</published><updated>2010-11-24T06:58:49.543+05:30</updated><title type='text'>Factorial Computation Algorithms</title><content type='html'>&lt;span style=&quot;font-size: small;&quot;&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;We can start the   development of this algorithm by the definition of n!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small; font-weight: bold;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;i&gt;&amp;nbsp; &amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/i&gt;&amp;nbsp;&amp;nbsp;   &lt;b style=&quot;color: black;&quot;&gt;n! = 1*2*3*...........*(n-1)*n&amp;nbsp;&amp;nbsp;&amp;nbsp; for n&amp;gt;=1&lt;/b&gt;&lt;span style=&quot;color: #38761d;&quot;&gt;&amp;nbsp; &lt;/span&gt;&lt;b style=&quot;color: black;&quot;&gt;and 0!= 1&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-size: small;&quot;&gt; &lt;span style=&quot;font-size: small;&quot;&gt;In our design we need to keep in mind that  the computer&#39;s  arithmetic unit can only multiply two numbers at a time&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; Applying the factorial   definition we get&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp; 0!=1&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   1!=1*1&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2!=1*2&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   3!=1*2*3&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4!=1*2*3*4&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   .&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  .&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;We can see that  4! contains all factors of  3!. The only difference is 4. We can  generalize this by observing that  n!can always be obtained from (n-1)!  by simply multiplying by n(for  n&amp;gt;=1). that is,&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;b&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;nbsp;   n!=n*(n-1)! &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; for&amp;nbsp; n&amp;gt;=1&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-size: x-small;&quot;&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; font-size: small;&quot;&gt;Using this def   we can write the first few factorial as&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;b style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;   1!=1*0!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2!=2*1!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   3!=3*2!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  4!=4*3!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  .&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  .&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;  .&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt; &lt;span style=&quot;font-size: small;&quot;&gt;If we start  p=0!=1 we can write first few  steps in computing n!as:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;b style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;   p:= 1&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; =0!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p:= p*1&amp;nbsp;&amp;nbsp;&amp;nbsp;   =1!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p:= p*2 &amp;nbsp;&amp;nbsp; =2!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   &amp;nbsp; p:= p*3 &amp;nbsp;&amp;nbsp; =3!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; p:= p*4 &amp;nbsp;&amp;nbsp;&amp;nbsp;   =4!&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; . &amp;nbsp; &amp;nbsp;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: black; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; .&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;&amp;nbsp; From step 2 onwards we   are actually repeating the same process over and over. For general   (i+1)th step we have&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style=&quot;color: #38761d;&quot;&gt;&lt;i&gt;p :=   p*i&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (i+1)&lt;/i&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/b&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt;This general step can be   placed in a loop to iteratively generate n!. this allows us to take   advantage of the fact that the computer arithmetic unit can only   multiply two numbers at a time.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; In many ways this this problem is very   much like the problem of summing a set of n numbers.In this problem we   need to generate a set of products. it follow from the general (i+1)th   step that all factorials for n&amp;gt;=1 can be generated iteratively. The   instance where n=0 is special case which must be accounted for directly   by assignment&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: #38761d; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;i&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/i&gt;&lt;b style=&quot;color: black;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;   p := 1 &amp;nbsp; &amp;nbsp; ( by definition of 0)&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;span style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;&quot;&gt; The central part of the   algorithm for computing n! therefor involves a special initial step   followed by n iterative steps.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;1.&amp;nbsp; Treat 0! as  special case (p  := 1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;2. &amp;nbsp; Build the  each of the n remaining products from its  predecessors by an iterative  process.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-size: small;&quot;&gt;3. &amp;nbsp; Write out  the value of n!&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;span style=&quot;color: #e06666; font-size: small;&quot;&gt;&lt;u&gt;&lt;b&gt;A&lt;/b&gt;&lt;b&gt;lgorithm Description&lt;/b&gt;&lt;/u&gt; &lt;/span&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b style=&quot;color: #ea9999;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;1.  Establish n, the  factorial required where n&amp;gt;=0.&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;2. Set product p for 0!  (special case).  Also set product count to zero.&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;3. While less than n products  have been  calculated repeatedly do&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (a)&amp;nbsp; increment product count ,&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (b) compute the i th   product p by multiplying&amp;nbsp; i by the most recent product.&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: left;&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-size: small;&quot;&gt;&lt;b&gt;4. Return the result n!&lt;/b&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://codewordblog.blogspot.com/feeds/6856455002352765091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://codewordblog.blogspot.com/2010/11/factorial-computation-algorithms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/6856455002352765091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9168209982739874163/posts/default/6856455002352765091'/><link rel='alternate' type='text/html' href='http://codewordblog.blogspot.com/2010/11/factorial-computation-algorithms.html' title='Factorial Computation Algorithms'/><author><name>anwar</name><uri>http://www.blogger.com/profile/05517415834173434805</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='26' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi9I0-gh5bSlZnWLxn2FZIHdBtktoiQsTeJCHGNniXDL6bzgNz8Ie2KIl1F-V2lkRSl9PXAapLQVCU-t_V_0CzoiqKA9_AWyQ1qBheaBXDbn46Bd0vvlVCwAsAbOM68ig/s220/as.jpg'/></author><thr:total>0</thr:total></entry></feed>