The program takes input of the order of a square matrix and its elements. It prints the elements of the matrix. It then calculates the trace of the matrix by adding the elements along the principal diagonal and prints the trace. The matrix elements are freed at the end.
1. Perform Linear Search and Binary Search on an array.
Descriptions of the programs:
Read and array of type integer.
Input element from user for searching.
Search the element by passing the array to a function and then returning the position of the element from the function else return -1 if the element is not found.
Display the positions where the element has been found.
2. Implement sparse matrix using array.
Description of program:
Read a 2D array from the user.
Store it in the sparse matrix form, use array of structures.
Print the final array.
3. Create a linked list with nodes having information about a student and perform.
Description of the program:
Insert a new node at specified position.
Delete of a node with the roll number of student specified.
Reversal of that linked list.
4. Create doubly linked list with nodes having information about an employee and perform Insertion at front of doubly linked list and perform deletion at end of that doubly linked list.
5. Create circular linked list having information about a college and perform Insertion at front perform Deletion at end.
6. Create a stack and perform Pop, Push, Traverse operations on the stack using Linear Linked list.
7. Create a Linear Queue using Linked List and implement different operations such as Insert, Delete, and Display the queue elements.
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
1. Perform Linear Search and Binary Search on an array.
Descriptions of the programs:
Read and array of type integer.
Input element from user for searching.
Search the element by passing the array to a function and then returning the position of the element from the function else return -1 if the element is not found.
Display the positions where the element has been found.
2. Implement sparse matrix using array.
Description of program:
Read a 2D array from the user.
Store it in the sparse matrix form, use array of structures.
Print the final array.
3. Create a linked list with nodes having information about a student and perform.
Description of the program:
Insert a new node at specified position.
Delete of a node with the roll number of student specified.
Reversal of that linked list.
4. Create doubly linked list with nodes having information about an employee and perform Insertion at front of doubly linked list and perform deletion at end of that doubly linked list.
5. Create circular linked list having information about a college and perform Insertion at front perform Deletion at end.
6. Create a stack and perform Pop, Push, Traverse operations on the stack using Linear Linked list.
7. Create a Linear Queue using Linked List and implement different operations such as Insert, Delete, and Display the queue elements.
Programs are complete in best of my knowledge with zero compilation error in IDE Bloodshed Dev-C++. These can be easily portable to any versions of Visual Studio or Qt. If you need any guidance please let me know via comments and Always Enjoy Programming.
This document contains some programs of C using Data structures, like Stack, LinkedList, queue, Fibonacci series, addition and multiplication of two matrices,etc.
Device-to-device (D2D) communications underlaying a cellular infrastructure has been proposed as a means of taking advantage of the physical proximity of communicating devices, increasing resource utilization, and improving cellular coverage. Relative to the traditional cellular methods, there is a need to design new peer discovery methods, physical layer procedures, and radio resource management algorithms that help realize the potential article we use the 3GPP Long Term Evolution system as a baseline for D2D design, review some of the key design challenges, and propose solution approaches that allow cellular devices and D2D pairs to share spectrum resources and thereby increase the spectrum and energy efficiency of traditional cellular networks. Sim- ulation results illustrate the viability of the proposed design.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Honest Reviews of Tim Han LMA Course Program.pptxtimhan337
Personal development courses are widely available today, with each one promising life-changing outcomes. Tim Han’s Life Mastery Achievers (LMA) Course has drawn a lot of interest. In addition to offering my frank assessment of Success Insider’s LMA Course, this piece examines the course’s effects via a variety of Tim Han LMA course reviews and Success Insider comments.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
The French Revolution Class 9 Study Material pdf free download
C programs
1. 1
Set 1 Q1 Program to sort the array in ascending order using Selection Sort
Algorithm
Program
#include<stdio.h>
#include<stdlib.h>
int main()
{
int i,n,j,temp;
int *a;
printf("The no of elements ");
scanf("%d",&n);
a = (int *)malloc (sizeof(int) * n);
printf("Enter the elements n" );
for (i=0 ; i<n ; i++)
{
scanf("%d", &(*(a+i)));
}
for (i = 0; i < n; i++)
{
for (j = i+1; j < n; j++)
{
if (*(a+i) > *(a+j))
{
temp = *(a+i);
*(a+i)= *(a+j);
*(a+j)=temp;
}
}
}
printf("In ascending order ");
for (i=0 ; i<n ; i++)
{
printf("%d " , *(a+i));
}
printf("n");
3. 3
Set 1 Q2 Program to sort the array in descending order using the Bubble Sort
Algorithm
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int *a,i,n,j,temp;
printf("Enter the number of elements to be sorted");
scanf("%d",&n);
a = (int*) malloc (n*sizeof (int));
printf("Enter the elements ");
for(i=0;i<n;i++)
{
scanf ("%d",&(*(a+i)));
}
for (i=0; i<(n-1); i++)
{
for (j=0; j<(n-i-1);j++)
{
if (*(a+j)<*(a+j+1))
{
temp=*(a+j);
*(a+j)=*(a+j+1);
*(a+j+1)=temp;
}
}
}
printf("In descending order: n");
for(i=0;i<n;i++)
{
printf("%d ",*(a+i));
}
free(a);
printf("n");
return 0;
}
4. 4
Output
Enter the number of elements to be sorted10
Enter the elements 15
0
-4
7
8
0
20
15
35
10
In descending order:
35 20 15 15 10 8 7 0 0 -4
5. 5
Set1 Q3 Program to search an element in an array using Linear Search
Algorithm
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int s, c, n, l, p;
int *a,*loc;
printf("Enter the number of elements in array");
scanf("%d",&n);
a = (int*) malloc (n*sizeof (int));
loc = (int*) malloc (n*sizeof (int));
printf("Enter the numbers ");
for (c = 0; c < n; c++)
scanf("%d", &(*(a+c)));
printf("Enter the number to search");
scanf("%d", &s);
l=0;
for (c = 0; c < n; c++)
{
if (*(a+c) == s)
{
*(loc+l) =c;
l=l+1;
}
}
if (l==0)
printf("%d is not present in array n", s);
else
{
for (p=0; p<l; p++)
printf("n Number is located at position - %d ", *(loc+p)+1);
}
6. 6
printf("n");
free (a);
free (loc);
return 0;
}
Output 1
Enter the number of elements in array10
Enter the numbers 4
2
3
7
8
1
2
0
9
5
Enter the number to search2
Number is located at position - 2
Number is located at position – 7
Output 2
Enter the number of elements in array5
Enter the numbers 3
5
7
0
2
Enter the number to search1
1 is not present in array
7. 7
Set 1 Q4 Program to search an element in an array using Binary Search
Algorithm
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int first, last, mid,temp, n,s,i,j,lo,pos;
int *a,*loc,*b;
printf("Enter number of elements ");
scanf("%d",&n);
a = (int*) malloc (n* sizeof(int));
b = (int*) malloc (n* sizeof(int));
loc = (int*) malloc (n* sizeof(int));
printf("Enter the elements n" );
for (i=0 ; i<n ; i++)
scanf("%d", &(*(a+i)));
for (i=0 ; i<n ; i++)
*(b+i)=*(a+i);
for (i = 0; i < n; i++)
{
for (j = i+1; j < n; j++)
{
if (*(a+i) > *(a+j))
{
temp = *(a+i);
*(a+i)= *(a+j);
*(a+j)=temp;
}
}
}
printf("Enter value to find ");
8. 8
scanf("%d", &s);
first = 0;
last = n - 1;
mid = (first+last)/2;
while (first <= last)
{
if (*(a+mid) < s)
first = mid + 1;
else if (*(a+mid) == s)
{
lo=mid;
break;
}
else
last = mid - 1;
mid = (first + last)/2;
}
pos=0;
if (first>last)
{
printf("Not found! %d is not present in the listn", s);
}
else
{
for (j=0;j<n;j++)
{
if (*(b+j)==*(a+lo))
{
*(loc+pos)=j;
pos=pos+1;
}
}
for (j=0; j<pos; j++)
printf("n Number is located at position - %d ", loc[j]+1);
}
printf("n");
9. 9
free (a);
free (b);
free (loc);
return 0;
}
Output 1
Enter number of elements 5
Enter the elements
2
3
4
6
5
Enter value to find 1
Not found! 1 is not present in the list
Output 2
Enter number of elements 10
Enter the elements
4
6
-2
7
8
9
6
1
7
7
Enter value to find 7
Number is located at position - 4
Number is located at position - 9
Number is located at position – 10
10. 10
Set 1 Q5 Program to find the Addition of two matrices
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int **a,**b,**c,n,m,p,q,i,j;
printf("Enter the no of rows and columns for first matrix");
scanf("%d %d",&n ,&m);
printf("Enter the no of rows and columns for second matrix");
scanf("%d %d",&p, &q);
if ((n==p)&&(m==q))
{
a= (int**) calloc(n,sizeof(int));
for (i=0;i<n; i++)
a[i]= (int*) calloc(m,sizeof(int));
b= (int**) calloc(p,sizeof(int));
for (i=0;i<p; i++)
b[i]= (int*) calloc(q,sizeof(int));
c= (int**) calloc(n,sizeof(int));
for (i=0;i<n; i++)
c[i]= (int*) calloc(m,sizeof(int));
printf("Enter the elements of first matrix");
for (i=0; i<n; i++)
for (j=0; j<m; j++)
{
scanf("%d",&(*(*(a+i)+j)));
}
printf("Enter the elements of second matrix");
for (i=0; i<p; i++)
for (j=0; j<q; j++)
{
scanf("%d",&(*(*(b+i)+j)));
11. 11
}
printf("Elements of first matrix aren");
for (i=0; i<n; i++)
{
for (j=0; j<m; j++)
{
printf("%d",*(*(a+i)+j));
printf("t");
}
printf("n");
}
printf("Elements of second matrix aren");
for (i=0; i<p; i++)
{
for (j=0; j<q; j++)
{
printf("%d",*(*(b+i)+j));
printf("t");
}
printf("n");
}
for (i=0; i<n; i++)
{
for (j=0; j<m; j++)
{
*(*(c+i)+j)=*(*(a+i)+j)+*(*(b+i)+j);
}
}
printf("Addition of matrix isn");
for (i=0; i<n; i++)
{
for (j=0; j<q; j++)
{
printf("%dt",*(*(c+i)+j));
}
printf("n");
12. 12
}
for (i=0;i<n; i++)
free (a[i]);
free (a);
for (i=0;i<p; i++)
free (b[i]);
free (b);
for (i=0;i<n; i++)
free (c[i]);
free (c);
}
else
printf("Number of columns and rows of both matrix should be equaln");
return 0;
}
Output
Enter the no of rows and columns for first matrix2
3
Enter the no of rows and columns for second matrix2
3
Enter the elements of first matrix-5
-4
-3
-2
-1
0
Enter the elements of second matrix0
1
2
3
4
5
Elements of first matrix are
-5 -4 -3
13. 13
-2 -1 0
Elements of second matrix are
0 1 2
3 4 5
Addition of matrix is
-5 -3 -1
1 3 5
14. 14
Set 1 Q6 Program to find the Product of two matrices
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int **a,**b,**c;
int n,m,p,q,i,j,k;
printf("Enter the no of rows and columns for first matrix");
scanf("%d %d",&n ,&m);
printf("Enter the no of rows and columns for second matrix");
scanf("%d %d",&p, &q);
if (m==p)
{
a= (int**) calloc(n,sizeof(int));
for (i=0;i<n; i++)
a[i]= (int*) calloc(m,sizeof(int));
b= (int**) calloc(p,sizeof(int));
for (i=0;i<p; i++)
b[i]= (int*) calloc(q,sizeof(int));
c= (int**) calloc(n,sizeof(int));
for (i=0;i<n; i++)
c[i]= (int*) calloc(q,sizeof(int));
printf("Enter the elements of first matrix");
for (i=0; i<n; i++)
for (j=0; j<m; j++)
{
scanf("%d",&(*(*(a+i)+j)));
}
printf("Enter the elements of second matrix");
for (i=0; i<p; i++)
for (j=0; j<q; j++)
{
scanf("%d",&(*(*(b+i)+j)));
15. 15
}
printf("Elements of first matrix aren");
for (i=0; i<n; i++)
{
for (j=0; j<m; j++)
{
printf("%d",*(*(a+i)+j));
printf("t");
}
printf("n");
}
printf("Elements of second matrix aren");
for (i=0; i<p; i++)
{
for (j=0; j<q; j++)
{
printf("%d",*(*(b+i)+j));
printf("t");
}
printf("n");
}
**c=0;
for(i=0;i<n;i++)
{
for(j=0;j<q;j++)
{
for(k=0;k<m;k++)
{
*(*(c+i)+j)=*(*(a+i)+k)**(*(b+k)+j)+*(*(c+i)+j);
}
}
}
printf("Product of matrix isn");
for (i=0; i<n; i++)
{
for (j=0; j<q; j++)
16. 16
{
printf("%dt",*(*(c+i)+j));
}
printf("n");
}
for (i=0;i<n; i++)
free (a[i]);
free (a);
for (i=0;i<p; i++)
free (b[i]);
free (b);
for (i=0;i<n; i++)
free (c[i]);
free (c);
}
else
printf("Number of columns of first matrix should be equal to number of
rows of second matrixn");
return 0;
}
Output
Enter the no of rows and columns for second matrix3
2
Enter the elements of first matrix4
5
6
2
7
8
Enter the elements of second matrix1
2
3
7
5
17. 17
6
Elements of first matrix are
4 5 6
2 7 8
Elements of second matrix are
1 2
3 7
5 6
Product of matrix is
49 79
63 101
18. 18
Set 1 Q7 Program to find largest and smallest element in a matrix and also print
their position in the matrix
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,m,small,large,i,j,p,q,r;
int **a,*laloc1,*laloc2,*smloc1,*smloc2;
printf("nEnter the Order of the matrix...n");
scanf("%d %d",&n,&m);
a= (int**) calloc(n,sizeof(int*));
for(i=0;i<n;i++)
a[i]=(int*)calloc(m,sizeof(int));
smloc1=(int*)malloc(m*sizeof(int));
smloc2=(int*)malloc(m*sizeof(int));
laloc1=(int*)malloc(m*sizeof(int));
laloc2=(int*)malloc(m*sizeof(int));
printf("nEnter the value of the matrix...n");
for(i=0;i<n;i++)
for(j=0;j<m;j++)
scanf("%d",&(*(*(a+i)+j)));
printf("n Entered Matrix is: n");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
printf("%d ",*(*(a+i)+j));
printf("n");
}
small=**a;
large=**a;
q=0;
r=0;
20. 20
printf("n");
for (i=0;i<n; i++)
free (a[i]);
free (a);
free (smloc1);
free (smloc2);
free (laloc1);
free (laloc2);
return 0;
}
Output
Enter the Order of the matrix...
3
3
Enter the value of the matrix...
4
5
6
2
3
5
6
1
0
Entered Matrix is:
4 5 6
2 3 5
6 1 0
Smallest number is 0
Located at row - 3 column - 3
Largest number is 6
Located at row - 1 column - 3
Located at row - 3 column – 1
21. 21
Set 1 Q8 Program to find the trace of a square matrix
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int **a,c,n,i,j;
printf("Enter the no of rows of a square matrix");
scanf("%d",&n);
a= (int**) calloc(n,sizeof(int));
for (i=0;i<n; i++)
a[i]= (int*) calloc(n,sizeof(int));
printf("Enter the elements of the matrix");
for (i=0; i<n; i++)
for (j=0; j<n; j++)
{
scanf("%d",&(*(*(a+i)+j)));
}
printf("Elements of first matrix aren");
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
{
printf("%d",*(*(a+i)+j));
printf("t");
}
printf("n");
}
c=0;
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
{
22. 22
if (i==j)
c=c+*(*(a+i)+j);
}
}
printf("Trace of a square matrix is %dn ", c);
for (i=0;i<n; i++)
free (a[i]);
free (a);
return 0;
}
Output
Enter the no of rows of a square matrix3
Enter the elements of the matrix7
5
3
1
2
3
4
8
5
Elements of first matrix are
7 5 3
1 2 3
4 8 5
Trace of a square matrix is 14
23. 23
Set 1 Q9 Program to find the sum of each column in a matrix and print its result
Program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int **a,*c,n,m,i,j;
printf("Enter the no of rows and columns for matrix");
scanf("%d %d",&n ,&m);
a= (int**) calloc(n,sizeof(int));
for (i=0;i<n; i++)
a[i]= (int*) calloc(m,sizeof(int));
c= (int*) malloc(n*sizeof(int));
printf("Enter the elements of the matrix");
for (i=0; i<n; i++)
for (j=0; j<m; j++)
{
scanf("%d",&(*(*(a+i)+j)));
}
printf("Elements of matrix aren");
for (i=0; i<n; i++)
{
for (j=0; j<m; j++)
{
printf("%d",*(*(a+i)+j));
printf("t");
}
printf("n");
}
for (j=0; j<m; j++)
{
*(c+j)=0;
for (i=0; i<n; i++)
{
24. 24
*(c+j)=*(c+j)+*(*(a+i)+j);
}
}
printf("Sum of each column is n ");
for (j=0;j<m; j++)
{
{
printf("%d",*(c+j));
printf("t");
}
}
printf("n ");
for (i=0;i<n; i++)
free (a[i]);
free (a);
free (c);
return 0;
}
Output
Enter the no of rows and columns for matrix2
3
Enter the elements of the matrix4
5
6
1
2
3
Elements of matrix are
4 5 6
1 2 3
Sum of each column is
5 7 9