<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Interactive Soft &#187; Data Structures Lessons</title>
	<atom:link href="http://issite.wordpress.com/category/data-structures-lessons/feed/" rel="self" type="application/rss+xml" />
	<link>http://issite.wordpress.com</link>
	<description>انظمة معلومات - برامج - شبكات - تصميم مواقع -أجهزة وملحقات كمبيوتر</description>
	<lastBuildDate>Thu, 26 Jun 2008 16:52:40 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='issite.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/de0f8466acb95bfcc1cd11e4fa2facc2?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Interactive Soft &#187; Data Structures Lessons</title>
		<link>http://issite.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://issite.wordpress.com/osd.xml" title="Interactive Soft" />
		<item>
		<title>Stacks Implementation</title>
		<link>http://issite.wordpress.com/2007/06/02/stacks-implementation/</link>
		<comments>http://issite.wordpress.com/2007/06/02/stacks-implementation/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 20:18:44 +0000</pubDate>
		<dc:creator>Mohamed Ezeddin</dc:creator>
				<category><![CDATA[Data Structures Lessons]]></category>

		<guid isPermaLink="false">http://issite.wordpress.com/2007/06/02/stacks-implementation/</guid>
		<description><![CDATA[The first implementation uses an array to create the stack
data structure, and the second implementation uses pointers.


Array Implementation
In order to implement a stack using an array, we need to reserve a
block of memory cells large enough to hold all the items we want to
put on the stack. The picture below shows an array of six [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=issite.wordpress.com&blog=491883&post=40&subd=issite&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote><p>The first implementation uses an array to create the stack<br />
data structure, and the second implementation uses pointers.<span id="more-40"></span></p></blockquote>
<blockquote></blockquote>
<blockquote></blockquote>
<blockquote><p><strong>Array Implementation</strong></p></blockquote>
<blockquote><p>In order to implement a stack using an array, we need to reserve a<br />
block of memory cells large enough to hold all the items we want to<br />
put on the stack. The picture below shows an array of six memory cells<br />
that represent our stack. Notice that we have one other memory cell<br />
called a stack pointer that holds the location of the top of our stack.<br />
As the stack grows and shrinks, this pointer is updated so that it always<br />
points to the top item of the stack.</p>
<p align="center"><a href="http://issite.wordpress.com/2007/06/02/stacks-implementation/stack_arraygif/" rel="attachment wp-att-41" title="stack_array.gif"><img src="http://issite.files.wordpress.com/2007/06/stack_array.gif" alt="stack_array.gif" /></a></p>
</blockquote>
<p align="center">&nbsp;</p>
<blockquote><p>Notice that our array implementation retains one of the problems we<br />
saw with the array implementation of an ordered list. Since our array<br />
is a fixed size, our stack can only grow to a certain size. Once our<br />
stack is full, we will have to use the <strong>PopStackItem</strong> operation<br />
before we can push any more items onto the stack. To make the size of<br />
our stack more flexible, we can use pointers to implement the stack.</p>
<p><!--more--></p>
<p><strong>Pointer Implementation</strong></p>
<p>In order to implement a stack using pointers, we need to link nodes<br />
(groups of memory cells) together just like we did for the pointer implementation<br />
of a list. Each node contains a stack item and a pointer to the next<br />
node. We also need a special pointer to keep track of the top of our<br />
stack.</p>
<p align="center"><a href="http://issite.wordpress.com/2007/06/02/stacks-implementation/stack_linked_listgif/" rel="attachment wp-att-42" title="stack_linked_list.gif"><img src="http://issite.files.wordpress.com/2007/06/stack_linked_list.gif" alt="stack_linked_list.gif" /></a></p>
</blockquote>
<p align="center">&nbsp;</p>
<blockquote><p>Notice that the stack operations can get a little tricky when we use<br />
pointers. To push an item onto the stack, we need to find a free memory<br />
location, set the pointer of the new location to the top of the stack,<br />
and finally set the stack pointer to the new location. The order of<br />
these operations is very important. If we set the stack pointer to the<br />
location of the new memory first, we will lose the location of the top<br />
of our stack. This example shows the same tradeoff that we saw earlier<br />
with the ordered list implementations. While the array implementation<br />
is simpler, the added complexity of the pointer implementation gives<br />
us a more flexible stack.</p></blockquote>
<blockquote></blockquote>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/issite.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/issite.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/issite.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/issite.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/issite.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/issite.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/issite.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/issite.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/issite.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/issite.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/issite.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/issite.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=issite.wordpress.com&blog=491883&post=40&subd=issite&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://issite.wordpress.com/2007/06/02/stacks-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7048021ab1e0ff7159a37886631c82d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mea6</media:title>
		</media:content>

		<media:content url="http://issite.files.wordpress.com/2007/06/stack_array.gif" medium="image">
			<media:title type="html">stack_array.gif</media:title>
		</media:content>

		<media:content url="http://issite.files.wordpress.com/2007/06/stack_linked_list.gif" medium="image">
			<media:title type="html">stack_linked_list.gif</media:title>
		</media:content>
	</item>
		<item>
		<title>Pointers</title>
		<link>http://issite.wordpress.com/2007/06/02/pointers/</link>
		<comments>http://issite.wordpress.com/2007/06/02/pointers/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 19:28:00 +0000</pubDate>
		<dc:creator>Mohamed Ezeddin</dc:creator>
				<category><![CDATA[Data Structures Lessons]]></category>

		<guid isPermaLink="false">http://issite.wordpress.com/2007/06/02/pointers/</guid>
		<description><![CDATA[In our last lesson, we discovered a problem  with representing data structures that are not linear. We need some way to map  these data structures to the computer&#8217;s linear memory. One solution is to use  pointers. Pointers are memory locations that are stored in memory cells. By  using a pointer, one [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=issite.wordpress.com&blog=491883&post=37&subd=issite&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote><p>In our last lesson, we discovered a problem  with representing data structures that are not linear.<span id="more-37"></span> We need some way to map  these data structures to the computer&#8217;s linear memory. One solution is to use  pointers. Pointers are memory locations that are stored in memory cells. By  using a pointer, one memory cell can &#8220;point&#8221; to another memory cell by holding a  memory address rather than data. Let&#8217;s see how it works.</p>
<p align="center"><a href="http://issite.wordpress.com/2007/06/02/pointers/pointer_examplegif/" rel="attachment wp-att-36" title="pointer_example.gif"><img src="http://issite.files.wordpress.com/2007/06/pointer_example.gif" alt="pointer_example.gif" /></a></p>
</blockquote>
<p align="center"><a href="http://issite.files.wordpress.com/2007/06/double_indirect.gif" title="double_indirect.gif"><br />
</a></p>
<blockquote><p>In the  diagram above, the memory cell at address 2003 contains a pointer, an address of  another cell. In this case, the pointer is pointing to the memory cell 2005  which contains the letter &#8216;c&#8217;. This means that we now have two ways of accessing  the letter &#8216;c&#8217; as stored data. We can refer to the memory cell which contains  &#8216;c&#8217; directly or we can use our pointer to refer to it indirectly. The process of  accessing data through pointers is known as indirection. We can also create  multiple levels of indirection using pointers. The diagram below shows an  example of double indirection. Notice that we must follow two pointers this time  to reach the stored data.</p>
<p align="center"> <a href="http://issite.wordpress.com/2007/06/02/pointers/double_indirectgif/" rel="attachment wp-att-38" title="double_indirect.gif"><img src="http://issite.files.wordpress.com/2007/06/double_indirect.gif" alt="double_indirect.gif" /></a></p>
</blockquote>
<blockquote><p>  <a href="http://issite.wordpress.com/2007/06/02/pointers/pointer_examplegif/" rel="attachment wp-att-36" title="pointer_example.gif"></a></p>
<p style="text-align:center;"><a href="http://issite.wordpress.com/2007/06/02/pointers/pointer_examplegif/" rel="attachment wp-att-36" title="pointer_example.gif"> </a></p>
<p>As you  can see, pointers can become very complex and difficult to use with many levels  of indirection. In fact, when used incorrectly, pointers can make data  structures very difficult to understand. Whenever we use pointers in  constructing data structures, we have to consider the tradeoff between  complexity and flexibility. We will consider some examples of this tradeoff in  the next few lessons.</p>
<p>The idea of  pointers and indirection is not exclusive to computer memory. Pointers appear in  many different aspects of computer use. A good example is hyperlinks in web  pages. This links are really pointers to another web page. Perhaps you have even  experienced &#8220;double indirection&#8221; when you went to visit a familiar web site and  found the site had moved. Instead of the page you expected, you saw a notice  that the web pages had been moved and a link to the new site. Rather than  clicking a single link, you had to follow two links or two pointers to reach the  web page.</p></blockquote>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/issite.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/issite.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/issite.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/issite.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/issite.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/issite.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/issite.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/issite.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/issite.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/issite.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/issite.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/issite.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=issite.wordpress.com&blog=491883&post=37&subd=issite&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://issite.wordpress.com/2007/06/02/pointers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7048021ab1e0ff7159a37886631c82d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mea6</media:title>
		</media:content>

		<media:content url="http://issite.files.wordpress.com/2007/06/pointer_example.gif" medium="image">
			<media:title type="html">pointer_example.gif</media:title>
		</media:content>

		<media:content url="http://issite.files.wordpress.com/2007/06/double_indirect.gif" medium="image">
			<media:title type="html">double_indirect.gif</media:title>
		</media:content>
	</item>
		<item>
		<title>Stack</title>
		<link>http://issite.wordpress.com/2007/06/02/stack/</link>
		<comments>http://issite.wordpress.com/2007/06/02/stack/#comments</comments>
		<pubDate>Sat, 02 Jun 2007 19:14:55 +0000</pubDate>
		<dc:creator>Mohamed Ezeddin</dc:creator>
				<category><![CDATA[Data Structures Lessons]]></category>

		<guid isPermaLink="false">http://issite.wordpress.com/2007/06/02/stack/</guid>
		<description><![CDATA[Another common linear data structure is the stack. Just like we did
with the ordered list, we will examine the abstract view of a stack
first and then look at a couple of ways a stack can be implemented.
In one way, a stack is very similar to a list except that a stack is
more restricted. The animation [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=issite.wordpress.com&blog=491883&post=35&subd=issite&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote><p>Another common linear data structure is the stack.<span id="more-35"></span> Just like we did<br />
with the ordered list, we will examine the abstract view of a stack<br />
first and then look at a couple of ways a stack can be implemented.<br />
In one way, a stack is very similar to a list except that a stack is<br />
more restricted. The animation below should give you a good idea of<br />
the abstract view of a stack. Follow the directions to manipulate a<br />
simple stack and learn about the operations that a stack provides.</p></blockquote>
<blockquote><p><a href="http://www.geocities.com/mea2006first/DS/stack.swf" title="Interactive Solution View Stack" target="_blank">Press here to see  how to use Stack  (Flash Movie)</a><!--more--></p></blockquote>
<blockquote></blockquote>
<p align="center">&nbsp;</p>
<blockquote><p>Now that you know how a stack works, you can see that this data structure<br />
is really a restricted list. With the stack, we have restricted the<br />
access to one end of the list by using the pop and push operations.<br />
The result of this restriction is that items in the list pile one on<br />
top of the other. To get to the bottom item, we must first remove all<br />
the items above it. This behavior is sometimes described as &#8220;last-in,<br />
first-out&#8221; or LIFO since the last item to enter the stack is the<br />
first item to leave the stack. With the stack, the top item is always<br />
the last item to enter the stack and it is always the first item to<br />
leave the stack since no other items can be removed until the top item<br />
is removed.</p>
<p>Let&#8217;s take another look at the operations that can be performed on<br />
a stack. We will represent these two operations with the following notation:</p></blockquote>
<blockquote><p><strong><font color="#ffffff">Item  </font>PushStackItem(Stack,<br />
Item)</strong></p>
<p><strong>Item  PopStackItem(Stack)</strong></p></blockquote>
<p>The <strong>PushStackItem</strong> operation has two parameters which are a stack<br />
and an item. This operation adds the item to the top of the specified<br />
stack. The <strong>PopStackItem</strong> operation only takes one parameter which<br />
is a stack. However, notice that this operation has the keyword <strong>Item</strong><br />
listed to the left. This keyword represents the item that is removed<br />
from the top of the stack when the <strong>PopStackItem</strong> operation is<br />
done. These two operations are part of the abstract view of a stack.<br />
They are what we expect from any stack regardless of how it is implemented<br />
in the computer.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/issite.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/issite.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/issite.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/issite.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/issite.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/issite.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/issite.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/issite.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/issite.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/issite.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/issite.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/issite.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=issite.wordpress.com&blog=491883&post=35&subd=issite&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://issite.wordpress.com/2007/06/02/stack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7048021ab1e0ff7159a37886631c82d4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mea6</media:title>
		</media:content>
	</item>
	</channel>
</rss>