mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 13:53:35 +08:00
Documentation for f7a5aecce5
This commit is contained in:
131
d4/d0e/classdata__structures_1_1linked__list_1_1_node.html
Normal file
131
d4/d0e/classdata__structures_1_1linked__list_1_1_node.html
Normal file
@@ -0,0 +1,131 @@
|
||||
<!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">
|
||||
<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.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: data_structures::linked_list::Node Class 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 style="height: 56px;">
|
||||
<td id="projectalign" style="padding-left: 0.5em;">
|
||||
<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.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search",'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('d4/d0e/classdata__structures_1_1linked__list_1_1_node.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">
|
||||
<iframe src="javascript:void(0)" frameborder="0"
|
||||
name="MSearchResults" id="MSearchResults">
|
||||
</iframe>
|
||||
</div>
|
||||
|
||||
<div class="header">
|
||||
<div class="summary">
|
||||
<a href="#pub-attribs">Public Attributes</a> |
|
||||
<a href="../../d7/d5e/classdata__structures_1_1linked__list_1_1_node-members.html">List of all members</a> </div>
|
||||
<div class="headertitle"><div class="title">data_structures::linked_list::Node Class Reference</div></div>
|
||||
</div><!--header-->
|
||||
<div class="contents">
|
||||
<div class="dynheader">
|
||||
Collaboration diagram for data_structures::linked_list::Node:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/d30/classdata__structures_1_1linked__list_1_1_node__coll__graph.svg" width="220" height="52"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
|
||||
</div>
|
||||
<center><span class="legend">[<a target="top" href="../../graph_legend.html">legend</a>]</span></center></div>
|
||||
<table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
|
||||
Public Attributes</h2></td></tr>
|
||||
<tr class="memitem:a6ff2c183de573154c41eb54a9bb2d131"><td class="memItemLeft" align="right" valign="top"><a id="a6ff2c183de573154c41eb54a9bb2d131" name="a6ff2c183de573154c41eb54a9bb2d131"></a>
|
||||
int32_t </td><td class="memItemRight" valign="bottom"><b>val</b></td></tr>
|
||||
<tr class="separator:a6ff2c183de573154c41eb54a9bb2d131"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:acfccd7b52c91d91300c5b317e5ec7a6e"><td class="memItemLeft" align="right" valign="top"><a id="acfccd7b52c91d91300c5b317e5ec7a6e" name="acfccd7b52c91d91300c5b317e5ec7a6e"></a>
|
||||
<a class="el" href="../../d4/d0e/classdata__structures_1_1linked__list_1_1_node.html">Node</a> * </td><td class="memItemRight" valign="bottom"><b>next</b></td></tr>
|
||||
<tr class="memdesc:acfccd7b52c91d91300c5b317e5ec7a6e"><td class="mdescLeft"> </td><td class="mdescRight">value of the current link <br /></td></tr>
|
||||
<tr class="separator:acfccd7b52c91d91300c5b317e5ec7a6e"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >A <a class="el" href="../../d4/d0e/classdata__structures_1_1linked__list_1_1_node.html">Node</a> class containing a value and pointer to another link </p>
|
||||
</div><hr/>The documentation for this class was generated from the following file:<ul>
|
||||
<li>data_structures/<a class="el" href="../../d6/d05/reverse__a__linked__list_8cpp.html">reverse_a_linked_list.cpp</a></li>
|
||||
</ul>
|
||||
</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="../../d5/d3c/namespacedata__structures.html">data_structures</a></li><li class="navelem"><b>linked_list</b></li><li class="navelem"><a class="el" href="../../d4/d0e/classdata__structures_1_1linked__list_1_1_node.html">Node</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.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
4
d4/d0e/classdata__structures_1_1linked__list_1_1_node.js
Normal file
4
d4/d0e/classdata__structures_1_1linked__list_1_1_node.js
Normal file
@@ -0,0 +1,4 @@
|
||||
var classdata__structures_1_1linked__list_1_1_node =
|
||||
[
|
||||
[ "next", "d4/d0e/classdata__structures_1_1linked__list_1_1_node.html#acfccd7b52c91d91300c5b317e5ec7a6e", null ]
|
||||
];
|
||||
@@ -163,21 +163,21 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >An implementation for finding the <a href="https://www.youtube.com/watch?v=5cPbNCrdotA" target="_blank">Inorder successor of a binary search tree</a> Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. Inorder Successor is NULL for the last node in Inorder traversal. </p>
|
||||
<h3><a class="anchor" id="autotoc_md79"></a>
|
||||
<h3><a class="anchor" id="autotoc_md80"></a>
|
||||
Case 1: The given node has the right node/subtree</h3>
|
||||
<pre class="fragment"> * In this case, the left-most deepest node in the right subtree will
|
||||
</pre><p> come just after the given node as we go to left deep in inorder.</p><ul>
|
||||
<li>Go deep to left most node in right subtree. OR, we can also say in case if BST, find the minimum of the subtree for a given node.</li>
|
||||
</ul>
|
||||
<h3><a class="anchor" id="autotoc_md80"></a>
|
||||
<h3><a class="anchor" id="autotoc_md81"></a>
|
||||
Case 2: The given node does not have a right node/subtree</h3>
|
||||
<h4><a class="anchor" id="autotoc_md81"></a>
|
||||
<h4><a class="anchor" id="autotoc_md82"></a>
|
||||
Method 1: Use parent pointer (store the address of parent nodes)</h4>
|
||||
<ul>
|
||||
<li>If a node does not have the right subtree, and we already visited the node itself, then the next node will be its parent node according to inorder traversal, and if we are going to parent from left, then the parent would be unvisited.</li>
|
||||
<li>In other words, go to the nearest ancestor for which given node would be in left subtree.</li>
|
||||
</ul>
|
||||
<h4><a class="anchor" id="autotoc_md82"></a>
|
||||
<h4><a class="anchor" id="autotoc_md83"></a>
|
||||
Method 2: Search from the root node</h4>
|
||||
<ul>
|
||||
<li>In case if there is no link from a child node to the parent node, we need to walk down the tree starting from the root node to the given node, by doing so, we are visiting every ancestor of the given node.</li>
|
||||
|
||||
@@ -125,7 +125,7 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Implementation to check whether a number is a power of 2 or not. </p>
|
||||
<p >This algorithm uses bit manipulation to check if a number is a power of 2 or not.</p>
|
||||
<h3><a class="anchor" id="autotoc_md77"></a>
|
||||
<h3><a class="anchor" id="autotoc_md78"></a>
|
||||
Algorithm</h3>
|
||||
<p >Let the input number be n, then the bitwise and between n and n-1 will let us know whether the number is power of 2 or not</p>
|
||||
<p >For Example, If N= 32 then N-1 is 31, if we perform bitwise and of these two numbers then the result will be zero, which indicates that it is the power of 2 If N=23 then N-1 is 22, if we perform bitwise and of these two numbers then the result will not be zero , which indicates that it is not the power of 2 </p><dl class="section note"><dt>Note</dt><dd>This implementation is better than naive recursive or iterative approach.</dd></dl>
|
||||
|
||||
@@ -136,7 +136,7 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Implementation of <a href="https://en.wikipedia.org/wiki/Gift_wrapping_algorithm" target="_blank">Jarvis’s</a> algorithm. </p>
|
||||
<p >Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of it.</p>
|
||||
<h3><a class="anchor" id="autotoc_md65"></a>
|
||||
<h3><a class="anchor" id="autotoc_md66"></a>
|
||||
Algorithm</h3>
|
||||
<p >The idea of Jarvis’s Algorithm is simple, we start from the leftmost point (or point with minimum x coordinate value) and we keep wrapping points in counterclockwise direction.</p>
|
||||
<p >The idea is to use orientation() here. Next point is selected as the point that beats all other points at counterclockwise orientation, i.e., next point is q if for any other point r, we have “orientation(p, q, r) = counterclockwise”.</p>
|
||||
|
||||
@@ -139,7 +139,7 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Implementation of the <a href="https://en.wikipedia.org/wiki/Selection_sort" target="_blank">Selection sort</a> implementation using recursion. </p>
|
||||
<p >The selection sort algorithm divides the input list into two parts: a sorted sublist of items which is built up from left to right at the front (left) of the list, and a sublist of the remaining unsorted items that occupy the rest of the list. Initially, the sorted sublist is empty, and the unsorted sublist is the entire input list. The algorithm proceeds by finding the smallest (or largest, depending on the sorting order) element in the unsorted sublist, exchanging (swapping) it with the leftmost unsorted element (putting it in sorted order), and moving the sublist boundaries one element to the right.</p>
|
||||
<h3><a class="anchor" id="autotoc_md99"></a>
|
||||
<h3><a class="anchor" id="autotoc_md100"></a>
|
||||
Implementation</h3>
|
||||
<p >FindMinIndex This function finds the minimum element of the array(list) recursively by simply comparing the minimum element of array reduced size by 1 and compares it to the last element of the array to find the minimum of the whole array.</p>
|
||||
<p >SelectionSortRecursive Just like selection sort, it divides the list into two parts (i.e.: sorted and unsorted) and finds the minimum of the unsorted array. By calling the <code>FindMinIndex</code> function, it swaps the minimum element with the first element of the list, and then solves recursively for the remaining unsorted list. </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/Tushar-K24" target="_blank">Tushar Khanduri</a> </dd></dl>
|
||||
|
||||
Reference in New Issue
Block a user