<?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: Computer Algorithms: Topological Sort Revisited</title>
	<atom:link href="/2012/12/10/computer-algorithms-topological-sort-revisited/feed/" rel="self" type="application/rss+xml" />
	<link>/2012/12/10/computer-algorithms-topological-sort-revisited/</link>
	<description>on web development</description>
	<lastBuildDate>Fri, 26 Oct 2018 21:40:18 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>By: David Ward</title>
		<link>/2012/12/10/computer-algorithms-topological-sort-revisited/comment-page-1/#comment-420232</link>
		<dc:creator><![CDATA[David Ward]]></dc:creator>
		<pubDate>Thu, 15 Sep 2016 08:12:40 +0000</pubDate>
		<guid isPermaLink="false">/?p=3494#comment-420232</guid>
		<description><![CDATA[Also, I was wondering if there&#039;s an efficient way to topologically sort a given graph without altering it?

I.e. without altering the graph by removing edges?]]></description>
		<content:encoded><![CDATA[<p>Also, I was wondering if there&#8217;s an efficient way to topologically sort a given graph without altering it?</p>
<p>I.e. without altering the graph by removing edges?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Ward</title>
		<link>/2012/12/10/computer-algorithms-topological-sort-revisited/comment-page-1/#comment-420231</link>
		<dc:creator><![CDATA[David Ward]]></dc:creator>
		<pubDate>Thu, 15 Sep 2016 08:11:10 +0000</pubDate>
		<guid isPermaLink="false">/?p=3494#comment-420231</guid>
		<description><![CDATA[Hey, I think your pseudo-code is incorrect?

Q only contains the initial vertices that have no incoming edges?

Shouldn&#039;t there be a pass after removing u&#039;s outgoing edges to add the vertices that no longer contain any incoming edges?]]></description>
		<content:encoded><![CDATA[<p>Hey, I think your pseudo-code is incorrect?</p>
<p>Q only contains the initial vertices that have no incoming edges?</p>
<p>Shouldn&#8217;t there be a pass after removing u&#8217;s outgoing edges to add the vertices that no longer contain any incoming edges?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: George</title>
		<link>/2012/12/10/computer-algorithms-topological-sort-revisited/comment-page-1/#comment-18654</link>
		<dc:creator><![CDATA[George]]></dc:creator>
		<pubDate>Thu, 02 May 2013 10:35:04 +0000</pubDate>
		<guid isPermaLink="false">/?p=3494#comment-18654</guid>
		<description><![CDATA[Hi Stoimen - I ran across your article on the Boyer-Moore algorithm, and thought that you may be interested in my version of the pathology of it, in Java. I programme a Java instant messenger and voip application, and this Boyer-Moore was something I was just looking at recently. I am pasting the source code here, but it is also available on my website. If you had any comments, I&#039;d be interested to hear. Thanks, George.


public class Boyer_Moore_Bonfield {

static String result = null;

static String haystack = &quot;BERINGBEARINGATLANTICPACIFIC WE HOLD THESE TRUTHS TO BE SELF-EVIDENT PACIFYBALTICCONCERTOOTHERWISECASPIAN Z&quot;;

static String needle = &quot;&quot;;


	public static void main(String[] args){
	
		java.util.Scanner input = new java.util.Scanner(System.in);

		while(!(needle.equals(&quot;-1&quot;))){		

			System.out.println(&quot;\nEnter a word or string to search for . . . \n&quot;);

			needle = input.nextLine().toUpperCase();

			System.out.println(search_for(needle, haystack)+&quot;\n&quot;);
		
		}
	}


	static String search_for(String needl, String haystac){

		int lenNeedle = needl.length();
		int lenHaystack = haystac.length();
		int needlePointer;
		int haystackPointer = lenNeedle-1;	
		int flexHaystackPointer = haystackPointer;	
		boolean matched = false;
							

		while (haystackPointer &#060; lenHaystack){		
			
				needlePointer = lenNeedle-1;
				flexHaystackPointer = haystackPointer;

				
					while(haystac.charAt(flexHaystackPointer)==needl.charAt(needlePointer)){
						
						//System.out.println(&#034;needlePointer is &#034;+needlePointer+&#034; flexHaystackPointer is &#034;+flexHaystackPointer);//DEBUG
						
						if(needlePointer==0){

							matched=true;
							break;
						}
						
						flexHaystackPointer--;
						needlePointer--;	
					}			
					if(!matched){

					 if( (needl.lastIndexOf(haystac.charAt(flexHaystackPointer)) == -1) ){

						//the char is not in the pattern at all
						// so move the pattern right by the length of the pattern 
						haystackPointer += needl.length();
					 }

					 else{
						haystackPointer += needl.length()-needl.lastIndexOf(haystac.charAt(flexHaystackPointer))-1;
					 }
					}
					
				if(matched){break;}
		} 

		if(matched){
			return(&#034;Found  : &#034;+haystac.substring(flexHaystackPointer,flexHaystackPointer+lenNeedle));
		}
		else{
			return(&#034;No match&#034;);
		}
	}
}]]></description>
		<content:encoded><![CDATA[<p>Hi Stoimen &#8211; I ran across your article on the Boyer-Moore algorithm, and thought that you may be interested in my version of the pathology of it, in Java. I programme a Java instant messenger and voip application, and this Boyer-Moore was something I was just looking at recently. I am pasting the source code here, but it is also available on my website. If you had any comments, I&#8217;d be interested to hear. Thanks, George.</p>
<p>public class Boyer_Moore_Bonfield {</p>
<p>static String result = null;</p>
<p>static String haystack = &#8220;BERINGBEARINGATLANTICPACIFIC WE HOLD THESE TRUTHS TO BE SELF-EVIDENT PACIFYBALTICCONCERTOOTHERWISECASPIAN Z&#8221;;</p>
<p>static String needle = &#8220;&#8221;;</p>
<p>	public static void main(String[] args){</p>
<p>		java.util.Scanner input = new java.util.Scanner(System.in);</p>
<p>		while(!(needle.equals(&#8220;-1&#8221;))){		</p>
<p>			System.out.println(&#8220;\nEnter a word or string to search for . . . \n&#8221;);</p>
<p>			needle = input.nextLine().toUpperCase();</p>
<p>			System.out.println(search_for(needle, haystack)+&#8221;\n&#8221;);</p>
<p>		}<br />
	}</p>
<p>	static String search_for(String needl, String haystac){</p>
<p>		int lenNeedle = needl.length();<br />
		int lenHaystack = haystac.length();<br />
		int needlePointer;<br />
		int haystackPointer = lenNeedle-1;<br />
		int flexHaystackPointer = haystackPointer;<br />
		boolean matched = false;</p>
<p>		while (haystackPointer &lt; lenHaystack){		</p>
<p>				needlePointer = lenNeedle-1;<br />
				flexHaystackPointer = haystackPointer;</p>
<p>					while(haystac.charAt(flexHaystackPointer)==needl.charAt(needlePointer)){</p>
<p>						//System.out.println(&quot;needlePointer is &quot;+needlePointer+&quot; flexHaystackPointer is &quot;+flexHaystackPointer);//DEBUG</p>
<p>						if(needlePointer==0){</p>
<p>							matched=true;<br />
							break;<br />
						}</p>
<p>						flexHaystackPointer&#8211;;<br />
						needlePointer&#8211;;<br />
					}<br />
					if(!matched){</p>
<p>					 if( (needl.lastIndexOf(haystac.charAt(flexHaystackPointer)) == -1) ){</p>
<p>						//the char is not in the pattern at all<br />
						// so move the pattern right by the length of the pattern<br />
						haystackPointer += needl.length();<br />
					 }</p>
<p>					 else{<br />
						haystackPointer += needl.length()-needl.lastIndexOf(haystac.charAt(flexHaystackPointer))-1;<br />
					 }<br />
					}</p>
<p>				if(matched){break;}<br />
		} </p>
<p>		if(matched){<br />
			return(&quot;Found  : &quot;+haystac.substring(flexHaystackPointer,flexHaystackPointer+lenNeedle));<br />
		}<br />
		else{<br />
			return(&quot;No match&quot;);<br />
		}<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
