SlideShare a Scribd company logo
18ECCP101L
MASSIVE OPEN ONLINE
COURSE(MOOCS) - 1
PLATFORM – Udemy
Done By – K.JASWANTH (RA2011004010013)
Course Details
◦ Course Platform – Udemy
◦ Course Title – Fundamental Data Structures & Algorithms Using C language
◦ Created By – Shibaji Paul
◦ Duration – 15h 41m
About this Course
Introduction
◦ This course will help the students ability to grasp the knowledge of data structures and
algorithm using the C programming language. Knowledge of Data Structures and Algorithms
are essential in developing better programming skills.
◦ This course is based on the standard curriculum of Universities across the globe for graduate
level engineering and computer application course.
◦ Apart from step by step development of concepts students will also learn how to write
algorithms and then how to write programs based on the algorithms in this course.
◦ Students who want to prepare themselves for interview of top companies like Google, Amazon
or Microsoft. Students who are looking forward to be an efficient programmer, who are having
data structures in their syllabus. Students who wants to have in dept knowledge about the
Stack, Queue and Linked List, Efficiency of Algorithm, Binary Tree, Heap
Course Overview
◦ Total 14 Sections
◦ Introduction to the course
◦ All about stack
◦ Parenthesis checking using stack
◦ Polish notation and Reverse Polish notation
◦ All about Queue
◦ Linked list
◦ Singly Linked list
◦ Doubly Linked list
◦ Circular Linked list
◦ Efficiency of Algorithm
◦ Binary search
◦ Recursion
◦ Binary Tree and Binary search tree
◦ Heap
Section - 1
Section - 2
Section - 3
Section - 4
Section - 5
Section - 6
Section - 7
Section - 8
Section - 9
Section - 10
Section - 11
Section - 12
Section - 13
Section - 14
Stack
◦ A stack is a linear data structure, collection of items of the same type.
◦ Stack follows the Last In First Out (LIFO) fashion wherein the last element entered
is the first one to be popped out.
◦ In stacks, the insertion and deletion of elements happen only at one endpoint of it.
◦ Operations performed on Stacks
The following are the basic operations served by the Stacks.
• Push: This function adds an element to the top of the Stack.
• Pop: This function removes the topmost element from the stack.
• IsEmpty: Checks whether the stack is empty.
• IsFull: Checks whether the stack is full.
• Top: Displays the topmost element of the stack.
Implementation of Stack
Polish Notation
◦ Polish notation is a notation form for expressing arithmetic, logic and algebraic
equations. Its most basic distinguishing feature is that operators are placed on the
left of their operands. If the operator has a defined fixed number of operands, the
syntax does not require brackets or parenthesis to lessen ambiguity.
◦ Polish notation is also known as prefix notation, prefix Polish notation, normal
Polish notation, Warsaw notation and Lukasiewicz notation.
◦ Example:
◦ Infix notation with parenthesis: (3 + 2) * (5 – 1)
◦ Polish notation: * + 3 2 – 5 1
Reverse notation
◦ Reverse Polish notation (RPN) is a method for conveying mathematical expressions without
the use of separators such as brackets and parentheses. In this notation, the operators follow
their operands, hence removing the need for brackets to define evaluation priority. The
operation is read from left to right but execution is done every time an operator is reached,
and always using the last two numbers as the operands. This notation is suited for computers
and calculators since there are fewer characters to track and fewer operations to execute.
◦ So in a computer using RPN, the evaluation of the expression 5 1 – 3 * is as follows:
1.Push 5 into the stack. This is the first value.
2.Push 1 into the stack. This is the second value and is on the position above the 5.
3.Apply the subtraction operation by taking two operands from the stack (1 and 5). The top
value (1) is subtracted from the value below it (5), and the result (4) is stored back to the
stack. 4 is now the only value in the stack and is in the bottom.
4.Push 3 into the stack. This value is in the position above 4 in the stack.
5.Apply the multiplication operation by taking the last two numbers off the stack and
multiplying them. The result is then placed back into the stack. After this operation, the stack
now only contains the number 12.
QUEUE
◦ A queue in C is basically a linear data structure to store and manipulate the data elements. It
follows the order of First In First Out (FIFO).
◦ In queues, the first element entered into the array is the first element to be removed from the
array.
◦ A queue is open at both ends. One end is provided for the insertion of data and the other end
for the deletion of data.
◦ A queue is open at both ends. One end is provided for the insertion of data and the other end
for the deletion of data.
◦ A queue can be implemented with any programming language such as C, Java, Python, etc.
Implementation of Queue
Linked List
◦ A linked list is a sequence of data structures, which are connected together via links. Linked List
is a sequence of links which contains items. Each link contains a connection to another link.
Linked list is the second most-used data structure after array.
◦ The size of the arrays is fixed: So we must know the upper limit on the number of elements in
advance. Also, generally, the allocated memory is equal to the upper limit irrespective of the
usage.
Implementation of linked list
Singly Linked list
◦ Singly linked list is the most common linked list among the others. The singly linked list can be
traversed only in one direction. It is a collection of ordered sets of elements. In singly linked list,
Each node has a data and a pointer to the next node.
◦ Syntax
struct node
{ int data;
struct node *next;
}
Double Linked List
◦ In the doubly linked list, we add a pointer to the previous node and also to the next node. The
Doubly linked list can be traversed in two directions such as forward and backward.
◦ Syntax
struct node
{ int data;
struct node *next_node;
struct node *previous_node;
}
Circular Linked List
◦ The circular linked list is a linked list where all nodes are connected to form a circle. In a
circular linked list, the first node and the last node are connected to each other which forms a
circle. There is no NULL at the end.Syntax
syntax:
class Node{
int value;
// Points to the next node.
Node next;
}
There are two types of circular linked list those are 1.circular singly
linked list
2.circular doubled linked list
◦ Circular singly linked list: In a circular Singly linked list, the last
node of the list contains a pointer to the first node of the list. We
traverse the circular singly linked list until we reach the same
node where we started. The circular singly linked list has no
beginning or end. No null value is present in the next part of any
of the nodes.
◦ Circular Doubly Linked List has properties of both doubly linked
list and circular linked list in which two consecutive elements are
linked or connected by the previous and next pointer and the last
node points to the first node by the next pointer and also the
first node points to the last node by the previous pointer.
Efficiency of Algorithm:
◦ In computer science, algorithmic efficiency is a property of an algorithm which relates to the
amount of computational resources used by the algorithm
◦ Efficiency of an algorithm is measured by assuming that all other factors, for example, processor
speed, are constant and have no effect on the implementation. A Posterior Analysis − This is an
empirical analysis of an algorithm. The selected algorithm is implemented using programming
language.
◦ One way to measure the efficiency of an algorithm is to count how many operations it needs in
order to find the answer across different input sizes.
Binary search algorithm
◦ Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search
interval in half. The idea of binary search is to use the information that the array is sorted and
reduce the time complexity to O(Log n)
◦ Example:
Input: arr[] = {10, 20, 30, 50, 60, 80, 110, 130, 140, 170}, x = 110
Output: 6
Explanation: Element x is present at index 6.
Binary Search Algorithm can be implemented in the following two ways
1. Iterative Method
2. Recursive Method
Iteration Method:
binarySearch(arr, x, low, high)
repeat till low = high
mid = (low + high)/2
if (x == arr[mid])
return mid
else if (x > arr[mid]) // x is on the right
side
low = mid + 1
else // x is on the left side
high = mid - 1
Recursive Method:
binarySearch(arr, x, low, high)
if low > high
return False
else
mid = (low + high) / 2
if x == arr[mid]
return mid
else if x > arr[mid] // x is on the right side
return binarySearch(arr, x, mid + 1, high)
else // x is on the left side
return binarySearch(arr, x, low, mid - 1)
Recursion:
◦ In general terms recursion means the process to define a problem or the solution for
a problem in a much simpler way compared to the original version. It is a problem-
solving programming technique that has a remarkable and unique characteristic.
◦ In recursion in data structure, a method or a function has the capability to decode an
issue. In the process of recursion, a problem is resolved by transforming it into small
variations of itself. In this procedure, the function can call itself either directly or
indirectly. Based on the differences in call recursion in data structure can be
categorized into different categories. You will get to know about these categories
later in the blog.
◦ Recursion in data structure is additionally an adequate programming technique. A
recursive subroutine is described as one that directly or indirectly calls itself. Calling a
subroutine specifically indicates that the characterization of the subroutine already
has the call statement of calling the subroutine that has been defined.
Example on Recursion:
using namespace std;
// Factorial function
int f(int n)
{
// Stop condition
if ( n == 0 || n == 1 )
return 1;
// Recursive condition
else
return n * f(n – 1);
}
// Driver code
int main()
{
int n = 6;
cout<<“Required factorial of 6 “<<n<<” = “<<f(n);
return 0;
}
The output is displayed as:
Required factorial of 6 = 720
Binary Tree:
◦ 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
◦ Binary Tree Representation
A Binary tree is represented by a pointer to the topmost node of the tree. If the tree is
empty, then the value of the root is NULL.
Binary Tree node contains the following parts:
1.Data
2.Pointer to left child
3.Pointer to right child
HEAP:
◦ A Heap is a special Tree-based data structure in which the tree is a complete binary tree.
◦ Operations of Heap Data Structure:
• Heapify: a process of creating a heap from an array.
• Insertion: process to insert an element in existing heap time complexity O(log N).
• Deletion: deleting the top element of the heap or the highest priority element, and then organizing
the heap and returning the element with time complexity O(log N).
• Peek: to check or find the most prior element in the heap, (max or min element for max and min
heap).
◦ Types of Heap Data Structure
Generally, Heaps can be of two types:
1.Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys
present at all of it’s children. The same property must be recursively true for all sub-trees in that
Binary Tree.
2.Min-Heap: In a Min-Heap the key present at the root node must be minimum among the keys
present at all of it’s children. The same property must be recursively true for all sub-trees in that
Binary Tree.
Course Outcomes
◦ Students who want to prepare themselves for interview of top companies like Google,
Amazon or Microsoft.
◦ Students who are looking forward to be an efficient programmer, who are having data
structures in their syllabus.
◦ Students who wants to have in dept knowledge about the Stack, Queue and Linked
List, Efficiency of Algorithm, Binary Tree, Heap
Weekly Quizzes- on UDEMY
Overall Grade= 100%
Certificate

More Related Content

Similar to Data Structures in C

Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
Abdul salam
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
JayaKrishna636858
 
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
RGPV De Bunkers
 
Data Structure
Data StructureData Structure
Data Structure
Karthikeyan A K
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
ADSA orientation.pptx
ADSA orientation.pptxADSA orientation.pptx
ADSA orientation.pptx
Kiran Babar
 
Data structure
Data structureData structure
Data structure
Muhammad Farhan
 
Queues
QueuesQueues
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
SeethaDinesh
 
Data Structure and Algorithms –Introduction.pptx
Data Structure and Algorithms –Introduction.pptxData Structure and Algorithms –Introduction.pptx
Data Structure and Algorithms –Introduction.pptx
R S Anu Prabha
 
Data structure
 Data structure Data structure
Data structure
Shahariar limon
 
Data Structures 6
Data Structures 6Data Structures 6
Data Structures 6
Dr.Umadevi V
 
Study on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining SortStudy on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining Sort
IRJET Journal
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
ibrahim386946
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
RobinRohit2
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Axmedcarb
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searching
Mvenkatarao
 
Data structures
Data structuresData structures
Data structures
naveeth babu
 
DATA STRUCTURES unit 1.pptx
DATA STRUCTURES unit 1.pptxDATA STRUCTURES unit 1.pptx
DATA STRUCTURES unit 1.pptx
ShivamKrPathak
 

Similar to Data Structures in C (20)

Data structure and algorithm.
Data structure and algorithm. Data structure and algorithm.
Data structure and algorithm.
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
 
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdfADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
ADA Unit-1 Algorithmic Foundations Analysis, Design, and Efficiency.pdf
 
Data Structure
Data StructureData Structure
Data Structure
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
ADSA orientation.pptx
ADSA orientation.pptxADSA orientation.pptx
ADSA orientation.pptx
 
Data structure
Data structureData structure
Data structure
 
Queues
QueuesQueues
Queues
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
 
Data Structure and Algorithms –Introduction.pptx
Data Structure and Algorithms –Introduction.pptxData Structure and Algorithms –Introduction.pptx
Data Structure and Algorithms –Introduction.pptx
 
Data structure
 Data structure Data structure
Data structure
 
Data Structures 6
Data Structures 6Data Structures 6
Data Structures 6
 
Study on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining SortStudy on Sorting Algorithm and Position Determining Sort
Study on Sorting Algorithm and Position Determining Sort
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Introduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searchingIntroduction to Data Structures Sorting and searching
Introduction to Data Structures Sorting and searching
 
Data structures
Data structuresData structures
Data structures
 
U nit i data structure-converted
U nit   i data structure-convertedU nit   i data structure-converted
U nit i data structure-converted
 
DATA STRUCTURES unit 1.pptx
DATA STRUCTURES unit 1.pptxDATA STRUCTURES unit 1.pptx
DATA STRUCTURES unit 1.pptx
 

Recently uploaded

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 

Recently uploaded (20)

The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 

Data Structures in C

  • 1. 18ECCP101L MASSIVE OPEN ONLINE COURSE(MOOCS) - 1 PLATFORM – Udemy Done By – K.JASWANTH (RA2011004010013)
  • 2. Course Details ◦ Course Platform – Udemy ◦ Course Title – Fundamental Data Structures & Algorithms Using C language ◦ Created By – Shibaji Paul ◦ Duration – 15h 41m
  • 4. Introduction ◦ This course will help the students ability to grasp the knowledge of data structures and algorithm using the C programming language. Knowledge of Data Structures and Algorithms are essential in developing better programming skills. ◦ This course is based on the standard curriculum of Universities across the globe for graduate level engineering and computer application course. ◦ Apart from step by step development of concepts students will also learn how to write algorithms and then how to write programs based on the algorithms in this course. ◦ Students who want to prepare themselves for interview of top companies like Google, Amazon or Microsoft. Students who are looking forward to be an efficient programmer, who are having data structures in their syllabus. Students who wants to have in dept knowledge about the Stack, Queue and Linked List, Efficiency of Algorithm, Binary Tree, Heap
  • 5. Course Overview ◦ Total 14 Sections ◦ Introduction to the course ◦ All about stack ◦ Parenthesis checking using stack ◦ Polish notation and Reverse Polish notation ◦ All about Queue ◦ Linked list ◦ Singly Linked list ◦ Doubly Linked list ◦ Circular Linked list ◦ Efficiency of Algorithm ◦ Binary search ◦ Recursion ◦ Binary Tree and Binary search tree ◦ Heap
  • 20. Stack ◦ A stack is a linear data structure, collection of items of the same type. ◦ Stack follows the Last In First Out (LIFO) fashion wherein the last element entered is the first one to be popped out. ◦ In stacks, the insertion and deletion of elements happen only at one endpoint of it. ◦ Operations performed on Stacks The following are the basic operations served by the Stacks. • Push: This function adds an element to the top of the Stack. • Pop: This function removes the topmost element from the stack. • IsEmpty: Checks whether the stack is empty. • IsFull: Checks whether the stack is full. • Top: Displays the topmost element of the stack.
  • 22. Polish Notation ◦ Polish notation is a notation form for expressing arithmetic, logic and algebraic equations. Its most basic distinguishing feature is that operators are placed on the left of their operands. If the operator has a defined fixed number of operands, the syntax does not require brackets or parenthesis to lessen ambiguity. ◦ Polish notation is also known as prefix notation, prefix Polish notation, normal Polish notation, Warsaw notation and Lukasiewicz notation. ◦ Example: ◦ Infix notation with parenthesis: (3 + 2) * (5 – 1) ◦ Polish notation: * + 3 2 – 5 1
  • 23. Reverse notation ◦ Reverse Polish notation (RPN) is a method for conveying mathematical expressions without the use of separators such as brackets and parentheses. In this notation, the operators follow their operands, hence removing the need for brackets to define evaluation priority. The operation is read from left to right but execution is done every time an operator is reached, and always using the last two numbers as the operands. This notation is suited for computers and calculators since there are fewer characters to track and fewer operations to execute. ◦ So in a computer using RPN, the evaluation of the expression 5 1 – 3 * is as follows: 1.Push 5 into the stack. This is the first value. 2.Push 1 into the stack. This is the second value and is on the position above the 5. 3.Apply the subtraction operation by taking two operands from the stack (1 and 5). The top value (1) is subtracted from the value below it (5), and the result (4) is stored back to the stack. 4 is now the only value in the stack and is in the bottom. 4.Push 3 into the stack. This value is in the position above 4 in the stack. 5.Apply the multiplication operation by taking the last two numbers off the stack and multiplying them. The result is then placed back into the stack. After this operation, the stack now only contains the number 12.
  • 24. QUEUE ◦ A queue in C is basically a linear data structure to store and manipulate the data elements. It follows the order of First In First Out (FIFO). ◦ In queues, the first element entered into the array is the first element to be removed from the array. ◦ A queue is open at both ends. One end is provided for the insertion of data and the other end for the deletion of data. ◦ A queue is open at both ends. One end is provided for the insertion of data and the other end for the deletion of data. ◦ A queue can be implemented with any programming language such as C, Java, Python, etc.
  • 26. Linked List ◦ A linked list is a sequence of data structures, which are connected together via links. Linked List is a sequence of links which contains items. Each link contains a connection to another link. Linked list is the second most-used data structure after array. ◦ The size of the arrays is fixed: So we must know the upper limit on the number of elements in advance. Also, generally, the allocated memory is equal to the upper limit irrespective of the usage.
  • 28. Singly Linked list ◦ Singly linked list is the most common linked list among the others. The singly linked list can be traversed only in one direction. It is a collection of ordered sets of elements. In singly linked list, Each node has a data and a pointer to the next node. ◦ Syntax struct node { int data; struct node *next; }
  • 29. Double Linked List ◦ In the doubly linked list, we add a pointer to the previous node and also to the next node. The Doubly linked list can be traversed in two directions such as forward and backward. ◦ Syntax struct node { int data; struct node *next_node; struct node *previous_node; }
  • 30. Circular Linked List ◦ The circular linked list is a linked list where all nodes are connected to form a circle. In a circular linked list, the first node and the last node are connected to each other which forms a circle. There is no NULL at the end.Syntax syntax: class Node{ int value; // Points to the next node. Node next; }
  • 31. There are two types of circular linked list those are 1.circular singly linked list 2.circular doubled linked list ◦ Circular singly linked list: In a circular Singly linked list, the last node of the list contains a pointer to the first node of the list. We traverse the circular singly linked list until we reach the same node where we started. The circular singly linked list has no beginning or end. No null value is present in the next part of any of the nodes. ◦ Circular Doubly Linked List has properties of both doubly linked list and circular linked list in which two consecutive elements are linked or connected by the previous and next pointer and the last node points to the first node by the next pointer and also the first node points to the last node by the previous pointer.
  • 32. Efficiency of Algorithm: ◦ In computer science, algorithmic efficiency is a property of an algorithm which relates to the amount of computational resources used by the algorithm ◦ Efficiency of an algorithm is measured by assuming that all other factors, for example, processor speed, are constant and have no effect on the implementation. A Posterior Analysis − This is an empirical analysis of an algorithm. The selected algorithm is implemented using programming language. ◦ One way to measure the efficiency of an algorithm is to count how many operations it needs in order to find the answer across different input sizes.
  • 33. Binary search algorithm ◦ Binary Search is a searching algorithm used in a sorted array by repeatedly dividing the search interval in half. The idea of binary search is to use the information that the array is sorted and reduce the time complexity to O(Log n) ◦ Example: Input: arr[] = {10, 20, 30, 50, 60, 80, 110, 130, 140, 170}, x = 110 Output: 6 Explanation: Element x is present at index 6.
  • 34. Binary Search Algorithm can be implemented in the following two ways 1. Iterative Method 2. Recursive Method Iteration Method: binarySearch(arr, x, low, high) repeat till low = high mid = (low + high)/2 if (x == arr[mid]) return mid else if (x > arr[mid]) // x is on the right side low = mid + 1 else // x is on the left side high = mid - 1 Recursive Method: binarySearch(arr, x, low, high) if low > high return False else mid = (low + high) / 2 if x == arr[mid] return mid else if x > arr[mid] // x is on the right side return binarySearch(arr, x, mid + 1, high) else // x is on the left side return binarySearch(arr, x, low, mid - 1)
  • 35. Recursion: ◦ In general terms recursion means the process to define a problem or the solution for a problem in a much simpler way compared to the original version. It is a problem- solving programming technique that has a remarkable and unique characteristic. ◦ In recursion in data structure, a method or a function has the capability to decode an issue. In the process of recursion, a problem is resolved by transforming it into small variations of itself. In this procedure, the function can call itself either directly or indirectly. Based on the differences in call recursion in data structure can be categorized into different categories. You will get to know about these categories later in the blog. ◦ Recursion in data structure is additionally an adequate programming technique. A recursive subroutine is described as one that directly or indirectly calls itself. Calling a subroutine specifically indicates that the characterization of the subroutine already has the call statement of calling the subroutine that has been defined.
  • 36. Example on Recursion: using namespace std; // Factorial function int f(int n) { // Stop condition if ( n == 0 || n == 1 ) return 1; // Recursive condition else return n * f(n – 1); } // Driver code int main() { int n = 6; cout<<“Required factorial of 6 “<<n<<” = “<<f(n); return 0; } The output is displayed as: Required factorial of 6 = 720
  • 37. Binary Tree: ◦ 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 ◦ Binary Tree Representation A Binary tree is represented by a pointer to the topmost node of the tree. If the tree is empty, then the value of the root is NULL. Binary Tree node contains the following parts: 1.Data 2.Pointer to left child 3.Pointer to right child
  • 38. HEAP: ◦ A Heap is a special Tree-based data structure in which the tree is a complete binary tree. ◦ Operations of Heap Data Structure: • Heapify: a process of creating a heap from an array. • Insertion: process to insert an element in existing heap time complexity O(log N). • Deletion: deleting the top element of the heap or the highest priority element, and then organizing the heap and returning the element with time complexity O(log N). • Peek: to check or find the most prior element in the heap, (max or min element for max and min heap). ◦ Types of Heap Data Structure Generally, Heaps can be of two types: 1.Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of it’s children. The same property must be recursively true for all sub-trees in that Binary Tree. 2.Min-Heap: In a Min-Heap the key present at the root node must be minimum among the keys present at all of it’s children. The same property must be recursively true for all sub-trees in that Binary Tree.
  • 39.
  • 40. Course Outcomes ◦ Students who want to prepare themselves for interview of top companies like Google, Amazon or Microsoft. ◦ Students who are looking forward to be an efficient programmer, who are having data structures in their syllabus. ◦ Students who wants to have in dept knowledge about the Stack, Queue and Linked List, Efficiency of Algorithm, Binary Tree, Heap
  • 41. Weekly Quizzes- on UDEMY Overall Grade= 100%
  • 42.