Collision. When A Hash Function Maps Two Different Keys To The Same Table Address
Collision. When A Hash Function Maps Two Different Keys To The Same Table Address
Collision. When A Hash Function Maps Two Different Keys To The Same Table Address
Queue Application: Queue is used when things don't have to be processed immediately, but
have to be processed in First In First Out order like Breadth First Search. This property
of Queue makes it also useful in following kind of scenarios. 1) When a resource is shared
among multiple consumers
Dense graph is a graph in which the number of edges is close to the maximal number of
edges. Sparse graph is a graph in which the number of edges is close to the minimal number
of edges. Sparse graph can be a disconnected graph.
Traversal is a process to visit all the nodes of a tree and may print their values too. Because,
all nodes are connected via edges (links) we always start from the root (head) node. That is, we
cannot randomly access a node in a tree. There are three ways which we use
to traverse a tree − In-order Traversal.
AVL tree is the self balancing tree. The binary search tree which is unbalanced undergoes
some operation to get converted into balanced BT. The time complexity for searching an
element in skewed bst is worst. So such trees are converted to AVL tree
AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of
left and right subtrees cannot be more than one for all nodes. The above tree is AVL because
differences between heights of left and right subtrees for every node is less than or equal to 1
A directed graph is graph, i.e., a set of objects (called vertices or nodes) that are connected
together, where all the edges are directed from one vertex to another. A directed graph is
sometimes called a digraph or a directed network.
An edge is where two faces meet. A vertex is a corner where edges meet. The plural
is vertices
So, a need arises to balance out the existing BST. AVL trees are height balancing binary
search tree. AVL tree checks the height of the left and the right sub-trees and assures that the
difference is not more than 1. This difference is called the Balance Factor
Balance factor of a node is the difference between the heights of the left and right
subtrees of that node. The balance factor of a node is calculated either height of left
subtree - height of right subtree (OR) height of right subtree - height of left subtree.
a collision or clash is a situation that occurs when two distinct pieces of data have the
same hash value, checksum, fingerprint, or cryptographic digest. ... The impact
of collisions depends on the application.
Pseudocode
is a plain language description of the steps in an algorithm or another system. Pseudocode
often uses structural conventions of a normal programming language, but is intended for
human reading rather than machine reading.
If the user performing the update does not realize the data is stored redundantly
the update will not be done properly. A deletion anomaly is the unintended loss of data
due to deletion of other data. ... An insertion anomaly is the inability to add data to the
database due to absence of other data.
Bubble Sort
is the simplest sorting algorithm that works by repeatedly swapping the adjacent
elements if they are in wrong order
Searching in data
-strucutre refers to the process of finding a desired element in set of items. ... The set of items to
be searched in, can be any data-structure like − list, array, linked-list, tree or graph. Search
refers to locating a desired element of specified properties in a collection of items
binary search,
also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that
finds the position of a target value within a sorted array. Binary search compares the target value to
the middle element of the array.
Binary search is more efficient than linear search; it has a time complexity of O(log n). The
list of data must be in a sorted order for it to work. ..
Insertion:
Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time. It is
much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or
merge sort
selection sort
is an in-place comparison sorting algorithm. It has an O(n²) time complexity, which makes it
inefficient on large lists, and generally performs worse than the similar insertion sort.
Merge Sort:
An example of merge sort. First divide the list into the smallest unit (1 element), then compare
each element with the adjacent list to sort and merge the two adjacent lists. ... In computer
science, merge sort (also commonly spelled merge sort) is an efficient, general-purpose,
comparison-based sorting algorithm.
merge sort is an efficient, general-purpose, comparison-based sorting algorithm. Most
implementations produce a stable sort, which means that the order of equal elements is the
same in the input and output
Quick Sort;
The shell sort,
sometimes called the “diminishing increment sort,” improves on the insertion sort by breaking
the original list into a number of smaller sublists, each of which is sorted using an
insertion sort. The unique way that these sublists are chosen is the key to the shell sort
Queue:
Queue is an abstract data structure, somewhat similar to Stacks. Unlike stacks, a queue is
open at both its ends. One end is always used to insert data (enqueue) and the other is used to
remove data (dequeue). Queue follows First-In-First-Out methodology, i.e., the data item stored
first will be accessed first.
A Queue is a linear structure which follows a particular order in which the operations are
performed. The order is First In First Out (FIFO). A good example of a queue is any queue of
consumers for a resource where the consumer that came first is served first. The difference
between stacks and queues is in removing.
Applications:
Queue is used when things don't have to be processed immediately, but have to be processed
in First In First Out order like Breadth First Search. This property of Queue makes it also useful
in following kind of scenarios. ... See this for more detailed applications of Queue and Stack
Purpose of queue:
Queues provide services of operations research where various entities such as data,
objects, persons, or events are stored and held to be processed later. In these contexts,
the queue performs the function of a buffer.
Singly Linked List.
Doubly Linked List.
Circular Linked List.
Doubly Linked
is a variation of Linked list in which navigation is possible in both ways, either forward and
backward easily as compared to Single Linked List. Following are the important terms to
understand the concept of doubly linked list. Link − Each link of a linked list can store a data
called an element
Singly linked list. Singly linked lists contain nodes which have a data field as well as
'next' field, which points to the next node in line of nodes. Operations that can be
performed on singly linked lists include insertion, deletion and traversal
String opertaions:
Method Description
endswith() Returns true if the string ends with the specified value
find() Searches the string for a specified value and returns the position of where
index() Searches the string for a specified value and returns the position of where
isalpha() Returns True if all characters in the string are in the alphabet
islower() Returns True if all characters in the string are lower case
isupper() Returns True if all characters in the string are upper case
partition() Returns a tuple where the string is parted into three parts
replace() Returns a string where a specified value is replaced with a specified value
rfind() Searches the string for a specified value and returns the last position of wh
rindex() Searches the string for a specified value and returns the last position of wh
rpartition() Returns a tuple where the string is parted into three parts
rsplit() Splits the string at the specified separator, and returns a list
split() Splits the string at the specified separator, and returns a list
startswith() Returns true if the string starts with the specified value
swapcase() Swaps cases, lower case becomes upper case and vice versa
zfill() Fills the string with a specified number of 0 values at the beginning
Prefix to Postfix
Prefix expression notation requires that all operators precede the two operands that
they work on. Postfix, on the other hand, requires that its operators come after the
corresponding operands
Types;
AA tree.
AVL tree.
Binary search tree.
Binary tree.
Cartesian tree.
Conc-tree list.
Left-child right-sibling binary tree.
Order statistic tree
AvL:
an AVL tree is a self-balancing binary search tree. It was the first such data structure to be
invented. In an AVL tree, the heights of the two child subtrees of any node differ by at most
one; if at any time they differ by more than one, rebalancing is done to restore this property
AA trees
In-order Traversal
In this traversal method, the left subtree is visited first, then the root
and later the right sub-tree. We should always remember that every
node may represent a subtree itself.
If a binary tree is traversed in-order, the output will produce sorted
key values in an ascending order
Pre-order Traversal
In this traversal method, the root node is visited first, then the left
subtree and finally the right subtree
Post-order Traversal
In this traversal method, the root node is visited last, hence the name. First
we traverse the left subtree, then the right subtree and finally the root
node.
A graph
is a common data structure that consists of a finite set of nodes (or
vertices) and a set of edges connecting them. A pair (x,y) is referred to as
an edge, which communicates that the x vertex connects to the y vertex. In
the examples below, circles represent vertices, while lines represent edges
For example, a single user in Facebook can be represented as a node (vertex) while their
connection with others can be represented as an edge between nodes. Each node can be
a structure that contains information like user's id, name, gender, etc
Adjacent:
In a graph, two vertices are said to be adjacent, if there is an edge
between the two vertices. Here, the adjacency of vertices is
maintained by the single edge that is connecting those two vertices.
In a graph, two edges are said to be adjacent, if there is a common
vertex between the two edges
Graph searches and Graph Algorithms
A graph search is an algorithm scheme that visits vertices or vertices and edges in
a graph, in an order based on the connectivity of the graph. ... In a graph search, edges
are visited at most once and not all edges are visited
Dijkstra's algorithm,
published in 1959, is named after its discoverer Edsger Dijkstra, who was a Dutch
computer scientist. This algorithm aims to find the shortest-path in a directed or
undirected graph with non-negative edge weights. ... Connected graph: A path exists
between each pair of vertices in this type of graph