Friday, 30 October 2015

JAVA WORKOUTS #1


ASSIGNMENT 3
13. 506 OBJECT ORIENTED DESIGN AND JAVA PROGRAMMING

Group I (#CODE 1 to 12)
1.      Write a Java program to find a word from a text and replace it with another word
2.      Write a program to create two threads, one thread will print odd numbers and second thread will print even numbers between 1 to 20 numbers.
3.      Write a simple program which can be used as an application as well as an applet.
4.      Using applet and thread, write a program that displays digital clock(time in hours: minutes: seconds), starting from time 00:00:00.

GROUP IV #1. Write a Java program that accepts N integers, sort them and perform binary search on it.


package assignment;
import java.util.Scanner;
public class Assignment {

    public static void main(String[] args) {
     int[] a;
        System.out.println("enter the value of n");
        Scanner in=new Scanner(System.in);
        a=new int[in.nextInt()];

Thursday, 7 May 2015

QUICK SORT [RECURSIVE]


DESCRIPTION



Quick sort (sometimes called partition-exchange sort) is an efficient sorting algorithm, serving as a systematic method for placing the elements of an array in order. Developed by Tony Hoare in 1959  (published 1962), it is still a very commonly used algorithm for sorting. When implemented well, it can be about two or three times faster than its main competitors, merge sort and heap sort
Quick sort is a comparison sort, meaning that it can sort items of any type for which a "less-than" relation (formally, a total order) is defined. In efficient implementations it is not a stable sort, meaning that the relative order of equal sort items is not preserved. Quick sort can operate in-place on an array, requiring small addit