Skip to content

Instantly share code, notes, and snippets.

View suryansh011's full-sized avatar

Suryansh Singh suryansh011

View GitHub Profile
@suryansh011
suryansh011 / PROGRAM 16.txt
Created September 13, 2022 10:25 — forked from vijayakumarchinthala/PROGRAM 16.txt
Program 16 Create a student table and insert data. Implement the following SQL commands on the student table: ALTER table to add new attributes / modify data type / drop attribute UPDATE table to modify data ORDER By to display data in ascending / descending order DELETE to remove tuple(s) GROUP BY and find the min, max, sum, count and average
#Switched to a database
mysql> USE GVKCV;
Database changed
#Creating table student
mysql> create table student
-> (ROLLNO INT NOT NULL PRIMARY KEY,
-> NAME CHAR(10),
-> TELUGU CHAR(10),
-> HINDI CHAR(10),
@suryansh011
suryansh011 / variable_size_arrays.cpp
Created January 1, 2022 11:42
Variable Sized Arrays
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n{}, q{};
@suryansh011
suryansh011 / dijkstra.c
Created November 10, 2021 12:08
Dijkstra Implementation in C
#include<stdio.h>
#include<conio.h>
#define INFINITY 9999
#define MAX 10
void dijikstra(int G[MAX][MAX], int n, int startnode) {
int cost[MAX][MAX], distance[MAX], pred[MAX];
int visited[MAX], count, mindistance, nextnode, i,j;
for(i = 0; i < n; i++)
for(j = 0; j < n; j++)
@suryansh011
suryansh011 / kruskal.c
Created November 10, 2021 12:06
Kruskal Implementation in C
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int i, j, k, a, b, u, v, n, ne=1;
int min, mincost=0, cost[9][9], parent[9];
int find(int i) {
while(parent[i])
i = parent[i];
return i;
}
@suryansh011
suryansh011 / prog6.c
Created November 9, 2021 09:21
Program 6 (CDNI Truth Table)
#include<stdio.h>
char TorF(int i) {
if (i == 1)
return 'T';
else
return 'F';
}
int main() {
@suryansh011
suryansh011 / cdni.c
Created November 9, 2021 09:08
Conjunction, Disjunction, Negation & Implication
#include<stdio.h>
char print(int i) {
if (i == 1)
return 'T';
else
return 'F';
}
int main() {
@suryansh011
suryansh011 / sparse_matrix.c
Created October 26, 2021 09:06
Sparse Matrix
#include<stdio.h>
int main() {
int i, j; // Counters
int r, c;
printf("Enter size for the sparse matrix (m * n): ");
scanf("%d %d", &r, &c);
int A[r][c];
@suryansh011
suryansh011 / matrix_multiplication.c
Created October 26, 2021 04:39
Matrix Multiplication
#include<stdio.h>
#include<stdlib.h>
int main() {
int r1, c1, r2, c2;
int i, j, k; /* Counters */
printf("Enter size of the 1st matrix (m * n):\n");
scanf("%d %d", &r1, &c1);
int A[r1][c1];
@suryansh011
suryansh011 / dstask4.c
Created October 17, 2021 16:34
Link List Problem
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node *link;
};
void printList(struct Node *head) {
struct Node *ptr = head;
@suryansh011
suryansh011 / union_sets.c
Created October 11, 2021 12:24
Union of Two Sets
/* WAP in 'C' to find out the union of two set */
#include <stdio.h>
int main() {
int i, j, k = 0; /* Counters */
int a[] = {1, 3, 5, 7, 9, 11};
int b[] = {2, 4, 6, 12, 14, 16, 18, 8, 10, 12, 14, 16, 18, 20};
int r[99] = {};