0% found this document useful (0 votes)
9 views9 pages

Dsa 11701621039

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

Dsa 11701621039

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

RCC Institute of Information Technology

Subject: B.Tech in Electrical Engineering Continuous Assessment -1(CA1)


Academic Session: 2023-24 (ODD Sem)

Name: Suvojit Banerjee


Paper Name: Power Electronics
University Roll: 11701621039
Paper Code: OE-501A(5521)
CO Number : CO2 Year & Semester: 3rd year & 5th
Module Number: 1 semester
Bloom's Level of Taxonomy : Level 2
(Understanding)
Introduction
Arrays:-
An array is a linear data structure that stores a collection of elements of the same data type. These elements are accessed
using an index, which starts from 0 for the first element and increments by one for each subsequent element. Array are
widely used due to their simplicity and constant time access to individual elements. They find application in a variety of
scenarios that includes, Storing data, Sorting and Searching, Dynamic Programing, Matrices.

Stacks:-
A stack is a linear data structure that follows the Last In First Out (LIFO) principle. It consists of elements, where the last
element added if the first one to be removed. Stacks can be thought of as a collection of items stacked one on top of
another, similar to a stack of plates. Stacks have various practical applications such as, Functions calls and recursions,
expression evaluation, Undo and redo operations, Browser history, Balanced parentheses.
Array
Array is a linear data structure that is a collection of similar data types. Arrays are stored in contiguous memory locations. It is a
static data structure with a fixed size. It combines data of similar types.

Applications of Array
• Storing and accessing data: Arrays are used to store and retrieve data in a specific order. For example, an array can be used
to
store the scores of a group of students, or the temperatures recorded by a weather station.
• Sorting: Arrays can be used to sort data in ascending or descending order. Sorting algorithms such as bubble sort, merge
sort,
and quicksort rely heavily on arrays.
• Searching: Arrays can be searched for specific elements using algorithms such as linear search and binary search.
• Matrices: Arrays are used to represent matrices in mathematical computations such as matrix multiplication, linear algebra,
and image processing.
• Stacks and queues: Arrays are used as the underlying data structure for implementing stacks and queues, which are
commonly used in algorithms and data structures.
• Graphs: Arrays can be used to represent graphs in computer science. Each element in the array represents a node in the
graph, and the relationships between the nodes are represented by the values stored in the array.
• Dynamic programming: Dynamic programming algorithms often use arrays to store intermediate results of subproblems in
order to solve a larger problem.
Advantages of array data structure:
• Efficient access to elements: Arrays provide direct and efficient access to any element in the
collection. Accessing an element in an array is an O(1) operation, meaning that the time required to access
an element is constant and does not depend on the size of the array.
• Fast data retrieval: Arrays allow for fast data retrieval because the data is stored in contiguous
memory locations. This means that the data can be accessed quickly and efficiently without the need for
complex data structures or algorithms.
• Memory efficiency: Arrays are a memory-efficient way of storing data. Because the elements
of an array are stored in contiguous memory locations, the size of the array is known at compile time. This
means that memory can be allocated for the entire array in one block, reducing memory fragmentation.
• Versatility: Arrays can be used to store a wide range of data types, including integers, floating
point numbers, characters, and even complex data structures such as objects and pointers.
• Easy to implement: Arrays are easy to implement and understand, making them an ideal
choice for beginners learning computer programming.
• Compatibility with hardware: The array data structure is compatible with most hardware
architectures, making it a versatile tool for programming in a wide range of environments.
Disadvantages of array data structure:
• Fixed size: Arrays have a fixed size that is determined at the time of creation. This means that
if the size of the array needs to be increased, a new array must be created and the data must be
copied from the old array to the new array, which can be time-consuming and memory-intensive.
• Memory allocation issues: Allocating a large array can be problematic, particularly in systems
with limited memory. If the size of the array is too large, the system may run out of memory,
which can cause the program to crash.
• Insertion and deletion issues: Inserting or deleting an element from an array can be
inefficient and time-consuming because all the elements after the insertion or deletion point
must be shifted to accommodate the change.
• Wasted space: If an array is not fully populated, there can be wasted space in the memory
allocated for the array. This can be a concern if memory is limited.
• Limited data type support: Arrays have limited support for complex data types such as objects
and structures, as the elements of an array must all be of the same data type.
• Lack of flexibility: The fixed size and limited support for complex data types can make arrays
inflexible compared to other data structures such as linked lists and trees.
Stack
Stack is a simple linear data structure used for storing data. Stack follows the LIFO(Last In First
Out) strategy that states that the element that is inserted last will come out first. You can take a
pile of plates kept on top of each other as a real-life example. The plate which we put last is on
the top and since we remove the plate that is at the top, we can say that the plate that was put
last comes out first. It can be implemented through an array or linked list.
Application of Stack Data Structure:
• Function calls and recursion: When a function is called, the current state of the program is
pushed onto the stack. When the function returns, the state is popped from the stack to resume
the previous function’s execution.
• Undo/Redo operations: The undo-redo feature in various applications uses stacks to keep
track of the previous actions. Each time an action is performed, it is pushed onto the stack. To
undo the action, the top element of the stack is popped, and the reverse operation is performed.
• Expression evaluation: Stack data structure is used to evaluate expressions in infix, postfix,
and prefix notations. Operators and operands are pushed onto the stack, and operations are
performed based on the stack’s top elements.
• Browser history: Web browsers use stacks to keep track of the web pages you visit. Each time
you visit a new page, the URL is pushed onto the stack, and when you hit the back button, the
previous URL is popped from the stack.
• Balanced Parentheses: Stack data structure is used to check if parentheses are balanced or
not. An opening parenthesis is pushed onto the stack, and a closing parenthesis is popped from
the stack. If the stack is empty at the end of the expression, the parentheses are balanced.
• Backtracking Algorithms: The backtracking algorithm uses stacks to keep track of the states of
the problem-solving process.
Advantages of Stack:
• Easy implementation: Stack data structure is easy to implement using arrays or linked lists,
and its operations are simple to understand and implement.
• Efficient memory utilization: Stack uses a contiguous block of memory, making it more
efficient in memory utilization as compared to other data structures.
• Fast access time: Stack data structure provides fast access time for adding and removing
elements as the elements are added and removed from the top of the stack.
• Helps in function calls: Stack data structure is used to store function calls and their states,
which helps in the efficient implementation of recursive function calls.
• Supports backtracking: Stack data structure supports backtracking algorithms, which are used
in problem-solving to explore all possible solutions by storing the previous states.
• Used in Compiler Design: Stack data structure is used in compiler design for parsing and
syntax analysis of programming languages.
• Enables undo/redo operations: Stack data structure is used to enable undo and redo
operations in various applications like text editors, graphic design tools, and software
development environments.
Disadvantages of Stack:
• Limited capacity: Stack data structure has a limited capacity as it can only hold a fixed number
of elements. If the stack becomes full, adding new elements may result in stack overflow, leading
to the loss of data.
• No random access: Stack data structure does not allow for random access to its elements, and
it only allows for adding and removing elements from the top of the stack. To access an element
in the middle of the stack, all the elements above it must be removed.
• Memory management: Stack data structure uses a contiguous block of memory, which can
result in memory fragmentation if elements are added and removed frequently.
• Not suitable for certain applications: Stack data structure is not suitable for applications that
require accessing elements in the middle of the stack, like searching or sorting algorithms.
• Stack overflow and underflow: Stack data structure can result in stack overflow if too many
elements are pushed onto the stack, and it can result in stack underflow if too many elements
are popped from the stack.
• Recursive function calls limitations: While stack data structure supports recursive function
calls, too many recursive function calls can lead to stack overflow, resulting in the termination of
the program.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy