0% found this document useful (0 votes)
14 views5 pages

Reviewer Dsa

The document outlines fundamental concepts of Data Structures and Algorithms, detailing various types of data structures such as arrays, linked lists, stacks, queues, trees, graphs, and hash tables. It emphasizes the qualities of good algorithms and classifies data structures into primitive, linear, static, dynamic, and non-linear categories, with a focus on linked lists and their operations. Additionally, it explains the queue data structure, its operations, and the FIFO principle.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views5 pages

Reviewer Dsa

The document outlines fundamental concepts of Data Structures and Algorithms, detailing various types of data structures such as arrays, linked lists, stacks, queues, trees, graphs, and hash tables. It emphasizes the qualities of good algorithms and classifies data structures into primitive, linear, static, dynamic, and non-linear categories, with a focus on linked lists and their operations. Additionally, it explains the queue data structure, its operations, and the FIFO principle.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Data Structures and Algorithms are fundamental concepts in our computer related courses that are

enable efficient organization, storage, and manipulation of data.

SEVERAL TYPES OF DATA STRUCTURE

- Arrays
- Linked List
- Stacks
- Queues
- Trees
- Graphs
- Hash Tables

Algorithms are step-by-step instructions or procedures to perform a specific task or solve particular
problem.

QUALITIES OF GOOD ALGORITHM

- Input and output define precisely


- Each step in algorithm should be clear and unambiguous
- Algorithms should be most effective among many different ways to solve a problem
- Algorithm shouldn’t include computer code. Instead, should be written in such way that it can
be used in different programming language

CLASSIFICATION OF DATA STRUCTURE

- Primitive Data Structures – basic data structure provided by programming languages include
integers, floating-numbers, characters, and Boolean values.

- Linear Data Structure – data elements arranged sequentially or linearly. Example: array, stack,
queue, linked list etc
- Static Data Structure – has a fixed memory size. Example: array
- Dynamic Data Structure – the size is not fixed. Example: queue, stack etc.
- Non-Linear Data Structure – not placed sequentially or linearly and can’t traverse all the
elements in a single run only. Example: tress and graph
Linked List – elements are not stored at contiguous memory location.

TYPES OF LINKED LIST

- Singly Linked List


- Doubly Linked List
- Circular Linked List
- Doubly circular linked list

CHARACTER OF LINKED LIST

- Has various characters


- Uses extra memory to store links
- No need to know the size of elements
- Used to implement stacks, queue, graphs, etc.
- First node = Head, Last node = NULLL
- Insertion and deletion are possibly easy
- Consist of pointer which is the address of the next node
- Can shrink or grow at any point in time easily

OPERATION USED ON LINKED LIST

- Initialization – creating head node with a reference to the first node


- Inserting Elements – inserted at the head, tail, or at specific position
- Deleting Elements – removing the current node
- Searching for Elements – searched for specific element by starting from the head node
- Updating Elements – modifying the value of specific data
- Traversing Elements – traversed by starting from the head node
- Reversing a linked list – by updating the references of each node

TYPE OF LINKED LIST

- Single-linked list – traversing a singly linked list is done in forward direction

- Double-linked list – allows for traversal in both forward and backward directions

- Circular-linked list – last node point back to the head node either singly or doubly linked
OPERATION USED OF LINKED LIST

- Insertion
- Deletion
- Searching

ADVANTAGES OF LINKED LIST

- Dynamic Size – grow and shrink dynamically, as memory allocation is done at runtime
- Insertion and Deletion – adding or removing elements
- Flexibility – reorganized and modified without requiring a contiguous block of memory

DISADVANTAGES OF LINKED LIST

- Random Access – do not allow direct access to elements by index. Traversal is required to reach
a specific node4
- Extra Memory – require additional memory for storing pointers, compared to arrayd

STRING – contains a collection of characters surrounded by double quotation

ARITHMETIC OPERATORS – used to perform common mathematical operations

LOGICAL OPERATORS – used to determine the logic between variables or values

COMPARISON OPERATORS – test the operation using logical operators

STRING CONCATENATION - + operator used between strings

APPEND – contain functions that can be perform certain operations on strings

STRING SPECIAL CHARACTERS -


C++ USER INPUT

Cout – used to print values

Cin – used to get user input with extraction operator >>

C++ CONDITION AND IF STATEMENT

If – if specified condition is true

Else – if the same condition is false

Else if – if the first condition is false

Switch – specify many alternatives blocks

queue” is a line, usually of people or things waiting for something.

“Queue” is an abstract data type or linear data structure, somewhat similar to stacks. But unlike stacks,
a queue is open at both ends. It is considered as an ordered collection of items where the insertion of
new element happens at one end, which is called as the “rear” (also called as the “tail”), and the
removal of existing element takes place from the other end called as the “front” (also called as the
head).

This ordering principle is sometimes called “FIFO” (first-in first-out), which is also known as the idea of
“first-come first-served” method.

BASIC OPERATIONS IN QUEUE

1. enqueue – adds (store) an item to the queue. And;

2. dequeue – removes (access) an item from the queue.

▪ peek() − Gets the element at the front of the queue without removing it.

▪ isfull() − Checks if the queue is full.

▪ isempty() − Checks if the queue is empty.

1. peek() - This function helps to see the data at the front of the queue. The algorithm of

peek() function is as follows –


2. isfull() - Assume that we are using a single dimension array to implement queue, we just need to
check for the rear pointer and compare it to size we set for the array to determine if the queue is full.
Algorithm of isfull() function is as follows –

3. isempty() - In contrast to isfull() function, the isempty() function determines whether the queue is
empty or not by determining the value that the front holds. Algorithm of isempty() function is as
follows−

Enqueue Operation - In this process, the following steps are performed:

▪ Check if the queue is full.

▪ If full, produce overflow error and exit.

▪ Else, increment ‘rear’.

▪ Add an element to the location pointed by ‘rear’. ▪ Return success.

Dequeue Operation - Dequeue operation consists of the following steps:

▪ Check if the queue is empty.

▪ If empty, display an underflow error and exit.

▪ Else, the access element is pointed out by ‘front’. ▪ Increment the ‘front’ to point to the next
accessible data. ▪ Return success.

You might also like