DS MID Term
DS MID Term
URN: 2022-M-05102002
MOOC TITLE:
Link:
Conclusion
Int this topic we learn about LinkedList what is the working how to store inserting deleting
searching operation.
2. Binary Trees
2.Binary Trees
The Binary tree indicates that the node can only have two children. Because the binary name
implies 'two,' each node can have either zero, one, or two children.
Properties of Binary Tree
The maximum number of nodes at each level of I is 2i.
The length of the path from the root node to the leaf node defines the tree's height. The
height of the tree shown above is three. As a result, the maximum number of nodes at
height 3 is (1+2+4+8) = 15. In general, at height h, the maximum number of nodes
possible is (20 + 21 + 22+....2h) = 2h+1 -1.
At height h, the smallest number of nodes possible is h+1.
The height of the tree will be maximum if the number of nodes is minimal. In contrast,
if the number of nodes is maximised, the tree's height is minimised.
Conclusion
In this topic we learn about Circular Queue which are the a part of queue
In this queue the last node refer the first data address so it working like a circle after last comes
first and before first come last .
4. Stack and Queue
Stack
A stack is an Abstract Data Type (ADT) that is found in almost all programming languages.
It is called a stack because it behaves like a real-world stack, such as a deck of cards or a pile
of plates.
A real-world stack can only perform operations at one end. For instance, we can only place
or remove a card or plate from the top of the stack. Similarly, Stack ADT allows all data
operations at only one end. We can only access the top element of a stack at any given time.
Because of this feature, it has a LIFO data structure. LIFO is an abbreviation for Last-in-
First-Out. The element that was placed (inserted or added) last is accessed first in this case.
In stack terminology, an insertion operation is referred to as a PUSH operation, while a
removal operation is referred to as a POP operation.
Array, Structure, Pointer, and Linked List can all be used to implement a stack. Stacks can
be either fixed in size or dynamically resized. Stack will be implemented using arrays in this
case, resulting in a fixed size stack implementation.
Fundamental Operations
Initializing the stack, using it, and then de-initializing it are examples of stack operations. Aside
from these fundamentals, a stack is used for the two primary operations listed below.
Push Operation
The process of putting a new data element onto stack is known as a Push Operation. Push
operation involves a series of steps −
Step 3 − If the stack is not full, increments top to point next empty space.
Step 4 − Adds data element to the stack location, where top is pointing.
if stack is full
return null
endif
top ← top + 1
stack[top] ← data
end procedure
Pop Operation
A pop operation is when you access the content while removing it from the
stack. The data element is not actually destroyed in the array implementation of the
pop() action; rather, top is decremented to a lower place in the stack to point to the
subsequent value. However, pop() actually deallocates memory space and removes a
data element in linked-list implementation.
Step 3 − If the stack is not empty, accesses the data element at which top is
pointing.
if stack is empty
return null
endif
data ← stack[top]
top ← top - 1
return data
end procedure
Queue
Queues are abstract data structures that are similar to Stacks. A queue, unlike a stack, is open
at both ends. The one end is always used to insert data (enqueue), while the other end is
always used to remove data (dequeue). The queue employs the First-In-First-Out (FIFO)
method, which means that the data item stored first will be accessed first.
Representation of a Queue
We now understand that in a queue, we access both ends for different reasons. The following
diagram attempts to explain queue representation as a data structure.
Fundamental Operations
Queue operations may include initialising or defining the queue, using it, and then
erasing it completely from memory. In this section, we will attempt to comprehend
the fundamental operations associated with queues.
Enqueue Operation
Queues keep two data pointers, one in front and one in the back. As a result, its
operations are more difficult to implement than stacks'.
Step 3: If the queue isn't full, move the rear pointer to the next empty space.
Step 4: Add a data element to the queue location indicated by the rear arrow.
Step 3: If the queue is not empty, access the data indicated by the front.
Step 4: Move the front pointer to the next available data element.
A decision tree is a non-parametric supervised learning algorithm that can be used for
classification as well as regression tasks. It has a tree structure that is hierarchical and
consists of a root node, branches, internal nodes, and leaf nodes.
A decision tree, as shown in the diagram above, begins with a root node that has no
incoming branches. The root node's outgoing branches then feed into the internal nodes, also
known as decision nodes. Both node types evaluate the available features to form
homogeneous subsets, which are denoted by leaf nodes or terminal nodes. The leaf nodes
represent all of the dataset's possible outcomes. As an example, suppose you were deciding
whether or not to go surfing. You could use the following decision rules to help you decide:
Conclusion
In this topic we learn about decision tree how it work how it take decision what is the
manner of it .