Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

Interview Questions and Answers :: Cisco

Home > Experience Archives > Cisco > Interview Question Set 6
First Round (F-2-F) Second Round (F-2-F) Third Round (F-2-F)
    Answer:

    public class FibonacciDemo{



    public static void main(String args[]){



    int i = 6;



    for(int j = 1;j<=6;j )



        System.out.println(fibo(i) " ");



    }



    public static int fibo(int n){



    if(n<=1)



    return n;



    return fibo(n-1) fibo(n-2);



    }



    }

    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:

    public class InsertNodeInLinkedList {

        static class Node{

            int data;

            Node next;

            Node(int d){

                data = d;

                next = null;

            }

        }

        

        

        static Node head;

        

        public static int length(Node head){

            if(head == null)

                return 0;

            //create count to hold the length

            int count = 0;

            Node curr = head;

            while(curr != null){

                count ;

                curr = curr.next;

            }

            return count;

        }

        

        public static Node insertNodeAtPosition(Node head, int data, int position){

            //boundary condition

            int size = length(head);

            if(position < 1 || position > size 1){

                System.out.println("Invalid position ...");

                return head;

            }

            

            Node newNode = new Node(data);

            //insert in 1st position

            if(position == 1){

                newNode.next = head;

                return newNode;

            }else{

                Node prevNode = head;

                int count = 1;

                while(count < position-1){

                    prevNode = prevNode.next;

                    count ;

                }

                

                Node currNode = prevNode.next;

                newNode.next = currNode;

                prevNode.next = newNode;

                return head;

            }

        }

        

        

        public static void main(String[] args) {

            InsertNodeInLinkedList list = new InsertNodeInLinkedList();

            list.head = new Node(85);

            list.head.next = new Node(15);

            list.head.next.next = new Node(5);

            list.head.next.next.next = new Node(10);

            System.out.println("Print the list");

            printList(head);

            System.out.println();

            head = insertNodeAtPosition(head, 20, 1);

            System.out.println("Insert 20 at position 1");

            printList(head);

            System.out.println();

            System.out.println();

            head = insertNodeAtPosition(head, 25, 4);

            System.out.println("Insert 25 at position 4");

            printList(head);

        }



        private static void printList(Node n) {

            while(n != null){

                System.out.print(n.data " ");

                n = n.next;

            }

        }

    }

    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

First Round (F-2-F) Second Round (F-2-F) Third Round (F-2-F) First Round (F-2-F) Second Round (F-2-F) Third Round (F-2-F)
    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!

    Answer:
    No Discussion on this question yet!
    Please Login First :
    Tags:

    No Tags on this question yet!