User Profile

Collapse

Profile Sidebar

Collapse
sankar2011
sankar2011
Last Activity: Dec 7 '14, 02:09 PM
Joined: Nov 2 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • For theory portion please follow my another article
    http://bytes.com/topic/algorithms/in...actually-works

    Also please ignore the following portion in this current article

    A close inspection to the code will make it easy to understand that left branch of a root is always explored before the right branch. For example: The order of stack insertion of nodes in a sub tree is the...
    See more | Go to post

    Leave a comment:


  • sankar2011
    replied to Pre-Order Binary Tree
    in C
    PreOder Traversal of two trees may produce the same result....
    See more | Go to post

    Leave a comment:


  • Modification

    Hi ZMBD, could you please remove the following line in italics completely?

    "A close inspection to the code will make it easy to understand that left branch of a root is always explored before the right branch. For example:"

    I am unable to do it.
    Thanks in advance!
    See more | Go to post

    Leave a comment:


  • Binary tree traversal with stack data structure

    This is an eclipse based project. So the attachment may be unzipped and run in eclipse.
    eclipse Juno and Java 7 has been used. First the code should be inspected and run. Then the blog may be reffered.
    =============== =============== ========

    Stack based implementation of Binary Tree traversal. The ArrayList<Integ er> result variable will have the traversal result
    In this example I have added the data from a...
    See more | Go to post
    Last edited by zmbd; Sep 29 '14, 10:51 PM. Reason: [z{per op change to article/ Kept the original phrase and added conjunctive to tie new material with the old}]

  • sankar2011
    replied to Advanced Generics: Wildcards
    in Java
    It's a nice article Nepomuk.
    A very good one! :-)
    See more | Go to post

    Leave a comment:


  • Thanks Nepomuk!

    I should have named the article as implementation-----in Java!
    This was my mistake. Agreed. Also agreed that Folder location could have been abstracted.

    Last time actually I explained Dijkstra's algorithm. So this time I thought only to give the implementation of Kosaraju so that those who are struggling a bit to understand, can fully understand after seeing the code .

    Cheers!
    See more | Go to post

    Leave a comment:


  • sankar2011
    started a topic Java threads and more on memory model
    in Java

    Java threads and more on memory model

    My first article in this series was as follows
    http://bytes.com/topic/java/insights...ls-article-1-a

    Here I will discuss a few more things

    1> Which operations are atomic in Java?

    Ans: Writes to volatiles, writes to references, and writes to 32 bit or smaller scalar values. While one of these operations have started by a thread to a particular variable, the thread must...
    See more | Go to post
    Last edited by zmbd; Oct 15 '13, 04:20 PM. Reason: [z{placed required Code and URL tags}]

  • sankar2011
    started a topic Java thread essentials
    in Java

    Java thread essentials

    1> What is reordering of statements in a single thread.

    Ans. Compiler/JVM reorder the statements in a particular thread so that it does not affect the code semantics for single thread execution. For example see the following code.
    Code:
    class A{
    
        private int k = 0;
        private boolean l = false;
        public void example(int a, boolean b){
            k = a;//....  Line 1
            l = b;//....
    ...
    See more | Go to post

  • Implementation of Kosaraju's algo to find Strongly connected components

    Last time I gave the mathematical reasoning to prove Dijkstra's algorithm.

    This time I am giving a possible implementation for Kosaraju's algorithm which finds the strongly connected components in a directed graph. Short form of "strongly connected components" is SCC

    The intent of the program.
    =============== ===========
    The program finds the number of nodes in the 5 mostly dense strongly connected...
    See more | Go to post
    Last edited by Niheel; Oct 17 '14, 10:09 PM. Reason: merged the code into the article so it's one nice big article. great article ;)

  • sorted order is always a unique sequence for same set of distinct elements

    Claim: There may be only one sorted alignment in decreasing/increasing order such as
    X1, X2, X3,...... when X1, X2, X3 are distinct numbers

    PROOF IS DONE FOR DECREASING ORDER ONLY. SIMILARLY IT MAY BE PROVEN FOR INCREASING ORDER

    Proof:



    X1, X2, X3,...... is decreasing. We call this as order 1

    Say there is any other order as order 2 which is a different permutation...
    See more | Go to post

  • sankar2011
    replied to How a DriverManager class is implemented
    in Java
    Ok. :-)

    I will definitely remember this. Thank you for taking time to go through my articles. This was written keeping in mind about a novice programmer. But yet. I really take this positively and remember this. Cheers!
    See more | Go to post

    Leave a comment:


  • sankar2011
    replied to How a DriverManager class is implemented
    in Java
    Hi ZMBD,

    Thanks for your constructive criticism.
    1> I actually concentrated on the design principles followed for implementing this.
    2> I emphasized on the the basic flow of DriverManager registration and getting connection.

    I omitted the methods to make it simpler. Because one who gets the basic concept he may very well look into the original DriverManager code. This article will help him/her to understand...
    See more | Go to post

    Leave a comment:


  • sankar2011
    started a topic How a DriverManager class is implemented
    in Java

    How a DriverManager class is implemented

    This is for the concept.
    So import statements/package statements have been avoided. Also only the necessary methods are given.
    Search **** for the comments

    Courtesy Effective Java by Joshua Bloch
    http://www.janeve.me/articles/class-...-getconnection


    Code:
    /* ******Service interface  */
    public interface Connection {
    ... //***** Service-specific methods go here
    }
    ...
    See more | Go to post
    Last edited by Rabbit; Sep 9 '13, 08:55 PM. Reason: Please use code tags when posting code or formatted data.

  • Hi Kudos,

    Thanks for your comment.
    Let me tell you that there was slight mistake in your understanding.

    First thing is that I am not inserting any other node in the graph. It has n number of nodes from the biginning. This n is constant.

    What the Algorithm is doing is that it is maintaining two disjoint subsets of nodes which we call Set 1 and Set 2.
    Set 1 only maintains the nodes which have their...
    See more | Go to post

    Leave a comment:


  • sankar2011
    started a topic The correctness of Dijkstra's Algorithm

    The correctness of Dijkstra's Algorithm

    Please see the attachment also!

    Assumptions:
    1>n nodes and m edges are there in the Graph V. V may directed or undirected both.
    2>Weights of all the edges are non-negative finite numbers.

    What the Dijkstra algorithm does:
    ------------------------
    It finds all the shortest paths from a particular node s to all other vertexes.

    How the Dijkstra algorithm does this:
    ...
    See more | Go to post
    Last edited by zmbd; Sep 12 '13, 06:28 PM. Reason: [z{inserted the image inline to text}]

  • sankar2011
    started a topic Weak HashMap Summarized
    in Java

    Weak HashMap Summarized

    WeakHashMap is a topic which is misterious to many developers. Many find it very tough to understand. Others understand but cannot describe properly.
    Those who already understand WeakHashMap may ignore this topic.

    I will not try to show how it is implemented. I would like to brief in a question-answer pattern. This will give others a starting point for further reading.

    1> What is weakhashmap?

    ...
    See more | Go to post
    Last edited by zmbd; Sep 12 '13, 08:13 PM. Reason: [z{added the url tags}]

  • sankar2011
    replied to help with tree traversal algorithm
    in C
    You may check my blog out...

    http://bytes.com/topic/c/insights/92...-non-recursive...
    See more | Go to post

    Leave a comment:


  • sankar2011
    started a topic Post order traversal non recursive
    in C

    Post order traversal non recursive

    Introduction
    -------------
    In a binary tree starting from the root there always exists a path to reach any node.But for any particular node this path is unique.Each of these paths are extendible upto some leaf node.

    So if we cover every path once upto the leaf nodes we cover up all the nodes once. So to traverse all the nodes if we traverse each leaf node from the root we will traverse each node the tree. For post order...
    See more | Go to post
    Last edited by zmbd; Sep 12 '13, 08:17 PM. Reason: [sankar2011{A bit more detail is given in the algo so that everyone an understand.}][z{placed img inline}]
No activity results to display
Show More
Working...