Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

Data Structures and Algo

Artificial Intelligence (AI) is a broad field of computer science focused on creating systems and machines that can perform tasks that typically require human intelligence. Here's an overview to help understand what AI entails:
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Data Structures and Algo

Artificial Intelligence (AI) is a broad field of computer science focused on creating systems and machines that can perform tasks that typically require human intelligence. Here's an overview to help understand what AI entails:
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

BCA 3rd Sem ( Data Structure)

Data classification involves tagging data to make it easily searchable and traceable.
It also eliminates multiple duplications of data, which can reduce storage and
backup costs while speeding up the search process. Though the classification
process may sound highly technical, it is a topic that should be understood by your
organization’s leadership.

REASONS FOR DATA CLASSIFICATION


Data classification has improved significantly over time. Today, the technology is
used for a variety of purposes, often in support of data security initiatives. But data
may be classified for a number of reasons, including ease of access, maintaining
regulatory compliance and to meet various other business or personal objectives.
In some cases, data classification is a regulatory requirement, as data must be
searchable and retrievable within specified timeframes. For the purposes of data
security, data classification is a useful tactic that facilitates proper security
responses based on the type of data being retrieved, transmitted, or copied.

 TYPES OF DATA CLASSIFICATION


Data classification often involves a multitude of tags and labels that define the type
of data, its confidentiality, and its integrity. Availability may also be taken into
consideration in data classification processes. Data’s level of sensitivity is often
classified based on varying levels of importance or confidentiality, which then
correlates to the security measures put in place to protect each classification level.

There are three main types of data classification that are considered industry
standards:

Content-based classification inspects and interprets files looking for sensitive


information

Context-based classification looks at application, location, or creator among other


variables as indirect indicators of sensitive information

21
BCA 3rd Sem ( Data Structure)

User-based classification depends on a manual, end-user selection of each


document. User-based classification relies on user knowledge and discretion at
creation, edit, review, or dissemination to flag sensitive documents.

Content-, context-, and user-based approaches can be both right or wrong


depending on the business need and data type.

 Types of data structures

Arrays- An array stores a collection of items at adjoining memory locations. Items


that are the same type get stored together so that the position of each element can
be calculated or retrieved easily. Arrays can be fixed or flexible in length.

Example

Stacks- A stack stores a collection of items in the linear order that operations are
applied. This order could be last in first out (LIFO).For example Stack of coins,
stack of plates ,stack of books.

Mainly the following three basic operations are performed in the stack:

22
BCA 3rd Sem ( Data Structure)

Push: Adds an item in the stack. If the stack is full, then it is said to be an
Overflow condition.

Pop: Removes an item from the stack. The items are popped in the reversed order
in which they are pushed. If the stack is empty, then it is said to be an Underflow
condition.

Peek or Top: Returns top element of stack.

Empty: Returns true if stack is empty, else false.

Queues- A queue stores a collection of items similar to a stack; however, the


operation order can only be first in first out.

Operations on Queue:
Mainly the following four basic operations are performed on queue:

Enqueue: Adds an item to the queue. If the queue is full, then it is said to be an
Overflow condition.

Dequeue: Removes an item from the queue. The items are popped in the same
order in which they are pushed. If the queue is empty, then it is said to be an
Underflow condition.

Front: Get the front item from queue.

Rear: Get the last item from queue.

23
BCA 3rd Sem ( Data Structure)

Linked lists- A linked list stores a collection of items in a linear order. Each
element, or node, in a linked list contains a data item as well as a reference, or link,
to the next item in the list.

Basic Operations.

 Insertion Operation.
 Deletion Operation.
 Reverse Operation.

Trees- A tree stores a collection of items in an abstract, hierarchical way. Each


node is linked to other nodes and can have multiple sub-values, also known as
children.

Graphs- A graph stores a collection of items in a non-linear fashion. Graphs are


made up of a finite set of nodes, also known as vertices, and lines that connect

24
BCA 3rd Sem ( Data Structure)

them, also known as edges. These are useful for representing real-life systems such
as computer networks

Blocks :- In computing (specifically data transmission and data storage), a block,


sometimes called a physical record, is a sequence of bytes or bits, usually
containing some whole number of records, having a maximum length, a block size.
Data thus structured are said to be blocked.

The process of putting data into blocks is called blocking.

deblocking is the process of extracting data from blocks.

The sector is the minimum storage unit of a hard drive. Most disk partitioning
schemes are designed to have files occupy an integral number of sectors regardless
of the file's actual size. The sector means a portion of a disk between a center,
two radii and a corresponding arc (see Figure 1, item B), which is shaped like a
slice of a pie. Thus, the disk sector refers to the intersection of a track and
geometrical sector.

25
BCA 3rd Sem ( Data Structure)

Tracks and Spots


A disk's surface is divided into concentric tracks (circles within circles), and the
thinner the tracks, the more storage. The data bits are recorded as magnetic spots
on the tracks, and the smaller the spot, the greater the storage.

 What is static memory allocation and dynamic memory allocation?

Static Memory Allocation: Memory is allocated for the declared variable by the
compiler. The address can be obtained by using ‘address of’ operator and can be
assigned to a pointer. The memory is allocated during compile time. Since most of
the declared variables have static memory, this kind of assigning the address of a
variable to a pointer is known as static memory allocation.

Dynamic Memory Allocation: Allocation of memory at the time of execution (run


time) is known as dynamic memory allocation. The functions calloc() and malloc()
support allocating of dynamic memory. Dynamic allocation of memory space is
done by using these functions when value is returned by functions and assigned to
pointer variables.

Reasons and Advantage of allocating memory dynamically:

26
BCA 3rd Sem ( Data Structure)

When we do not know how much amount of memory would be needed for the
program beforehand.

When we want data structures without any upper limit of memory space.

When you want to use your memory space more efficiently. Example: If you have
allocated memory space for a 1D array as array[20] and you end up using only 10
memory spaces then the remaining 10 memory spaces would be wasted and this
wasted memory cannot even be utilized by other program variables.

Dynamically created lists insertions and deletions can be done very easily just by
the manipulation of addresses whereas in case of statically allocated memory
insertions and deletions lead to more movements and wastage of memory.

When you want you to use the concept of structures and linked list in
programming, dynamic memory allocation is a must.

 What is recursion?

In simple words, recursion is a problem solving, and in some cases, a programming


technique that has a very special and exclusive property. In recursion, a function or
method has the ability of calling itself to solve the problem. The process of
recursion involves solving a problem by turning it into smaller varieties of itself.

The process in which a function calls itself could happen directly as well as
indirectly. This difference in call gives rise to different types of recursion, which
we will talk about a little later. Some of the problems that can be solved using
recursion include DFS of Graph, Towers of Hanoi, Different Types of Tree
Traversals, and others.

Examples of Recursion

 Factorial of a positive integer


 Fibonacci series

27
BCA 3rd Sem ( Data Structure)

 Greatest common divisor


 Tower of Hanoi

1. Factorial of a positive integer:- Factorial is a mathematical term. Factorial of a


number,say n, is equal to the product of all integers from 1 to n. Factorial of n is
dentoed

By

n! = 1*2*3…..*n.

2. Fibonacci series:- Another well known mathematical recursive function is one


that computers the fiboncci numbers.

Greatest common divisor:- In mathematics, the greatest common divisor (gcd) of


two or more integers, which are not all zero, is the largest positive integer that
divides each of the integers. For example, the gcd of 8 and 12 is 4.

Tower of Hanoi:-

The Tower of Hanoi (also called the Tower of Brahma or Lucas' Tower[1] and
sometimes pluralized as Towers) is a mathematical game or puzzle. It consists of
three rods and a number of disks of different sizes, which can slide onto any rod.
The puzzle starts with the disks in a neat stack in ascending order of size on one
rod, the smallest at the top, thus making a conical shape.

28
BCA 3rd Sem ( Data Structure)

The objective of the puzzle is to move the entire stack to another rod, obeying the
following simple rules:

Only one disk can be moved at a time.

Each move consists of taking the upper disk from one of the stacks and placing it
on top of another stack or on an empty rod.

No larger disk may be placed on top of a smaller disk.

 Array
Definition

Arrays are 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.

Array is the simplest data structure where each data element can be randomly
accessed by using its index number.

29
BCA 3rd Sem ( Data Structure)

Advantages of Array

Array provides the single name for the group of variables of the same type
therefore, it is easy to remember the name of all the elements of an array.

Traversing an array is a very simple process, we just need to increment the base
address of the array in order to visit each element one by one.

Any element in the array can be directly accessed by using the index.

There are two types of Arrays

 One Dimensional Arrays


 Two Dimensional Arrays

One Dimensional Arrays

A one-dimensional array is one in which only one subscript specification is needed


to specify a particular element of the array.

A one-dimensional array is a list of related variables. Such lists are common in


programming.

One-dimensional array can be declared as follows :

Data_type var_name[Expression];

Initializing One-Dimensional Array

ANSI C allows automatic array variables to be initialized in declaration by


constant initializers as we have seen we can do for scalar variables.

30

You might also like