Monthly Archives: October 2013

Find string in a string array

import java.util.*; /** * */ /** * @author asharda * */public class findword { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String input[]={“Ashish”,”Amol”,”Ajay”,”Rohit”}; String target=”hr”; match(input,target); } public static void match(String … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

No Duplicate Elements in an Array

import java.util.*; /** * */ /** * @author asharda * */public class NoDup { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub printdup(); } public static void printdup() { int a[]={1,1,2,3,4,5,4,1}; ArrayList<Integer>list=new … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Generics Test

public class genericstest<T> { private T value; void set(T value) { this.value=value; } void get() { System.out.println(“Value is “+value); } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub genericstest<String> test=new <String>genericstest(); test.set(“Ashish”); … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Stack using Linked List in Java

import java.util.LinkedList;import java.util.Scanner; /** * */ /** * @author ashish * */public class stack { static LinkedList<Integer>list=new LinkedList<Integer>(); static Scanner in =new Scanner(System.in); /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int … Continue reading

Posted in Uncategorized | Tagged , | Leave a comment

Queues in Java

import java.util.ArrayList;import java.util.Scanner; /** * */ /** * @author asharda * */public class queuetest { /** * @param args */ static Scanner in=new Scanner(System.in); static ArrayList<Integer> list=new ArrayList<Integer>(); static int elements,choice; public static void main(String[] args) { // TODO Auto-generated … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Quicksort in Java

import java.util.ArrayList;import java.util.Collections;import java.util.Scanner; /** * */ /** * @author asharda * */public class qsort { static ArrayList<Integer> list = new ArrayList<Integer>(); /** * @param args */ public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println(“Enter size … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Fibonnaci Numbers

import java.util.Scanner; /** * */ /** * @author asharda * */public class fibonaccinumber { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(“Enter a number for which you want a fibonnaci number”); … Continue reading

Posted in Uncategorized | Tagged | Leave a comment