Skip to content

Instantly share code, notes, and snippets.

View palianytsia's full-sized avatar

Ivan Palianytsia palianytsia

View GitHub Profile
@palianytsia
palianytsia / Binary tree
Created July 7, 2015 21:38
Binary tree, post-order traversal
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* Binary tree, post-order traversal
*
* @author Ivan Palianytsia
*
*/
@palianytsia
palianytsia / Crawler.java
Created December 9, 2012 19:40
Demo of a simple web crawler, that fetches the content for a given start URL, extracts the links from the content, goes on to crawl the extracted links (back to step 1) and stops after 1000 found URLs.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
@palianytsia
palianytsia / ListReverse.java
Created March 22, 2012 09:10
An example of how to reverse elements in the list.
package com.examples;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
/**
* This is utility class that contains an example of how to reverse elements in
* the list. You shouldn't actually implement your own reverse utility - use
@palianytsia
palianytsia / CharByExample.java
Created February 15, 2012 22:34
This class contains examples that help to understand the char type together with the Unicode encoding scheme.
/**
* <p>
* This class contains examples that help to understand the <code>char</code>
* type together with the <strong>Unicode encoding scheme</strong>. The explanations
* and examples are based on "The char Type" and "Code Points and Code Units" chapters
* of "Core Java" book (Volume 1, 8th edition) by Cay Horstmann and Gary Cornell.
* </p>
* <p>
* Before proceeding to examples, read the following terminology:
* </p>
@palianytsia
palianytsia / BitOperators.java
Created February 12, 2012 21:18
The simple showcase for understanding of how do the bit operators work in JAVA
public class BitOperators
{
public static void main(String[] args)
{
// Bit operators are available only for integer types (byte, short, int,
// long)
// Uncomment the line below and you'll get compile time error
// System.out.println(25f >> 3);
/**************************** Bit Wise Operators ******************************/