0% found this document useful (0 votes)
39 views28 pages

Dsappt

The document provides an overview of various data structures and algorithms topics in C programming. It contains 3 sections: 1) It introduces C language and covers basic concepts like arrays, pointers, structures, and file handling in C. Arrays allow storing similar data together, pointers store the address of a variable, and structures group different data types. 2) It discusses common data structures like stacks, queues, linked lists, binary trees, and graphs. Stacks follow LIFO, queues follow FIFO, and linked lists connect nodes using pointers. 3) It provides information on algorithms topics like searching and sorting methods applicable to different data structures.

Uploaded by

Amit yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views28 pages

Dsappt

The document provides an overview of various data structures and algorithms topics in C programming. It contains 3 sections: 1) It introduces C language and covers basic concepts like arrays, pointers, structures, and file handling in C. Arrays allow storing similar data together, pointers store the address of a variable, and structures group different data types. 2) It discusses common data structures like stacks, queues, linked lists, binary trees, and graphs. Stacks follow LIFO, queues follow FIFO, and linked lists connect nodes using pointers. 3) It provides information on algorithms topics like searching and sorting methods applicable to different data structures.

Uploaded by

Amit yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

C Language

Member’s Name Roll Number Branch

Under the guidance of


Mentor name
CONTENTS
Introduction to c
array & string
Pointer
Function
Structure
File handling
CONTENTS
• Introduction to DSA
• Stack
• Queue
• Linked list
• Binary search tree
• Graph
CONTENTS
• Introduction to c :-
The C Language is developed by Dennis Ritchie for creating
system applications that directly interact with the hardware
devices such as drivers, kernels, etc.
C programming is considered as the base for other programming
languages, that is why it is known as mother language.
CONTENTS
• Array :-
An array is defined as the collection of similar type of data items stored at contiguous memory
locations. Arrays are the derived data type in C programming language which can store the primitive
type of data such as int, char, double, float, etc.

ADVANTAGE OF C ARRAY
1) CODE OPTIMIZATION :-Less code to the access the data.
2) EASE OF SORTING :-By using the for loop, we can retrieve the elements of an array easily
3) EASE OF TRAVERSING :-To sort the elements of the array, we need a few lines of code only
4) RANDOM ACESS :-We can access any element randomly using the array.

DECLARATION OF C ARRAY
data_type array_name[array_size];  
CONTENTS
• POINTERS :-
The pointer in C language is a variable which stores the address of another
variable. This variable can be of type int, char, array, function, or any other
pointer.

DECLARING A POINTER

int *a;//pointer to int  
char *c;//pointer to char  
CONTENTS
• Pointer to array
int arr[10];
Int *p[10]=&arr; // Variable p of type pointer is pointing to the address of an integ
er array arr.
Pointer to a function:-
1.void show (int);  
2.void(*p)(int) = &display; // Pointer p is pointing to the address of a function  
3.Pointer to structure:- struct st {  
   int i;  
   float f;  
}ref;  
struct st *p = &ref; 
CONTENTS
• Advantage of pointer:-
1) Pointer reduces the code and improves the performance, it is used to
retrieving strings, trees, etc. and used with arrays, structures, and
functions.
2)  We can return multiple values from a function using the pointer.
3) It makes you able to access any memory location in the computer's
memory.
CONTENTS
• Usage of pointer
1) Dynamic memory allocation:- we can dynamically allocate memory
using malloc() and calloc() functions where the pointer is used.
2) Arrays, Functions, and Structures:-Pointers in c language are widely
used in arrays, functions, and structures. It reduces the code and
improves the performance.
CONTENTS
• C Structure:-Structure in c is a user-defined data type that enables us to store the
collection of different data types. Each element of a structure is called a member.
Structures ca; simulate the use of classes and templates as it can store various
information
1.Syntax struct structure_name   
{  
   data_type member1;  
    data_type member2;  
   .  
  .  
   data_type memeberN;  
};  
CONTENTS
• Memory allocation of the structure
CONTENTS
• File Handling in C:-
File handling in C enables us to create, update, read, and delete the
files stored on the local file system through our C program. The
following operations can be performed on a file:-
1) Creation of the new file
2) Opening an existing file
3) Reading from the file
4) Writing to the file
5) Deleting the file
CONTENTS
• Opening File: fopen()
SYNTAX:-
FILE *fopen( const char * filename, const char * mode );  
• Closing File: fclose()
SYNTAX:- int fclose( FILE *fp );  
• writing file :C fprintf() and fscanf()
SYNTAX:-
int fprintf(FILE *stream, const char *format [, argument, ...])  
• Reading File : fscanf() function
SYNTAX :-int fscanf(FILE *stream, const char *format [, argument, ...])  
CONTENTS
• DSA:- The term DSA stands for Data Structures and Algorithms. As
the name itself suggests, it is a combination of two separate yet
interrelated topics – Data Structure and Algorithms.
DATA STRUCTURE :- A data structure is defined as a particular
way of storing and organizing data in our devices to use the data
efficiently and effectively. 

ALGORITHM :- Algorithm is defined as a process or set of well-


defined instructions that are typically used to solve a particular group of
problems or perform a specific type of calculation. 
CONTENTS
CONTENTS
•  Stack :- It is a linear data structure that follows a particular order in
which the operations are performed.
• LIFO(Last in first out):- This strategy states that the element that is
inserted last will come out first.
• Basic Operations on Stack
push() to insert an element into the stack
pop() to remove an element from the stack
top() Returns the top element of the stack.
isEmpty() returns true is stack is empty else false.
size() returns the size of stack.
CONTENTS
CONTENTS
• Queue:- A queue is defined as a linear data structure that is
open at both ends and the operations are performed in First
In First Out (FIFO) order.
CONTENTS
• FIFO Principle of Queue:
• A Queue is like a line waiting to purchase tickets, where the first
person in line is the first person served. (i.e. First come first serve)
• Position of the entry in a queue ready to be served, that is, the first
entry that will be removed from the queue, is called the front of the
queue(sometimes, head of the queue), similarly, the position of the
last entry in the queue, that is, the one most recently added, is called
the rear (or the tail) of the queue.
• Characteristics of Queue:
• Queue can handle multiple data.
• We can access both ends.
• They are fast and flexible. 
CONTENTS
• Binary Tree Data Structure
• Binary Tree is defined as a Tree data structure with at most 2 children.
Since each element in a binary tree can have only 2 children, we typically
name them the left and right child
CONTENTS
CONTENTS
• Linked List Data Structure
• A linked list is a linear data structure, in which the
elements are not stored at contiguous memory locations.
The elements in a linked list are linked using pointers as
shown in the below image

• In simple words, a linked list consists of nodes where each


node contains a data field and a reference(link) to the next
node in the list.
CONTENTS
CONTENTS
• Graph Data Structure And Algorithms
• A Graph is a non-linear data structure consisting of vertices and edges.
The vertices are sometimes also referred to as nodes and the edges are
lines or arcs that connect any two nodes in the graph.
Thank You

You might also like