<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: C++ program to implement B-Trees	</title>
	<atom:link href="https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/feed/" rel="self" type="application/rss+xml" />
	<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/</link>
	<description>Microcontroller projects, Circuit Diagrams, Project Ideas</description>
	<lastBuildDate>Fri, 22 Aug 2014 07:32:26 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>
	<item>
		<title>
		By: solomon		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-22404</link>

		<dc:creator><![CDATA[solomon]]></dc:creator>
		<pubDate>Fri, 22 Aug 2014 07:32:26 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-22404</guid>

					<description><![CDATA[asdasd.]]></description>
			<content:encoded><![CDATA[<p>asdasd.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: zahra		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-13089</link>

		<dc:creator><![CDATA[zahra]]></dc:creator>
		<pubDate>Sun, 15 Jun 2014 08:34:40 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-13089</guid>

					<description><![CDATA[I need c# code of this!!does anybody have it???]]></description>
			<content:encoded><![CDATA[<p>I need c# code of this!!does anybody have it???</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Angry MAN		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-9798</link>

		<dc:creator><![CDATA[Angry MAN]]></dc:creator>
		<pubDate>Sat, 25 May 2013 06:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-9798</guid>

					<description><![CDATA[Hello,

Nice program but too long to get into my head. Looks like you copied this from another site. Write a short program ASAP, else I&#039;m gonna kick your ass.]]></description>
			<content:encoded><![CDATA[<p>Hello,</p>
<p>Nice program but too long to get into my head. Looks like you copied this from another site. Write a short program ASAP, else I&#8217;m gonna kick your ass.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: jacinth		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-9346</link>

		<dc:creator><![CDATA[jacinth]]></dc:creator>
		<pubDate>Sat, 22 Dec 2012 13:49:48 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-9346</guid>

					<description><![CDATA[plz send the program with short code...nt lengthy one...]]></description>
			<content:encoded><![CDATA[<p>plz send the program with short code&#8230;nt lengthy one&#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Valentina		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-9280</link>

		<dc:creator><![CDATA[Valentina]]></dc:creator>
		<pubDate>Sun, 02 Dec 2012 19:57:00 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-9280</guid>

					<description><![CDATA[Thank you so much !! 

A few helpful edits: 

One of the lines in merge is incorrect- you set temp2&#039;s child final pointer equal to the roots child 0, which is itself. This leads to an infinite loop when trying to print or delete etc. 

The corrected version is below: 

void btree :: merge ( int k )
{
	btnode *temp1, *temp2 ;
	temp1 = root -&#062; child[k] ;
	temp2 = root -&#062; child[k - 1] ;
	temp2 -&#062; count++ ;
	temp2 -&#062; value[temp2 -&#062; count] = root -&#062; value[k] ;
	temp2 -&#062; child[temp2 -&#062; count] = root -&#062; temp1[0] ;     //  &#060;-- this line is the changed line 


Also, I dont understand why your leftshift rightshift and merge all use the root instead of a passed node. Maybe this works, but I found that I had to pass in the node I was currently working on instead of using the root. My full edited rightshift, leftshift, and merge functions are below. 

template 
void BTree::leftshift( int k, BTreeNode * t){
    BTreeNode * temp;
    temp = t -&#062; ptr[k-1];
    temp-&#062;totalKeys++;
    temp-&#062;keys[temp-&#062;totalKeys] = t -&#062; keys[k];
    temp-&#062;ptr[temp-&#062;totalKeys] = t -&#062; ptr[k] -&#062; ptr[0];
    temp= t-&#062;ptr[k];
    t-&#062;keys[k] = temp -&#062; keys[1];
    temp-&#062;ptr[0] = temp-&#062; ptr[1];
    temp-&#062;totalKeys--;
    for (int i=1; i totalKeys; i++){
        temp-&#062;keys[i] = temp-&#062;keys[i+1];
        temp-&#062;ptr[i] = temp-&#062;ptr[i+1];
    }
}

template 
void BTree::rightshift( int i, BTreeNode * t) {
    BTreeNode *temp, *temp2;
    temp = t -&#062; ptr[i];
    temp2 = t -&#062; ptr[i-1];
    for (int j=temp-&#062;totalKeys; j &#062;0; j--){
            temp-&#062;keys[j+1] = temp-&#062;keys[j];
            temp-&#062;ptr[j+1] = temp-&#062;ptr[j];
        }
    temp-&#062;ptr[1] = temp-&#062; ptr[0];
    temp-&#062;totalKeys++;
    temp-&#062;keys[1] = t-&#062;keys[i];
    t-&#062;keys[i] = temp2 -&#062; keys[temp2-&#062;totalKeys];
    t-&#062;ptr[i]-&#062;ptr[0] = temp2 -&#062; ptr[temp2-&#062;totalKeys];
   temp2-&#062;totalKeys--;
}

template 
void BTree::merge(int i, BTreeNode * t){
    BTreeNode *temp1, *temp2;
    temp1 = t -&#062; ptr[i];
    temp2 = t -&#062;ptr[i-1];
    temp2 -&#062; totalKeys++;
    temp2 -&#062;keys[temp2-&#062;totalKeys] = t-&#062;keys[i];
    temp2 -&#062;ptr[temp2-&#062;totalKeys] = temp1-&#062;ptr[0];
    for (int j = 1; j  totalKeys; j++ ) {
        temp2 -&#062; totalKeys++;
        temp2-&#062; keys[temp2-&#062;totalKeys] = temp1 -&#062; keys[j];
        temp2-&#062; ptr[temp2-&#062;totalKeys] = temp1 -&#062; ptr[j];
    }
    for (int j = i; j totalKeys; j++ ) {
        t-&#062; keys[j] = t -&#062; keys[j+1];
        t-&#062; ptr[j] = t -&#062; ptr[j+1];
    }
    t-&#062;totalKeys--;
    delete temp1; 
}]]></description>
			<content:encoded><![CDATA[<p>Thank you so much !! </p>
<p>A few helpful edits: </p>
<p>One of the lines in merge is incorrect- you set temp2&#8217;s child final pointer equal to the roots child 0, which is itself. This leads to an infinite loop when trying to print or delete etc. </p>
<p>The corrected version is below: </p>
<p>void btree :: merge ( int k )<br />
{<br />
	btnode *temp1, *temp2 ;<br />
	temp1 = root -&gt; child[k] ;<br />
	temp2 = root -&gt; child[k &#8211; 1] ;<br />
	temp2 -&gt; count++ ;<br />
	temp2 -&gt; value[temp2 -&gt; count] = root -&gt; value[k] ;<br />
	temp2 -&gt; child[temp2 -&gt; count] = root -&gt; temp1[0] ;     //  &lt;&#8211; this line is the changed line </p>
<p>Also, I dont understand why your leftshift rightshift and merge all use the root instead of a passed node. Maybe this works, but I found that I had to pass in the node I was currently working on instead of using the root. My full edited rightshift, leftshift, and merge functions are below. </p>
<p>template<br />
void BTree::leftshift( int k, BTreeNode * t){<br />
    BTreeNode * temp;<br />
    temp = t -&gt; ptr[k-1];<br />
    temp-&gt;totalKeys++;<br />
    temp-&gt;keys[temp-&gt;totalKeys] = t -&gt; keys[k];<br />
    temp-&gt;ptr[temp-&gt;totalKeys] = t -&gt; ptr[k] -&gt; ptr[0];<br />
    temp= t-&gt;ptr[k];<br />
    t-&gt;keys[k] = temp -&gt; keys[1];<br />
    temp-&gt;ptr[0] = temp-&gt; ptr[1];<br />
    temp-&gt;totalKeys&#8211;;<br />
    for (int i=1; i totalKeys; i++){<br />
        temp-&gt;keys[i] = temp-&gt;keys[i+1];<br />
        temp-&gt;ptr[i] = temp-&gt;ptr[i+1];<br />
    }<br />
}</p>
<p>template<br />
void BTree::rightshift( int i, BTreeNode * t) {<br />
    BTreeNode *temp, *temp2;<br />
    temp = t -&gt; ptr[i];<br />
    temp2 = t -&gt; ptr[i-1];<br />
    for (int j=temp-&gt;totalKeys; j &gt;0; j&#8211;){<br />
            temp-&gt;keys[j+1] = temp-&gt;keys[j];<br />
            temp-&gt;ptr[j+1] = temp-&gt;ptr[j];<br />
        }<br />
    temp-&gt;ptr[1] = temp-&gt; ptr[0];<br />
    temp-&gt;totalKeys++;<br />
    temp-&gt;keys[1] = t-&gt;keys[i];<br />
    t-&gt;keys[i] = temp2 -&gt; keys[temp2-&gt;totalKeys];<br />
    t-&gt;ptr[i]-&gt;ptr[0] = temp2 -&gt; ptr[temp2-&gt;totalKeys];<br />
   temp2-&gt;totalKeys&#8211;;<br />
}</p>
<p>template<br />
void BTree::merge(int i, BTreeNode * t){<br />
    BTreeNode *temp1, *temp2;<br />
    temp1 = t -&gt; ptr[i];<br />
    temp2 = t -&gt;ptr[i-1];<br />
    temp2 -&gt; totalKeys++;<br />
    temp2 -&gt;keys[temp2-&gt;totalKeys] = t-&gt;keys[i];<br />
    temp2 -&gt;ptr[temp2-&gt;totalKeys] = temp1-&gt;ptr[0];<br />
    for (int j = 1; j  totalKeys; j++ ) {<br />
        temp2 -&gt; totalKeys++;<br />
        temp2-&gt; keys[temp2-&gt;totalKeys] = temp1 -&gt; keys[j];<br />
        temp2-&gt; ptr[temp2-&gt;totalKeys] = temp1 -&gt; ptr[j];<br />
    }<br />
    for (int j = i; j totalKeys; j++ ) {<br />
        t-&gt; keys[j] = t -&gt; keys[j+1];<br />
        t-&gt; ptr[j] = t -&gt; ptr[j+1];<br />
    }<br />
    t-&gt;totalKeys&#8211;;<br />
    delete temp1;<br />
}</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: trisha		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-9050</link>

		<dc:creator><![CDATA[trisha]]></dc:creator>
		<pubDate>Tue, 09 Oct 2012 13:18:03 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-9050</guid>

					<description><![CDATA[y this is kolaveri kolaveri Mr.ranjith]]></description>
			<content:encoded><![CDATA[<p>y this is kolaveri kolaveri Mr.ranjith</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: madhuri		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-8945</link>

		<dc:creator><![CDATA[madhuri]]></dc:creator>
		<pubDate>Mon, 24 Sep 2012 03:49:53 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-8945</guid>

					<description><![CDATA[reduce the length of code and make it simple so that human beings can understand.]]></description>
			<content:encoded><![CDATA[<p>reduce the length of code and make it simple so that human beings can understand.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: nisha		</title>
		<link>https://studentprojects.in/software-development/cpp/cpp-programs/cpp-data-structure/c-program-to-implement-b-trees/comment-page-1/#comment-8830</link>

		<dc:creator><![CDATA[nisha]]></dc:creator>
		<pubDate>Mon, 03 Sep 2012 10:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://studentprojects.in/?p=1277#comment-8830</guid>

					<description><![CDATA[itz awsme.................thanku]]></description>
			<content:encoded><![CDATA[<p>itz awsme&#8230;&#8230;&#8230;&#8230;&#8230;..thanku</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
