Category Archives: DataStructures

Testing Our implementation of LinkedList…

package com.test.ds; import java.util.*; public class LinkedListTest {  public static void main(String[] arg){   CLinkedList clist = new CLinkedList();   clist.addFirst(1);   clist.addFirst(2);   clist.addFirst(3);      clist.addFirst(4);      clist.addLast(5);   clist.addLast(6);   clist.addLast(7);   clist.print();   clist.reverse();   clist.print();   /*ArrayList list = new ArrayList();   list.add(“1″);   list.add(“5″);   list.add(“3″);   for(Iterator itr … Continue reading

Posted in DataStructures | Leave a comment

Implementing Linked List…

package com.test.ds; public class CLinkedList {  Node head;  CLinkedList(){  }  public void addLast(int data)  {   Node node = new Node(data, null);   if(head == null){    head = node;    return;   }   Node next = head;   while(next.link != null) {    next = next.link; … Continue reading

Posted in DataStructures | Leave a comment

Different operations of BinaryTree…

//depth of a binary Tree /* int depth(Root T) { if(T == NULL) return 0; d1 = depth(T -> left); d2 = depth(T -> right); return (max(d1,d2) + 1); } */ // Print binary tree /* Void print(Tree t){ If(t==null) … Continue reading

Posted in DataStructures | 1 Comment

How to implement Linked lists in JAVA

The following is one of the cool book to get basic idea of how to implement LinkedList, Trees in java. http://www.vias.org/javacourse/wrapnt_linked_lists151.html

Posted in DataStructures | 1 Comment