0% found this document useful (0 votes)
136 views1 page

DSA Reviewer

This document discusses various data structures and algorithms concepts. It defines algorithm criteria, inputs, outputs, procedures, data types, and data structures. It also covers linear lists, arrays, matrices, recursion, conditional statements, and linked lists. Specifically, it discusses singly linked lists, doubly linked lists, operations on linked lists like insertion, deletion, and traversal, and stacks.

Uploaded by

Chan
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)
136 views1 page

DSA Reviewer

This document discusses various data structures and algorithms concepts. It defines algorithm criteria, inputs, outputs, procedures, data types, and data structures. It also covers linear lists, arrays, matrices, recursion, conditional statements, and linked lists. Specifically, it discusses singly linked lists, doubly linked lists, operations on linked lists like insertion, deletion, and traversal, and stacks.

Uploaded by

Chan
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/ 1

Algorithm - a finite set of instructions that specify a  Indirect Recursion - recursion wherein a Singly Linked Lists - traversing is only

Lists - traversing is only from left to right 9. Splitting a list into several sub lists
sequence of operations to be carried out in order to chained sequence of procedure calls result in
solve a specific problem or class of problems. a closed circle.  Data Field - is used to contain the value of Two Ways to Read a Double Linked List
the element.
CRITERIA FOR ALGORITHM Factorial - Return 1 if N = 0  Pointer Field - contains the address of the 1. From Left to Right (Head to Tail)
Return N (N-1) if N > 0 next node in the list. 2. From Right to Left (Tail to Head)
1. Input - zero or more quantities are externally
supplied   Base Values – The point wherein no recursive reference If a node is the "next node" in the list, it is called the Deleting a Node from the List
2. Output - at least one quantity is produced   to product is made SUCCESSOR.
3. Definiteness - each instruction must be clear 1. Locate the node
and unambiguous The Fibonacci Model - originally conceived in the 13th Linked Lists Operations 2. Delete the node
4. Finiteness - all instructions of an algorithm century by Leonardo of Pisa, nicknamed Fibonacci, it is a 3. Release the node from memory
will terminate after a finite number of steps model for the breeding of rabbits 1. Finding the length of the list, n.
5. Effectiveness - each operation must be 2. Retrieving the ith node in the list, where i = Stack – is an ordered list wherein all operations are
definite, but must also be feasible LIST - An ordered set of a variable number of elements n. restricted at one end of the list known as the top
to which additions and deletions may be made. 3. Storing a new value into the ith position, LIFO (Last-In-First-Out) – last object inserted in the list
Inputs - are the data items presented to the algorithm. where i= n. will be the first one retrieved
An algorithm has either no input or a predetermined LINEAR LIST – It is a finite sequence of simple data, 4. Inserting a new node at position i, where i =
number of them. items, or records n. Three Operations Associated with Stacks
5. Deleting the ith element, where i = n.
Output - are the data items presented to the outside ARRAY – it is an ordered collection of data items of the 6. Copying a list.  Push – inserts a new element at the top of
world as the result of the execution of a program based same type referred to collectively by a single name. 7. Sorting the nodes in the list. the stack
on the algorithm. 8. Merging two or more lists.  Pop – retrieves the element at the top of
 Deleting an Element in an Array 9. Splitting a list into several sub lists the stack and deletes it from the stack
An algorithm ought to produce at least one output.  Sorting the Elements  TopMost – retrieves the element at the top
 Copying an Array Inserting a new node formula: of the stack
Procedures - an essential tool in programming that  Merging Two One-Dimensional Arrays
generalizes the notion of an operator.  Splitting an Array 1. At the start of the list (i = 1). FOUR BASIC OPERATORS
2. At the end of the list (i > length of the list).
Data Types - kinds of data that Two Dimensional Arrays - array with two subscripts 3. At position i (1< i < length of list).  Plus (+)
variables may "hold" in a programming language  Minus (-)
Matrix – is a mathematical object which arises in any Two ways to identify a node to be deleted:  Times (*)
Data Structures - a collection of variables, possibly of physical problems  Divide (/)
several different data types connected in various ways 1. By Position - The position of the node from
Magic Square – is an nxn matrix of the integers 1 to n2 the start of the list is specified.  Postfix Notation – operand operand operator
Pseudocode - a textual presentation of a flowchart that the sum of every row, column and diagonal is the 2. By Value - The contents of the data field of Infix Notation – operand operator operand
same. the node is identified.
Stepwise Refinement – it is the process by which a
programmer refines an initial idea to a problem's Sparse Matrices – it is an alternate form of Doubly-Linked List – reading a list from both directions
solution into more specific terms. representation is required to store in memory only the
nonzero elements. 1. Head – address of the first node in the list
CONDITIONAL STATEMENTS 2. Tail – address of the last node in the list
Transpose – is a copy of a particular matrix wherein the
 IF Statement elements in the [I,j] position are transferred to the [j,i] DOUBLY LINKED LIST OPERATIONS
 IF-ELSE Statement position
 SWITCH CASE Statement 1. Finding the length of the list
 WHILE Statement TWO WAYS OF REPRESENTATION 2. Retrieving a node from the list
3. Storing a new value into a specific node in
Recursion - Any program that can be written using the 1. Row Major – elements of the array are the list
assignment statement, the if-else statement, and the stored by row 4. Inserting a new node into the list
while statement Start + k ( [ I – 1 ] * n ] + [ j – 1 ] ) 5. Deleting a node from the list
2. Column Major – elements of the array are 6. Copying a list
 Direct Recursion - recursion wherein stored by column 7. Sorting the nodes in the list
procedures directly invoke themselves Start + k ( [ ( i – 1 ) * m ] + [ j – 1 ] ) 8. Merging two or more lists

You might also like