Showing posts with label lab. Show all posts
Showing posts with label lab. Show all posts

June 09, 2012

DS: Circular Queue

import java.util.Scanner; public class CQueue { public static void main(String args[]) { Scanner s = new Scanner(System.in); int choice, n; Object value; System.out.println("Enter a size"); n = s.nextInt(); List c = new List(n); do { System.out .println("CQueue operations\n1.puts()\n2.remove()\n3.getfrontelement()\n4.getrearelement()\n5.empty()\n6.size()\n7.display()\nEnter ur choice"); choice = s.nextInt(); ...
Output:

Enter a size                                                                   
5                                                                               
CQueue operations                                                              
1.puts()                                                                       
2.remove()                                                                      
3.getfrontelement()                                                            
4.getrearelement()                                                             
5.empty()                                                                      
6.size()                                                                       
7.display()                                                                    
Enter ur choice                                                               
 1                                                                               
Enter a value                                                                  
10                                                                             
CQueue operations                                                               
1.puts()                                                                       
2.remove()                                                                     
3.getfrontelement()                                                             
4.getrearelement()                                                             
5.empty()                                                                      
6.size()                                                                        
7.display()                                                                    
Enter ur choice                                                                
1                                                                               
Enter a value                                                                 
 20                                                                             
CQueue operations                                                              
1.puts()                                                                       
2.remove()                                                                     
3.getfrontelement()                                                            
4.getrearelement()                                                             
5.empty()                                                                      
6.size()                                                                       
7.display()                                                                     
Enter ur choice                                                                
1                                                                              
Enter a value                                                                   
30                                                                             
CQueue operations                                                              
1.puts()                                                                        
2.remove()                                                                     
3.getfrontelement()                                                            
4.getrearelement()                                                              
5.empty()                                                                      
6.size()                                                                       
7.display()                                                                    
Enter ur choice  
1
Enter a value
40
CQueue operations
1.puts()
2.remove()
3.getfrontelement()
4.getrearelement()
5.empty()
6.size()
7.display()
Enter ur choice
2
The deleted element is=10                                                      
CQueue operations                                                              
1.puts()                                                                       
2.remove()                                                                     
3.getfrontelement()                                                            
 4.getrearelement()                                                             
5.empty()                                                                      
6.size()                                                                        
7.display()                                                                   
Enter ur choice  
8   

Read more ...

DS: Bubble Sort Program

import java.util.Scanner; public class Bubblesort { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter size of the array"); int size = sc.nextInt(); bsort s = new bsort(size); System.out.println("Elements before sorting"); s.display(); s.bubble(); System.out.println("Elements after sorting"); s.display(); } } class bsort { int a[], N; Scanner sc = new...
Read more ...

DS: Binary Tree Program

import java.util.Scanner; public class BTree { public static void main(String args[]) { List c = new List(); int d; Scanner s = new Scanner(System.in); do { System.out.println("Binary tree operations"); System.out.println("1.create()"); System.out.println("2.inorder()"); System.out.println("3.preorder()"); System.out.println("4.postorder()"); System.out.println("5.empty()"); System.out.println("Enter...
Read more ...

DS: Binary Search Tree Program

import java.io.*; import java.util.Scanner; public class BinaryOne { public static void main(String args[]) { int choice, value; bst b = new bst(); do { System.out.println("Binary Search Tree Operations"); System.out.println("1.create()"); System.out.println("2.display()"); System.out.println("3.empty()"); System.out.println("Enter U'r choice"); Scanner s = new Scanner(System.in); choice = s.nextInt(); ...
Read more ...

June 04, 2012

DS: Array Linear List

import java.io.*; import java.util.*; class List {         Object element[];         int size;         public List(int value)         {                 if(value<0)                ...
Read more ...

My Favorite Site's List

#update below script more than 500 posts