2020-11-26 14:37:12 +03:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2022-09-08 03:17:03 +03:00
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en-US" >
2020-11-26 14:37:12 +03:00
< head >
< meta http-equiv = "Content-Type" content = "text/xhtml;charset=UTF-8" / >
2021-10-25 22:34:27 +03:00
< meta http-equiv = "X-UA-Compatible" content = "IE=11" / >
2022-09-08 03:17:03 +03:00
< meta name = "generator" content = "Doxygen 1.9.5" / >
2020-11-26 14:37:12 +03:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" / >
< title > Algorithms_in_C: Misc< / title >
< link href = "../../tabs.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../jquery.js" > < / script >
< script type = "text/javascript" src = "../../dynsections.js" > < / script >
< link href = "../../navtree.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../resize.js" > < / script >
< script type = "text/javascript" src = "../../navtreedata.js" > < / script >
< script type = "text/javascript" src = "../../navtree.js" > < / script >
< link href = "../../search/search.css" rel = "stylesheet" type = "text/css" / >
< script type = "text/javascript" src = "../../search/searchdata.js" > < / script >
< script type = "text/javascript" src = "../../search/search.js" > < / script >
< script type = "text/x-mathjax-config" >
2021-10-25 22:34:27 +03:00
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
2020-11-26 14:37:12 +03:00
});
< / script >
< script type = "text/javascript" async = "async" src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js" > < / script >
< link href = "../../doxygen.css" rel = "stylesheet" type = "text/css" / >
< / head >
< body >
< div id = "top" > <!-- do not remove this div, it is closed by doxygen! -->
< div id = "titlearea" >
< table cellspacing = "0" cellpadding = "0" >
< tbody >
2022-01-14 23:11:27 +03:00
< tr id = "projectrow" >
< td id = "projectalign" >
2021-10-25 22:34:27 +03:00
< div id = "projectname" > Algorithms_in_C< span id = "projectnumber" >   1.0.0< / span >
2020-11-26 14:37:12 +03:00
< / div >
< div id = "projectbrief" > Set of algorithms implemented in C.< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
<!-- end header part -->
2022-09-08 03:17:03 +03:00
<!-- Generated by Doxygen 1.9.5 -->
2020-11-26 14:37:12 +03:00
< script type = "text/javascript" >
2021-10-25 22:34:27 +03:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2022-09-08 03:17:03 +03:00
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
2020-11-26 14:37:12 +03:00
/* @license-end */
< / script >
< script type = "text/javascript" src = "../../menudata.js" > < / script >
< script type = "text/javascript" src = "../../menu.js" > < / script >
< script type = "text/javascript" >
2021-10-25 22:34:27 +03:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2020-11-26 14:37:12 +03:00
$(function() {
initMenu('../../',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
2021-10-25 22:34:27 +03:00
/* @license-end */
< / script >
2020-11-26 14:37:12 +03:00
< div id = "main-nav" > < / div >
< / div > <!-- top -->
< div id = "side-nav" class = "ui-resizable side-nav-resizable" >
< div id = "nav-tree" >
< div id = "nav-tree-contents" >
< div id = "nav-sync" class = "sync" > < / div >
< / div >
< / div >
< div id = "splitbar" style = "-moz-user-select:none;"
class="ui-resizable-handle">
< / div >
< / div >
< script type = "text/javascript" >
2021-10-25 22:34:27 +03:00
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699& dn=expat.txt MIT */
2020-11-26 14:37:12 +03:00
$(document).ready(function(){initNavTree('d1/ded/group__misc.html','../../'); initResizable(); });
/* @license-end */
< / script >
< div id = "doc-content" >
<!-- window showing the filter options -->
< div id = "MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
< / div >
<!-- iframe showing the search results (closed by default) -->
< div id = "MSearchResultsWindow" >
2022-09-08 03:17:03 +03:00
< div id = "MSearchResults" >
< div class = "SRPage" >
< div id = "SRIndex" >
< div id = "SRResults" > < / div >
< div class = "SRStatus" id = "Loading" > Loading...< / div >
< div class = "SRStatus" id = "Searching" > Searching...< / div >
< div class = "SRStatus" id = "NoMatches" > No Matches< / div >
< / div >
< / div >
< / div >
2020-11-26 14:37:12 +03:00
< / div >
< div class = "header" >
< div class = "summary" >
< a href = "#func-members" > Functions< / a > < / div >
2021-10-25 22:34:27 +03:00
< div class = "headertitle" > < div class = "title" > Misc< / div > < / div >
2020-11-26 14:37:12 +03:00
< / div > <!-- header -->
< div class = "contents" >
< p > variable upto which prime numbers are to be found out
< a href = "#details" > More...< / a > < / p >
< table class = "memberdecls" >
2021-10-25 22:34:27 +03:00
< tr class = "heading" > < td colspan = "2" > < h2 class = "groupheader" > < a id = "func-members" name = "func-members" > < / a >
2020-11-26 14:37:12 +03:00
Functions< / h2 > < / td > < / tr >
< tr class = "memitem:gac1a7a8e00eeb590511465c28fae16e54" > < td class = "memItemLeft" align = "right" valign = "top" > void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d1/ded/group__misc.html#gac1a7a8e00eeb590511465c28fae16e54" > prime< / a > (int *p)< / td > < / tr >
< tr class = "memdesc:gac1a7a8e00eeb590511465c28fae16e54" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Prime Sieve works in O(nlogn) time. < a href = "../../d1/ded/group__misc.html#gac1a7a8e00eeb590511465c28fae16e54" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:gac1a7a8e00eeb590511465c28fae16e54" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:ga6f8e8c9d25b5891d57e588d80d75028a" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d1/ded/group__misc.html#ga6f8e8c9d25b5891d57e588d80d75028a" > count< / a > (int *arr, const int size)< / td > < / tr >
< tr class = "memdesc:ga6f8e8c9d25b5891d57e588d80d75028a" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Count func counts the number of prime numbers. < a href = "../../d1/ded/group__misc.html#ga6f8e8c9d25b5891d57e588d80d75028a" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:ga6f8e8c9d25b5891d57e588d80d75028a" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gaa8dca7b867074164d5f45b0f3851269d" > < td class = "memItemLeft" align = "right" valign = "top" > static void  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d1/ded/group__misc.html#gaa8dca7b867074164d5f45b0f3851269d" > test< / a > ()< / td > < / tr >
< tr class = "memdesc:gaa8dca7b867074164d5f45b0f3851269d" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Test implementations. < a href = "../../d1/ded/group__misc.html#gaa8dca7b867074164d5f45b0f3851269d" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:gaa8dca7b867074164d5f45b0f3851269d" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< tr class = "memitem:gac0f2228420376f4db7e1274f2b41667c" > < td class = "memItemLeft" align = "right" valign = "top" > int  < / td > < td class = "memItemRight" valign = "bottom" > < a class = "el" href = "../../d1/ded/group__misc.html#gac0f2228420376f4db7e1274f2b41667c" > main< / a > (int argc, const char *argv[])< / td > < / tr >
< tr class = "memdesc:gac0f2228420376f4db7e1274f2b41667c" > < td class = "mdescLeft" >   < / td > < td class = "mdescRight" > Main function. < a href = "../../d1/ded/group__misc.html#gac0f2228420376f4db7e1274f2b41667c" > More...< / a > < br / > < / td > < / tr >
< tr class = "separator:gac0f2228420376f4db7e1274f2b41667c" > < td class = "memSeparator" colspan = "2" >   < / td > < / tr >
< / table >
< a name = "details" id = "details" > < / a > < h2 class = "groupheader" > Detailed Description< / h2 >
2021-10-25 22:34:27 +03:00
< p > variable upto which prime numbers are to be found out < / p >
2020-11-26 14:37:12 +03:00
< h2 class = "groupheader" > Function Documentation< / h2 >
2021-10-25 22:34:27 +03:00
< a id = "ga6f8e8c9d25b5891d57e588d80d75028a" name = "ga6f8e8c9d25b5891d57e588d80d75028a" > < / a >
2022-09-08 03:17:03 +03:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#ga6f8e8c9d25b5891d57e588d80d75028a" > ◆   < / a > < / span > count()< / h2 >
2020-11-26 14:37:12 +03:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int count < / td >
< td > (< / td >
< td class = "paramtype" > int *  < / td >
< td class = "paramname" > < em > arr< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const int  < / td >
< td class = "paramname" > < em > size< / em >   < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Count func counts the number of prime numbers. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > arr< / td > < td > contains the prime numbers < / td > < / tr >
< tr > < td class = "paramname" > size< / td > < td > denotes upto which prime numbers are to be found out < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > count of prime numbers < / dd > < / dl >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 42< / span > {< / div >
< div class = "line" > < span class = "lineno" > 43< / span > < span class = "keywordtype" > int< / span > k=0;< / div >
< div class = "line" > < span class = "lineno" > 44< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > int< / span > i=0;i< =size;i++){< / div >
< div class = "line" > < span class = "lineno" > 45< / span > < span class = "keywordflow" > if< / span > (arr[i]==1){< / div >
< div class = "line" > < span class = "lineno" > 46< / span > k++;< / div >
< div class = "line" > < span class = "lineno" > 47< / span > }< / div >
< div class = "line" > < span class = "lineno" > 48< / span > }< / div >
< div class = "line" > < span class = "lineno" > 49< / span > < span class = "keywordflow" > return< / span > k;< / div >
< div class = "line" > < span class = "lineno" > 50< / span > }< / div >
2020-11-26 14:37:12 +03:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-25 22:34:27 +03:00
< a id = "gac0f2228420376f4db7e1274f2b41667c" name = "gac0f2228420376f4db7e1274f2b41667c" > < / a >
2022-09-08 03:17:03 +03:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gac0f2228420376f4db7e1274f2b41667c" > ◆   < / a > < / span > main()< / h2 >
2020-11-26 14:37:12 +03:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > int main < / td >
< td > (< / td >
< td class = "paramtype" > int  < / td >
< td class = "paramname" > < em > argc< / em > , < / td >
< / tr >
< tr >
< td class = "paramkey" > < / td >
< td > < / td >
< td class = "paramtype" > const char *  < / td >
< td class = "paramname" > < em > argv< / em > []  < / td >
< / tr >
< tr >
< td > < / td >
< td > )< / td >
< td > < / td > < td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Main function. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > argc< / td > < td > commandline argument count (ignored) < / td > < / tr >
< tr > < td class = "paramname" > argv< / td > < td > commandline array of arguments (ignored) < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > 0 on exit < / dd > < / dl >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 74< / span > {< / div >
< div class = "line" > < span class = "lineno" > 75< / span > < a class = "code hl_function" href = "../../d1/ded/group__misc.html#gaa8dca7b867074164d5f45b0f3851269d" > test< / a > (); < span class = "comment" > // execute the tests< / span > < / div >
< div class = "line" > < span class = "lineno" > 76< / span > < span class = "keywordflow" > return< / span > 0;< / div >
< div class = "line" > < span class = "lineno" > 77< / span > }< / div >
2021-02-05 22:52:57 +03:00
< div class = "ttc" id = "agroup__misc_html_gaa8dca7b867074164d5f45b0f3851269d" > < div class = "ttname" > < a href = "../../d1/ded/group__misc.html#gaa8dca7b867074164d5f45b0f3851269d" > test< / a > < / div > < div class = "ttdeci" > static void test()< / div > < div class = "ttdoc" > Test implementations.< / div > < div class = "ttdef" > < b > Definition:< / b > prime_seive.c:56< / div > < / div >
2020-11-26 14:37:12 +03:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2022-09-08 03:17:03 +03:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d1/ded/group__misc_gac0f2228420376f4db7e1274f2b41667c_cgraph.svg" width = "256" height = "36" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2020-11-26 14:37:12 +03:00
< / div >
< / div >
< / div >
< / div >
2021-10-25 22:34:27 +03:00
< a id = "gac1a7a8e00eeb590511465c28fae16e54" name = "gac1a7a8e00eeb590511465c28fae16e54" > < / a >
2022-09-08 03:17:03 +03:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gac1a7a8e00eeb590511465c28fae16e54" > ◆   < / a > < / span > prime()< / h2 >
2020-11-26 14:37:12 +03:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "memname" >
< tr >
< td class = "memname" > void prime < / td >
< td > (< / td >
< td class = "paramtype" > int *  < / td >
< td class = "paramname" > < em > p< / em > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Prime Sieve works in O(nlogn) time. < / p >
< dl class = "params" > < dt > Parameters< / dt > < dd >
< table class = "params" >
< tr > < td class = "paramname" > p< / td > < td > array to be updated < / td > < / tr >
< / table >
< / dd >
< / dl >
< dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 22< / span > {< / div >
< div class = "line" > < span class = "lineno" > 23< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > long< / span > < span class = "keywordtype" > long< / span > < span class = "keywordtype" > int< / span > i=3;i< =< a class = "code hl_variable" href = "../../db/dd5/prime__seive_8c.html#ac1215a37edfa07d37edf6ec65f2235c7" > MAX_SIZE< / a > ;i+=2) { p[i]=1; }< / div >
< div class = "line" > < span class = "lineno" > 24< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > long< / span > < span class = "keywordtype" > long< / span > < span class = "keywordtype" > int< / span > i=3;i< =< a class = "code hl_variable" href = "../../db/dd5/prime__seive_8c.html#ac1215a37edfa07d37edf6ec65f2235c7" > MAX_SIZE< / a > ;i+=2)< / div >
< div class = "line" > < span class = "lineno" > 25< / span > {< / div >
< div class = "line" > < span class = "lineno" > 26< / span > < span class = "keywordflow" > if< / span > (p[i]==1) {< / div >
< div class = "line" > < span class = "lineno" > 27< / span > < span class = "keywordflow" > for< / span > (< span class = "keywordtype" > long< / span > < span class = "keywordtype" > long< / span > < span class = "keywordtype" > int< / span > j=i*i;j< =< a class = "code hl_variable" href = "../../db/dd5/prime__seive_8c.html#ac1215a37edfa07d37edf6ec65f2235c7" > MAX_SIZE< / a > ;j+=i) {< / div >
< div class = "line" > < span class = "lineno" > 28< / span > p[j]=0;< / div >
< div class = "line" > < span class = "lineno" > 29< / span > }< / div >
< div class = "line" > < span class = "lineno" > 30< / span > }< / div >
< div class = "line" > < span class = "lineno" > 31< / span > }< / div >
< div class = "line" > < span class = "lineno" > 32< / span > p[2]=1;< / div >
< div class = "line" > < span class = "lineno" > 33< / span > p[0]=p[1]=0; < / div >
< div class = "line" > < span class = "lineno" > 34< / span > }< / div >
2021-02-05 22:52:57 +03:00
< div class = "ttc" id = "aprime__seive_8c_html_ac1215a37edfa07d37edf6ec65f2235c7" > < div class = "ttname" > < a href = "../../db/dd5/prime__seive_8c.html#ac1215a37edfa07d37edf6ec65f2235c7" > MAX_SIZE< / a > < / div > < div class = "ttdeci" > const unsigned long long MAX_SIZE< / div > < div class = "ttdoc" > for assert for standard input output for general purpose standard library< / div > < div class = "ttdef" > < b > Definition:< / b > prime_seive.c:11< / div > < / div >
2020-11-26 14:37:12 +03:00
< / div > <!-- fragment -->
< / div >
< / div >
2021-10-25 22:34:27 +03:00
< a id = "gaa8dca7b867074164d5f45b0f3851269d" name = "gaa8dca7b867074164d5f45b0f3851269d" > < / a >
2022-09-08 03:17:03 +03:00
< h2 class = "memtitle" > < span class = "permalink" > < a href = "#gaa8dca7b867074164d5f45b0f3851269d" > ◆   < / a > < / span > test()< / h2 >
2020-11-26 14:37:12 +03:00
< div class = "memitem" >
< div class = "memproto" >
< table class = "mlabels" >
< tr >
< td class = "mlabels-left" >
< table class = "memname" >
< tr >
< td class = "memname" > static void test < / td >
< td > (< / td >
< td class = "paramtype" > void  < / td >
< td class = "paramname" > < / td > < td > )< / td >
< td > < / td >
< / tr >
< / table >
< / td >
< td class = "mlabels-right" >
< span class = "mlabels" > < span class = "mlabel" > static< / span > < / span > < / td >
< / tr >
< / table >
< / div > < div class = "memdoc" >
< p > Test implementations. < / p >
< dl class = "section return" > < dt > Returns< / dt > < dd > void < / dd > < / dl >
2022-01-14 23:11:27 +03:00
< div class = "fragment" > < div class = "line" > < span class = "lineno" > 57< / span > {< / div >
< div class = "line" > < span class = "lineno" > 58< / span > < span class = "comment" > // Test Case 1< / span > < / div >
< div class = "line" > < span class = "lineno" > 59< / span > < span class = "keyword" > const< / span > < span class = "keywordtype" > int< / span > size = 10; < span class = "comment" > /* array size */< / span > < / div >
< div class = "line" > < span class = "lineno" > 60< / span > printf(< span class = "stringliteral" > " Test Case 1..." < / span > );< / div >
< div class = "line" > < span class = "lineno" > 61< / span > < span class = "keywordtype" > int< / span > arr[1000005]={0}; < span class = "comment" > /* array to store prime numbers */< / span > < / div >
< div class = "line" > < span class = "lineno" > 62< / span > < a class = "code hl_function" href = "../../d1/ded/group__misc.html#gac1a7a8e00eeb590511465c28fae16e54" > prime< / a > (arr);< / div >
2022-09-08 03:17:03 +03:00
< div class = "line" > < span class = "lineno" > 63< / span > assert(count(arr,size)==4);< / div >
2022-01-14 23:11:27 +03:00
< div class = "line" > < span class = "lineno" > 64< / span > printf(< span class = "stringliteral" > " Passed\n" < / span > );< / div >
< div class = "line" > < span class = "lineno" > 65< / span > }< / div >
2021-02-05 22:52:57 +03:00
< div class = "ttc" id = "agroup__misc_html_gac1a7a8e00eeb590511465c28fae16e54" > < div class = "ttname" > < a href = "../../d1/ded/group__misc.html#gac1a7a8e00eeb590511465c28fae16e54" > prime< / a > < / div > < div class = "ttdeci" > void prime(int *p)< / div > < div class = "ttdoc" > Prime Sieve works in O(nlogn) time.< / div > < div class = "ttdef" > < b > Definition:< / b > prime_seive.c:21< / div > < / div >
2020-11-26 14:37:12 +03:00
< / div > <!-- fragment --> < div class = "dynheader" >
Here is the call graph for this function:< / div >
< div class = "dyncontent" >
2022-09-08 03:17:03 +03:00
< div class = "center" > < iframe scrolling = "no" frameborder = "0" src = "../../d1/ded/group__misc_gaa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width = "158" height = "36" > < p > < b > This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.< / b > < / p > < / iframe >
2020-11-26 14:37:12 +03:00
< / div >
< / div >
< / div >
< / div >
< / div > <!-- contents -->
< / div > <!-- doc - content -->
<!-- start footer part -->
< div id = "nav-path" class = "navpath" > <!-- id is needed for treeview function! -->
< ul >
2022-09-08 03:17:03 +03:00
< li class = "footer" > Generated by < a href = "https://www.doxygen.org/index.html" > < img class = "footer" src = "../../doxygen.svg" width = "104" height = "31" alt = "doxygen" / > < / a > 1.9.5 < / li >
2020-11-26 14:37:12 +03:00
< / ul >
< / div >
< / body >
< / html >