Posts

c program for shell sort

#include <stdio.h> #include <stdbool.h> #define MAX 7 int intArray[MAX] = {4,6,3,2,1,9,7}; void printline(int count){ int i; for(i = 0;i <count-1;i++){ printf("="); } printf("=\n"); } void display(){ int i; printf("["); // navigate through all items for(i = 0;i<MAX;i++){ printf("%d ",intArray[i]); } printf("]\n"); } void shellSort(){ int inner, outer; int valueToInsert; int interval = 1; int elements = MAX; int i = 0; while(interval <= elements/3) { interval = interval*3 +1; } while(interval > 0) { printf("iteration %d#:",i); display(); for(outer = interval; outer < elements; outer++) { valueToInsert = intArray[outer]; inner = outer; while(inner > interval -1 && intArray[inner - interval] >= valueToInsert) { intArray[inner] = intArray[inner - interval]; inner -=interval; printf(" item moved :%d\n",intArray[inner]); } intArray[inner] = valueToInsert; printf(" item inser...

c program for marge sort

#include <stdio.h> #define max 10 int a[10] = { 10, 14, 19, 26, 27, 31, 33, 35, 42, 44 }; int b[10]; void merging(int low, int mid, int high) { int l1, l2, i; for(l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++) { if(a[l1] <= a[l2]) b[i] = a[l1++]; else b[i] = a[l2++]; } while(l1 <= mid) b[i++] = a[l1++]; while(l2 <= high) b[i++] = a[l2++]; for(i = low; i <= high; i++) a[i] = b[i]; } void sort(int low, int high) { int mid; if(low < high) { mid = (low + high) / 2; sort(low, mid); sort(mid+1, high); merging(low, mid, high); }else { return; } } int main() { int i; printf("List before sorting\n"); for(i = 0; i <= max; i++) printf("%d ", a[i]); sort(0, max); printf("\nList after sorting\n"); for(i = 0; i <= max; i++) printf("%d ", a[i]); }

DBMS LAB ASSIGNMENT FOR 1ST YEAR 2017

ASSIGNMENT 1 Define the schema for the following databases with specific data type and constraints, the table name and its fields name are to be taken from database description which are given below : A database is being constructed for storing sales information system. A product can be described with a unique product number, product name, selling price, manufacturer name. The product can sale to a particular client and each client have it own unique client number, client name, client addresses, city, pin code, state and total balance to be required to paid. Each client order to buy product from the salesman. In the order, it has unique sales order number, sales order date, client number, salesman number (unique), billed whole payment by the party or not and its delivery date. The salesman have the name, addresses, city, pin code, state, salary of the sales man, delivery date, total quantity ordered, product rate. Q.1.1. Write the SQL queries for the following – (a) Retrieve the...

SQL Questions:

.  Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables? Data Definition Language (DDL) 2.       What operator performs pattern matching? LIKE operator 3.       What operator tests column for the absence of data? IS NULL operator 4.       Which command executes the contents of a specified file?              START <filename> or @<filename> 5.       What is the parameter substitution symbol used with INSERT INTO command?              & 6.       Which command displays the SQL command in the SQL buffer, and then executes it?              RUN 7.       What are the...

DBMS SHORT QUESTION AND ANSWER

Image
Q1. What is SQL? Ans: Structured Query Language 2. What is database? A database is a logically coherent collection of data with some inherent meaning, representing some aspect of real world and which is designed, built and populated with data for a specific purpose. 3. What is DBMS? It is a collection of programs that enables user to create and maintain a database. In other words it is general-purpose software that provides the users with the processes of defining , constructing and manipulating the database for various applications. 4. What is a Database system? The database and DBMS software together is called as Database system. 5. Advantages of DBMS? Ø   Redundancy is controlled. Ø   Unauthorised access is restricted. Ø   Providing multiple user interfaces. Ø   Enforcing integrity constraints. Ø   Providing backup and recovery. 6. Disadvantage in File Processing System? Ø   Data redundancy & inconsistency. ...