Data structures are a specific way of organizing
data in a specialized format on a computer so that
the information can be organized, processed,
stored, and retrieved quickly and effectively. They
are a means of handling information, rendering
the data for easy use.
create a program:
header file
main function
block of statement between a curly braces
semicolon at end of the each statement in a block
# include<stdio.h>
printf();
scanf();
getc();
putc();
#include<conio.h>
clrscr();
getch();
textcolor();
#include<math.h>
#include<string.h>
SYNTAX FOR PROGRAM:
# include<stdio.h>
#include<conio.h>
int main()
{
.................. ;
................... ;
............... ;
return;
}
PRIMITIVE DATA TYPE:
int = this ia a data type which is used to represent a numbers in a
programming.It occupies 2 or 4 bytes in a memory location.
float = this is a data type which is used to represent a decimal
values . It occupies bytes 4 in a memory location.
char = this ia a data type which is used to represent a alphabets in
a programming.It occupies 1 byte in a memory location.
boolean =this expression is a logical statement that is either TRUE or
FALSE. It occupies 2 bytes in a memory location.
NON PRIMITIVE DATA TYPE:
Arrays a kind of data structure that can store a fixed-size
sequential collection of elements of the same type.
ARRAY:
data type arrayName [ arraySize ];
SYNTAX:
// Program to take 5 values from the user and store them in an array
// Print the elements stored in the array
#include <stdio.h>
int main() {
int values[5];
printf("Enter 5 integers: ");
// taking input and storing it in an array
for(int i = 0; i < 5; ++i) {
scanf("%d", &values[i]);
}
printf("Displaying integers: ");
// printing elements of an array
for(int i = 0; i < 5; ++i) {
printf("%dn", values[i]);
}
return 0;
}
Enter 5 integers: 1
-3
34
0
3
Displaying integers: 1
-3
34
0
3
OUTPUT:
sparse matrices:
This ia an array which consists more zero element than non
zero value.
ex:
0 8 0 0
9 0 0 0
0 0 7 0
Stack is a linear data structure that follows a particular order in
which the operations are performed. The order may be
LIFO(Last In First Out)
stack:
stack operations:
push() = insert the element at top
pop() = pick up the element at the top
peek() =to know the value of element which entered last
top() = to know the ind value

data_structure (1).pptx

  • 2.
    Data structures area specific way of organizing data in a specialized format on a computer so that the information can be organized, processed, stored, and retrieved quickly and effectively. They are a means of handling information, rendering the data for easy use.
  • 3.
    create a program: headerfile main function block of statement between a curly braces semicolon at end of the each statement in a block # include<stdio.h> printf(); scanf(); getc(); putc();
  • 4.
  • 5.
    SYNTAX FOR PROGRAM: #include<stdio.h> #include<conio.h> int main() { .................. ; ................... ; ............... ; return; }
  • 7.
    PRIMITIVE DATA TYPE: int= this ia a data type which is used to represent a numbers in a programming.It occupies 2 or 4 bytes in a memory location. float = this is a data type which is used to represent a decimal values . It occupies bytes 4 in a memory location. char = this ia a data type which is used to represent a alphabets in a programming.It occupies 1 byte in a memory location. boolean =this expression is a logical statement that is either TRUE or FALSE. It occupies 2 bytes in a memory location.
  • 8.
    NON PRIMITIVE DATATYPE: Arrays a kind of data structure that can store a fixed-size sequential collection of elements of the same type. ARRAY: data type arrayName [ arraySize ]; SYNTAX:
  • 10.
    // Program totake 5 values from the user and store them in an array // Print the elements stored in the array #include <stdio.h> int main() { int values[5]; printf("Enter 5 integers: "); // taking input and storing it in an array for(int i = 0; i < 5; ++i) { scanf("%d", &values[i]); } printf("Displaying integers: "); // printing elements of an array for(int i = 0; i < 5; ++i) { printf("%dn", values[i]); } return 0; }
  • 11.
    Enter 5 integers:1 -3 34 0 3 Displaying integers: 1 -3 34 0 3 OUTPUT:
  • 12.
    sparse matrices: This iaan array which consists more zero element than non zero value. ex: 0 8 0 0 9 0 0 0 0 0 7 0
  • 13.
    Stack is alinear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) stack:
  • 14.
    stack operations: push() =insert the element at top pop() = pick up the element at the top peek() =to know the value of element which entered last top() = to know the ind value