mirror of
https://github.com/TheAlgorithms/C
synced 2024-12-14 07:27:17 +03:00
412 lines
28 KiB
HTML
412 lines
28 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
|
<meta name="generator" content="Doxygen 1.9.5"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>Algorithms_in_C: leetcode/src/6.c File Reference</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">
|
|
MathJax.Hub.Config({
|
|
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
|
jax: ["input/TeX","output/HTML-CSS"],
|
|
});
|
|
</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>
|
|
<tr id="projectrow">
|
|
<td id="projectalign">
|
|
<div id="projectname">Algorithms_in_C<span id="projectnumber"> 1.0.0</span>
|
|
</div>
|
|
<div id="projectbrief">Set of algorithms implemented in C.</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.5 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/javascript" src="../../menudata.js"></script>
|
|
<script type="text/javascript" src="../../menu.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(function() {
|
|
initMenu('../../',true,false,'search.php','Search');
|
|
$(document).ready(function() { init_search(); });
|
|
});
|
|
/* @license-end */
|
|
</script>
|
|
<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">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function(){initNavTree('d0/df3/6_8c.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">
|
|
<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>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle"><div class="title">6.c File Reference</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Implementation of the <a href="https://leetcode.com/problems/zigzag-conversion/" target="_blank">ZigZag Conversion</a> Leetcode problem.
|
|
<a href="#details">More...</a></p>
|
|
<div class="textblock"><code>#include <assert.h></code><br />
|
|
<code>#include <stdint.h></code><br />
|
|
<code>#include <stdio.h></code><br />
|
|
<code>#include <stdlib.h></code><br />
|
|
<code>#include <string.h></code><br />
|
|
</div><div class="textblock"><div class="dynheader">
|
|
Include dependency graph for 6.c:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d7/d1c/6_8c__incl.svg" width="435" height="110"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
|
</div>
|
|
</div>
|
|
</div><table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:afdf3bfe2dc8aadac13c7e6d051d3bd5d"><td class="memItemLeft" align="right" valign="top">char * </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/df3/6_8c.html#afdf3bfe2dc8aadac13c7e6d051d3bd5d">convert</a> (char *in, uint16_t numRows)</td></tr>
|
|
<tr class="memdesc:afdf3bfe2dc8aadac13c7e6d051d3bd5d"><td class="mdescLeft"> </td><td class="mdescRight">for assert for unsigned int with fixed size <a href="../../d0/df3/6_8c.html#afdf3bfe2dc8aadac13c7e6d051d3bd5d">More...</a><br /></td></tr>
|
|
<tr class="separator:afdf3bfe2dc8aadac13c7e6d051d3bd5d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a109c3813445bcf97d154a671119deae9"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a> (char *s, int numRows, char *expected)</td></tr>
|
|
<tr class="memdesc:a109c3813445bcf97d154a671119deae9"><td class="mdescLeft"> </td><td class="mdescRight">Self-test implementations. <a href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">More...</a><br /></td></tr>
|
|
<tr class="separator:a109c3813445bcf97d154a671119deae9"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/df3/6_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
|
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft"> </td><td class="mdescRight">Self-test implementations. <a href="../../d0/df3/6_8c.html#aa8dca7b867074164d5f45b0f3851269d">More...</a><br /></td></tr>
|
|
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../d0/df3/6_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
|
|
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <a href="../../d0/df3/6_8c.html#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br /></td></tr>
|
|
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p >Implementation of the <a href="https://leetcode.com/problems/zigzag-conversion/" target="_blank">ZigZag Conversion</a> Leetcode problem. </p>
|
|
<p >A decent solution to the ZigZag conversion problem. Take advantage of the fact that the maximum gap between the chars is 2 times the depth(the number of rows). The actual gap between the two first chars of a rows depends on the depth of the row. The gaps between successives chars on the same row is the complement of the first gap to the maximum gap. </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/straight-into-the-wall" target="_blank">straight_into_the_wall</a> </dd></dl>
|
|
</div><h2 class="groupheader">Function Documentation</h2>
|
|
<a id="afdf3bfe2dc8aadac13c7e6d051d3bd5d" name="afdf3bfe2dc8aadac13c7e6d051d3bd5d"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#afdf3bfe2dc8aadac13c7e6d051d3bd5d">◆ </a></span>convert()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">char * convert </td>
|
|
<td>(</td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>in</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">uint16_t </td>
|
|
<td class="paramname"><em>numRows</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>for assert for unsigned int with fixed size </p>
|
|
<p >for IO operations for malloc for string tools</p>
|
|
<p >Convert a string to the it's zigzag equivalent on a given number of rows. </p><dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">in</td><td>the string in input. </td></tr>
|
|
<tr><td class="paramname">numRows</td><td>the desired number of rows. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>the converted new (malloced) string. </dd></dl>
|
|
<div class="fragment"><div class="line"><span class="lineno"> 30</span>{</div>
|
|
<div class="line"><span class="lineno"> 31</span> uint16_t len = strlen(in);</div>
|
|
<div class="line"><span class="lineno"> 32</span> </div>
|
|
<div class="line"><span class="lineno"> 33</span> <span class="keywordflow">if</span> (len < numRows)</div>
|
|
<div class="line"><span class="lineno"> 34</span> {</div>
|
|
<div class="line"><span class="lineno"> 35</span> numRows = len;</div>
|
|
<div class="line"><span class="lineno"> 36</span> }</div>
|
|
<div class="line"><span class="lineno"> 37</span> <span class="keywordtype">char</span>* out = <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#afdddaa949a93c1ef559a638e98f9c21b">calloc</a>(len + 1, <span class="keyword">sizeof</span>(<span class="keywordtype">char</span>));</div>
|
|
<div class="line"><span class="lineno"> 38</span> </div>
|
|
<div class="line"><span class="lineno"> 39</span> <span class="keywordflow">if</span> (numRows < 2)</div>
|
|
<div class="line"><span class="lineno"> 40</span> {</div>
|
|
<div class="line"><span class="lineno"> 41</span> memcpy(out, in, len + 1);</div>
|
|
<div class="line"><span class="lineno"> 42</span> <span class="keywordflow">return</span> out;</div>
|
|
<div class="line"><span class="lineno"> 43</span> }</div>
|
|
<div class="line"><span class="lineno"> 44</span> </div>
|
|
<div class="line"><span class="lineno"> 45</span> uint16_t <a class="code hl_define" href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a> = numRows - 1;</div>
|
|
<div class="line"><span class="lineno"> 46</span> uint16_t rr = 2 * <a class="code hl_define" href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a>;</div>
|
|
<div class="line"><span class="lineno"> 47</span> uint16_t i = 0;</div>
|
|
<div class="line"><span class="lineno"> 48</span> uint16_t o = 0;</div>
|
|
<div class="line"><span class="lineno"> 49</span> uint16_t delta = 0;</div>
|
|
<div class="line"><span class="lineno"> 50</span> </div>
|
|
<div class="line"><span class="lineno"> 51</span> <span class="comment">// first row</span></div>
|
|
<div class="line"><span class="lineno"> 52</span> <span class="keywordflow">while</span> (i < len)</div>
|
|
<div class="line"><span class="lineno"> 53</span> {</div>
|
|
<div class="line"><span class="lineno"> 54</span> out[o++] = in[i];</div>
|
|
<div class="line"><span class="lineno"> 55</span> i += rr;</div>
|
|
<div class="line"><span class="lineno"> 56</span> }</div>
|
|
<div class="line"><span class="lineno"> 57</span> </div>
|
|
<div class="line"><span class="lineno"> 58</span> <span class="comment">// middle rows</span></div>
|
|
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">for</span> (uint16_t l = 1; l < <a class="code hl_define" href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a>; l++)</div>
|
|
<div class="line"><span class="lineno"> 60</span> {</div>
|
|
<div class="line"><span class="lineno"> 61</span> i = l;</div>
|
|
<div class="line"><span class="lineno"> 62</span> delta = 2 * l;</div>
|
|
<div class="line"><span class="lineno"> 63</span> <span class="keywordflow">while</span> (i < len)</div>
|
|
<div class="line"><span class="lineno"> 64</span> {</div>
|
|
<div class="line"><span class="lineno"> 65</span> out[o++] = in[i];</div>
|
|
<div class="line"><span class="lineno"> 66</span> delta = rr - delta;</div>
|
|
<div class="line"><span class="lineno"> 67</span> i += delta;</div>
|
|
<div class="line"><span class="lineno"> 68</span> }</div>
|
|
<div class="line"><span class="lineno"> 69</span> }</div>
|
|
<div class="line"><span class="lineno"> 70</span> </div>
|
|
<div class="line"><span class="lineno"> 71</span> <span class="comment">// last row</span></div>
|
|
<div class="line"><span class="lineno"> 72</span> i = <a class="code hl_define" href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a>;</div>
|
|
<div class="line"><span class="lineno"> 73</span> <span class="keywordflow">while</span> (i < len)</div>
|
|
<div class="line"><span class="lineno"> 74</span> {</div>
|
|
<div class="line"><span class="lineno"> 75</span> out[o++] = in[i];</div>
|
|
<div class="line"><span class="lineno"> 76</span> i += rr;</div>
|
|
<div class="line"><span class="lineno"> 77</span> }</div>
|
|
<div class="line"><span class="lineno"> 78</span> </div>
|
|
<div class="line"><span class="lineno"> 79</span> <span class="keywordflow">return</span> out;</div>
|
|
<div class="line"><span class="lineno"> 80</span>}</div>
|
|
<div class="ttc" id="agroup__kohonen__2d_html_gaffe776513b24d84b39af8ab0930fef7f"><div class="ttname"><a href="../../d1/d6b/group__kohonen__2d.html#gaffe776513b24d84b39af8ab0930fef7f">max</a></div><div class="ttdeci">#define max(a, b)</div><div class="ttdoc">shorthand for maximum value</div><div class="ttdef"><b>Definition:</b> kohonen_som_topology.c:39</div></div>
|
|
<div class="ttc" id="amalloc__dbg_8h_html_afdddaa949a93c1ef559a638e98f9c21b"><div class="ttname"><a href="../../d2/ddd/malloc__dbg_8h.html#afdddaa949a93c1ef559a638e98f9c21b">calloc</a></div><div class="ttdeci">#define calloc(elemCount, elemSize)</div><div class="ttdoc">This macro replace the standard calloc function with calloc_dbg.</div><div class="ttdef"><b>Definition:</b> malloc_dbg.h:22</div></div>
|
|
</div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<a id="a840291bc02cba5474a4cb46a9b9566fe" name="a840291bc02cba5474a4cb46a9b9566fe"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a840291bc02cba5474a4cb46a9b9566fe">◆ </a></span>main()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">int main </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void </td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Main function. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
|
<div class="fragment"><div class="line"><span class="lineno"> 148</span>{</div>
|
|
<div class="line"><span class="lineno"> 149</span> <a class="code hl_function" href="../../d0/df3/6_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
|
<div class="line"><span class="lineno"> 150</span> <span class="keywordflow">return</span> 0;</div>
|
|
<div class="line"><span class="lineno"> 151</span>}</div>
|
|
<div class="ttc" id="a6_8c_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../d0/df3/6_8c.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition:</b> 6.c:100</div></div>
|
|
</div><!-- fragment --><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/df3/6_8c_a840291bc02cba5474a4cb46a9b9566fe_cgraph.svg" width="399" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f3851269d">◆ </a></span>test()</h2>
|
|
|
|
<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>Self-test implementations. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
|
<div class="fragment"><div class="line"><span class="lineno"> 101</span>{</div>
|
|
<div class="line"><span class="lineno"> 102</span> <span class="keywordtype">char</span>* s01 = <span class="stringliteral">"PAYPALISHIRING"</span>;</div>
|
|
<div class="line"><span class="lineno"> 103</span> </div>
|
|
<div class="line"><span class="lineno"> 104</span> <span class="keywordtype">char</span>* r01 = <span class="stringliteral">"PINALSIGYAHRPI"</span>;</div>
|
|
<div class="line"><span class="lineno"> 105</span> <a class="code hl_function" href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a>(s01, 4, r01);</div>
|
|
<div class="line"><span class="lineno"> 106</span> </div>
|
|
<div class="line"><span class="lineno"> 107</span> <span class="keywordtype">char</span>* r02 = <span class="stringliteral">"PAHNAPLSIIGYIR"</span>;</div>
|
|
<div class="line"><span class="lineno"> 108</span> <a class="code hl_function" href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a>(s01, 3, r02);</div>
|
|
<div class="line"><span class="lineno"> 109</span> </div>
|
|
<div class="line"><span class="lineno"> 110</span> <span class="keywordtype">char</span>* s03 = <span class="stringliteral">"A"</span>;</div>
|
|
<div class="line"><span class="lineno"> 111</span> <a class="code hl_function" href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a>(s03, 1, s03);</div>
|
|
<div class="line"><span class="lineno"> 112</span> <a class="code hl_function" href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a>(s03, 3, s03);</div>
|
|
<div class="line"><span class="lineno"> 113</span> </div>
|
|
<div class="line"><span class="lineno"> 114</span> <span class="keywordtype">char</span>* s04 =</div>
|
|
<div class="line"><span class="lineno"> 115</span> <span class="stringliteral">"cbxdwjccgtdoqiscyspqzvuqivzptlpvooynyapgvswoaosaghrffnxnjyeeltzaiznicc"</span></div>
|
|
<div class="line"><span class="lineno"> 116</span> <span class="stringliteral">"ozwknwyhzgpqlwfkjqipuu"</span></div>
|
|
<div class="line"><span class="lineno"> 117</span> <span class="stringliteral">"jvwtxlbznryjdohbvghmyuiggtyqjtmuqinntqmihntkddnalwnmsxsatqqeldacnnpjfe"</span></div>
|
|
<div class="line"><span class="lineno"> 118</span> <span class="stringliteral">"rmrnyuqnwbjjpdjhdeavkn"</span></div>
|
|
<div class="line"><span class="lineno"> 119</span> <span class="stringliteral">"ykpoxhxclqqedqavdwzoiorrwwxyrhlsrdgqkduvtmzzczufvtvfioygkvedervvudnegh"</span></div>
|
|
<div class="line"><span class="lineno"> 120</span> <span class="stringliteral">"bctcbxdxezrzgbpfhzanff"</span></div>
|
|
<div class="line"><span class="lineno"> 121</span> <span class="stringliteral">"eccbgqfmzjqtlrsppxqiywjobspefujlxnmddurddiyobqfspvcoulcvdrzkmkwlyiqdch"</span></div>
|
|
<div class="line"><span class="lineno"> 122</span> <span class="stringliteral">"ghrgytzdnobqcvdeqjystm"</span></div>
|
|
<div class="line"><span class="lineno"> 123</span> <span class="stringliteral">"epxcaniewqmoxkjwpymqorluxedvywhcoghotpusfgiestckrpaigocfufbubiyrrffmwa"</span></div>
|
|
<div class="line"><span class="lineno"> 124</span> <span class="stringliteral">"eeimidfnnzcphkflpbqsvt"</span></div>
|
|
<div class="line"><span class="lineno"> 125</span> <span class="stringliteral">"dwludsgaungfzoihbxifoprwcjzsdxngtacw"</span>;</div>
|
|
<div class="line"><span class="lineno"> 126</span> </div>
|
|
<div class="line"><span class="lineno"> 127</span> <span class="keywordtype">char</span>* r04 =</div>
|
|
<div class="line"><span class="lineno"> 128</span> <span class="stringliteral">"cbxdwjccgtdoqiscyspqzvuqivzptlpvooynyapgvswoaosaghrffnxnjyeeltzaiznicc"</span></div>
|
|
<div class="line"><span class="lineno"> 129</span> <span class="stringliteral">"ozwknwyhzgpqlwfkjqipuu"</span></div>
|
|
<div class="line"><span class="lineno"> 130</span> <span class="stringliteral">"jvwtxlbznryjdohbvghmyuiggtyqjtmuqinntqmihntkddnalwnmsxsatqqeldacnnpjfe"</span></div>
|
|
<div class="line"><span class="lineno"> 131</span> <span class="stringliteral">"rmrnyuqnwbjjpdjhdeavkn"</span></div>
|
|
<div class="line"><span class="lineno"> 132</span> <span class="stringliteral">"ykpoxhxclqqedqavdwzoiorrwwxyrhlsrdgqkduvtmzzczufvtvfioygkvedervvudnegh"</span></div>
|
|
<div class="line"><span class="lineno"> 133</span> <span class="stringliteral">"bctcbxdxezrzgbpfhzanff"</span></div>
|
|
<div class="line"><span class="lineno"> 134</span> <span class="stringliteral">"eccbgqfmzjqtlrsppxqiywjobspefujlxnmddurddiyobqfspvcoulcvdrzkmkwlyiqdch"</span></div>
|
|
<div class="line"><span class="lineno"> 135</span> <span class="stringliteral">"ghrgytzdnobqcvdeqjystm"</span></div>
|
|
<div class="line"><span class="lineno"> 136</span> <span class="stringliteral">"epxcaniewqmoxkjwpymqorluxedvywhcoghotpusfgiestckrpaigocfufbubiyrrffmwa"</span></div>
|
|
<div class="line"><span class="lineno"> 137</span> <span class="stringliteral">"eeimidfnnzwccpahtkgfnl"</span></div>
|
|
<div class="line"><span class="lineno"> 138</span> <span class="stringliteral">"xpdbsqzsjvctwdrwploufdisxgbahuinogzf"</span>;</div>
|
|
<div class="line"><span class="lineno"> 139</span> </div>
|
|
<div class="line"><span class="lineno"> 140</span> <a class="code hl_function" href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a>(s04, 472, r04);</div>
|
|
<div class="line"><span class="lineno"> 141</span>}</div>
|
|
<div class="ttc" id="a6_8c_html_a109c3813445bcf97d154a671119deae9"><div class="ttname"><a href="../../d0/df3/6_8c.html#a109c3813445bcf97d154a671119deae9">testZigZag</a></div><div class="ttdeci">static void testZigZag(char *s, int numRows, char *expected)</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition:</b> 6.c:86</div></div>
|
|
</div><!-- fragment --><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/df3/6_8c_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="300" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<a id="a109c3813445bcf97d154a671119deae9" name="a109c3813445bcf97d154a671119deae9"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a109c3813445bcf97d154a671119deae9">◆ </a></span>testZigZag()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">static void testZigZag </td>
|
|
<td>(</td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>s</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">int </td>
|
|
<td class="paramname"><em>numRows</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">char * </td>
|
|
<td class="paramname"><em>expected</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</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>Self-test implementations. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
|
|
<div class="fragment"><div class="line"><span class="lineno"> 87</span>{</div>
|
|
<div class="line"><span class="lineno"> 88</span> <span class="keywordtype">char</span>* ret = <a class="code hl_function" href="../../d0/df3/6_8c.html#afdf3bfe2dc8aadac13c7e6d051d3bd5d">convert</a>(s, numRows);</div>
|
|
<div class="line"><span class="lineno"> 89</span> <span class="keywordtype">int</span> len = strlen(s);</div>
|
|
<div class="line"><span class="lineno"> 90</span> <span class="keywordtype">int</span> cmp = strncmp(ret, expected, len);</div>
|
|
<div class="line"><span class="lineno"> 91</span> assert(!cmp);</div>
|
|
<div class="line"><span class="lineno"> 92</span> </div>
|
|
<div class="line"><span class="lineno"> 93</span> <a class="code hl_define" href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a>(ret);</div>
|
|
<div class="line"><span class="lineno"> 94</span>}</div>
|
|
<div class="ttc" id="a6_8c_html_afdf3bfe2dc8aadac13c7e6d051d3bd5d"><div class="ttname"><a href="../../d0/df3/6_8c.html#afdf3bfe2dc8aadac13c7e6d051d3bd5d">convert</a></div><div class="ttdeci">char * convert(char *in, uint16_t numRows)</div><div class="ttdoc">for assert for unsigned int with fixed size</div><div class="ttdef"><b>Definition:</b> 6.c:29</div></div>
|
|
<div class="ttc" id="amalloc__dbg_8h_html_a9cc854374299a1dd933bf62029761768"><div class="ttname"><a href="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a></div><div class="ttdeci">#define free(ptr)</div><div class="ttdoc">This macro replace the standard free function with free_dbg.</div><div class="ttdef"><b>Definition:</b> malloc_dbg.h:26</div></div>
|
|
</div><!-- fragment --><div class="dynheader">
|
|
Here is the call graph for this function:</div>
|
|
<div class="dyncontent">
|
|
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/df3/6_8c_a109c3813445bcf97d154a671119deae9_cgraph.svg" width="208" height="36"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
|
</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>
|
|
<li class="navelem"><a class="el" href="../../dir_03902f230b9e9b7c999f936617a23997.html">leetcode</a></li><li class="navelem"><a class="el" href="../../dir_614f310c248f2b9541b559085cafcb40.html">src</a></li><li class="navelem"><a class="el" href="../../d0/df3/6_8c.html">6.c</a></li>
|
|
<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>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|