0% found this document useful (0 votes)
7 views

Data Structures and Algorithms

The document provides an overview of data structures, specifically focusing on arrays, queues, and stacks. It explains how to create, initialize, and access arrays in C and Java, describes the operations of queues and stacks, and outlines their algorithms and applications. Additionally, it covers different notations for arithmetic expressions, including infix, prefix, and postfix notations, along with their evaluation methods.

Uploaded by

alfred y
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Data Structures and Algorithms

The document provides an overview of data structures, specifically focusing on arrays, queues, and stacks. It explains how to create, initialize, and access arrays in C and Java, describes the operations of queues and stacks, and outlines their algorithms and applications. Additionally, it covers different notations for arithmetic expressions, including infix, prefix, and postfix notations, along with their evaluation methods.

Uploaded by

alfred y
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 28

DATA STRUCTURES AND ALGORITHM

Data structures is the organisation of data elements characterised by retrieval functions

1. AN ARRAY
An ARRAY is a data structure, which can store a fixed-size collection of elements of the same
data type. An array is used to store a collection of data, but it is often more useful to think of an
array as a collection of variables of the same type.
Instead of declaring individual variables, such as number1, number2, ... number99, you just
declare one array variable number of integer type and use number1[0], number1[1], and ...,
number1[99] to represent individual variables. Here, 0, 1, 2, .....99 are index associated
with var variable and they are being used to represent individual elements available in the array.
All arrays consist of contiguous memory locations. The lowest address corresponds to the first
element and the highest address to the last element.

Create Arrays

To create an array variable in C, a programmer specifies the type of the elements and the
number of elements to be stored in that array. Given below is a simple syntax to create an array
in C programming −
type arrayName [ arraySize ];
This is called a single-dimensional array. The arraySize must be an integer constant greater
than zero and type can be any valid C data type. For example, now to declare a 10-element
array called number of type int, use this statement −
int number[10];
Here, number is a variable array, which is sufficient to hold up to 10 integer numbers.

Initializing Arrays

You can initialize an array in C either one by one or using a single statement as follows −
int number[5] = {10, 20, 30, 40, 50};
The number of values between braces { } cannot be larger than the number of elements that we
declare for the array between square brackets [ ].
If you omit the size of the array, an array just big enough to hold the initialization is created.
Therefore, if you write −
int number[] = {10, 20, 30, 40, 50};
You will create exactly the same array as you did in the previous example. Following is an
example to assign a single element of the array −
number[4] = 50;
The above statement assigns element number 5th in the array with a value of 50. All arrays have
0 as the index of their first element which is also called the base index and the last index of an
array will be the total size of the array minus 1. The following image shows the pictorial
representation of the array we discussed above −

Accessing Array Elements

An element is accessed by indexing the array name. This is done by placing the index of the
element within square brackets after the name of the array. For example −
int var = number[9];
The above statement will take the 10th element from the array and assign the value
to var variable. The following example uses all the above-mentioned three concepts viz.
creation, assignment, and accessing arrays

Arrays in Java

Following is the equivalent program written in Java. Java supports arrays, but there is a little
difference in the way they are created in Java using the new operator.
You can try to execute the following program to see the output, which must be identical to the
result generated by the above C example.

public class DemoJava {


public static void main(String []args) {
int[] number = new int[10];
int i = 0;

while( i < 10 ) {

number[ i ] = i + 100;
i = i + 1;
}

i = 0;
while( i < 10 ) {
System.out.format( "number[%d] = %d\n", i, number[i] );
i = i + 1;
}
}
}
When the above program is executed, it produces the following result −
number[0] = 100
number[1] = 101
number[2] = 102
number[3] = 103
number[4] = 104
number[5] = 105
number[6] = 106
number[7] = 107
number[8] = 108

2. A QUEUE
Queue is ordered collection of homogeneous data elements in which insertion and deletion
operation take place at two end . insertion allowed from starting of queue called FRONT point
and deletion allowed from REAR end only

 insertion operation is called ENQUEUE


 deletion operation is called DEQUEUE

CONDITIONS IN QUEUE
 FRONT < 0 ( Queue is Empty )
 REAR = Size of Queue ( Queue is Full )
 FRONT < REAR ( Queue contains at least one element )
 No of elements in queue is : ( REAR - FRONT ) + 1

RESTRICTIONS IN QUEUE
we can not insert element directly at middle index (position) in Queue and vice verse for
deletion. insertion operation possible at REAR end only and deletion operation at FRONT end,
to insert we increment REAR and to delete we increment FRONT.

ALGORITHM FOR ENQUEUE


Input : An element say ITEM that has to be inserted.
Output : ITEM is at the REAR of the Queue.
Data structure : Que is an array representation of queue structure with two pointer FRONT and
REAR.
Steps:

1. If ( REAR = size ) then //Queue is full


2. print "Queue is full"
3. Exit
4. Else
5. If ( FRONT = 0 ) and ( REAR = 0 ) then //Queue is empty
6. FRONT = 1
7. End if
8. REAR = REAR + 1 // increment REAR
9. Que[ REAR ] = ITEM
10. End if
11. Stop

ALGORITHM FOR DEQUEUE


Input : A que with elements. FRONT and REAR are two pointer of queue .
Output : The deleted element is stored in ITEM.
Data structure : Que is an array representation of queue structure..

Steps:

1. If ( FRONT = 0 ) then
2. print "Queue is empty"
3. Exit
4. Else
5. ITEM = Que [ FRONT ]
6. If ( FRONT = REAR )
7. REAR = 0
8. FRONT = 0
9. Else
10. FRONT = FRONT + 1
11. End if
12. End if
13. Stop

OR

Addition into a queue

procedure addq (item : items);


{add item to the queue q}
begin
if rear=n then queue full
else begin
rear :=rear+1;
q[rear]:=item;
end;
end;{of addq}

Deletion in a queue

procedure deleteq (var item : items);


{delete from the front of q and put into item}
begin
if front = rear then queue empty
else begin
front := front+1
item := q[front];
end;
end; {of deleteq}

APPLICATION of QUEUE
In general, queues are often used as "waiting lines". Here are a few examples of where queues
would be used:

 In operating systems, for controlling access to shared system resources such as printers,
files, communication lines, disks and tapes.

A specific example of print queues follows:

o In the situation where there are multiple users or a networked computer system,
you probably share a printer with other users. When you request to print a file,
your request is added to the print queue. When your request reaches the front of
the print queue, your file is printed. This ensures that only one person at a time
has access to the printer and that this access is given on a first-come, first-served
basis.
 For simulation of real-world situations. For instance, a new bank may want to know how
many tellers to install. The goal is to service each customer within a "reasonable" wait
time, but not have too many tellers for the number of customers. To find out a good
number of tellers, they can run a computer simulation of typical customer transactions
using queues to represent the waiting customers.
 When placed on hold for telephone operators. For example, when you phone the toll-free
number for your bank, you may get a recording that says, "Thank you for calling A-1
Bank. Your call will be answered by the next available operator. Please wait." This is a
queuing system.

3. STACK DATA STRUCTURE


Stack is a simple linear data structure which is used for storing data. In stack, the order in which
the data arrives is the most important. Considering this, a stack can be defined as an ordered list
in which insertion and deletion are performed at one end which is called top. The element
inserted at the last is the first one to be deleted. Hence, a stack is called First In Last
Out (FILO) or Last In First Out (LIFO) list.

Example: A pile of plates in a cafeteria can be a good example of a stack. The plates get added
to the stack as they get cleaned and also whenever a late is required it is taken from the top of the
stack. The first plate placed on the stack is the last one to be used.

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

1. Push: Push operation adds an item/data in to the stack. If the stack is full, then it is called
an Overflow condition.
2. Pop: Pop operation removes an item/data from the stack. The items are popped in the
reversed order in which they are pushed into the stack. If the stack is empty, then it is
called an Underflow condition.
3. isEmpty: Returns true if stack is empty, else false.
Applications of stack:

 Balancing of symbols
 Infix to Postfix /Prefix conversion
 Implementing function calls (recursion)
 Undo sequence in a text editor
 Forward and backward feature in web browsers
 Other applications can be Backtracking, Knight tour problem, rat in a maze, N queen
problem and sudoku solver

Implementation of stack: There are two ways to implement a stack:

1. Using array
2. Using linked list

Adding into stack

procedure add(item : items);


{add item to the global stack stack;
top is the current top of stack
and n is its maximum size}
begin
if top = n then stackfull;
top := top+1;
stack(top) := item;
end: {of add}

Deletion in stack

procedure delete(var item : items);


{remove top element from the stack stack and put it in the item}
begin
if top = 0 then stack empty;
item := stack(top);
top := top-1;
end; {of delete}

These two procedures are so simple that they perhaps need no more explanation. Procedure
delete actually combines the functions TOP and DELETE, stack full and stack empty are
procedures which are left unspecified since they will depend upon the particular application.
Often a stack full condition will signal that more storage needs to be allocated and the program
re-run. Stack empty is often a meaningful condition.

Implementing Stack using Arrays in Java

Java
/* Java program to implement basic stack operations */
class Stack
{
static final int MAX = 1000;
int top;
int a[] = new int[MAX]; // Maximum size of Stack

boolean isEmpty()
{
return (top < 0);
}
Stack()
{
top = -1;
}

boolean push(int x)
{
if (top >= MAX)
{
System.out.println("Stack Overflow");
return false;
}
else
{
a[++top] = x;
return true;
}
}

int pop()
{
if (top < 0)
{
System.out.println("Stack Underflow");
return 0;
}
else
{
int x = a[top--];
return x;
}
}
}
// Driver code
class Main
{
public static void main(String args[])
{
Stack s = new Stack();
s.push(10);
s.push(20);
s.push(30);
System.out.println(s.pop() + " Popped from stack");
}
}

Advantages of stacks: Stacks are easy to implement. Memory is saved as pointers


are not involved.
Disadvantages of stacks: It is not dynamic. This means the maximum size of the stack must be
defined in prior and cannot be changed.

NOTATIONS
The way to write arithmetic expression is known as a notation. An arithmetic expression can be
written in three different but equivalent notations, i.e., without changing the essence or output of
an expression. These notations are:

 Infix Notation

 Prefix (Polish) Notation

 Postfix (Reverse-Polish) Notation

INFIX NOTATION X+Y


We write expression in infix notation, e.g. a - b + c, where operators are used in-between
operands. It is easy for us humans to read, write, and speak in infix notation but the same does
not go well with computing devices.

Operators are written in-between their operands. An expression such as A * (B + C) / D is taken


to mean something like: "First add B and C together, then multiply the result by A, then divide
by D to give the final answer."

Infix notation needs extra information to make the order of evaluation of the operators clear:
rules built into the language about operator precedence and associativity, and brackets () to allow
users to override these rules. For example, the usual rules for associativity say that we perform
operations from left to right, so the multiplication by A is assumed to come before the division
by D. Similarly, the usual rules for precedence say that we perform multiplication and division
before we perform addition and subtraction.

PREFIX NOTATION (ALSO KNOWN AS "POLISH NOTATION"): + X Y


In this notation, operator is prefixed to operands, i.e. operator is written ahead of operands. For
example, +ab. This is equivalent to its infix notation a + b. Prefix notation is also known
as Polish Notation. Operators are written before their operands. The expressions given above
are equivalent to / * A + B C D. As for Postfix, operators are evaluated left-to-right and
brackets are superfluous. Operators act on the two nearest values like this; (/ (* A (+ B C)) D)

Although Prefix "operators are evaluated left-to-right", they use values to their right, and if these
values themselves involve computations then this changes the order that the operators have to be
evaluated in. In the example above, although the division is the first operator on the left, it acts
on the result of the multiplication, and so the multiplication has to happen before the division
(and similarly the addition has to happen before the multiplication).
Because Postfix operators use values to their left, any values involving computations will already
have been calculated as we go left-to-right, and so the order of evaluation of the operators is not
disrupted in the same way as in Prefix expressions.

POSTFIX NOTATION (also called "REVERSE POLISH NOTATION"): X Y+


This notation style is known as Reversed Polish Notation. In this notation style, the operator
is postfixed to the operands i.e., the operator is written after the operands. For example, ab+.
This is equivalent to its infix notation a

Operators are written after their operands. The infix expression given above is equivalent
to A B C + * D /
The order of evaluation of operators is always left-to-right, and brackets cannot be used to
change this order. Because the "+" is to the left of the "*" in the example above, the addition
must be performed before the multiplication.
Operators act on values immediately to the left of them. For example, the "+" above uses the "B"
and "C". We can add (totally unnecessary) brackets to make this explicit:
( (A (B C +) *) D /)
Thus, the "*" uses the two values immediately preceding: "A", and the result of the addition.
Similarly, the "/" uses the result of the multiplication and the "D".

POSTFIX EVALUATION ALGORITHM

Step 1 − scan the expression from left to right


Step 2 − if it is an operand push it to stack
Step 3 − if it is an operator pull operand from stack and perform operation
Step 4 − store the output of step 3, back to stack
Step 5 − scan the expression until all operands are consumed
Step 6 − pop the stack and perform operation

EXAMPLES
CONVERTION BETWEEN THESE NOTATIONS

The most straightforward method is to start by inserting all the implicit brackets that show the
order of evaluation e.g.:

You can convert directly between these bracketed forms simply by moving the operator within
the brackets e.g. (X + Y) or (X Y +) or (+ X Y). Repeat this for all the operators in an
expression, and finally remove any superfluous brackets.

You can use a similar trick to convert to and from parse trees - each bracketed triplet of an
operator and its two operands (or sub-expressions) corresponds to a node of the tree. The
corresponding parse trees are:
4. LINKED LIST
LINKED LIST is a very commonly used linear data structure which consists of group
of nodes in a sequence.
Each node holds its own data and the address of the next node hence forming a
chain like structure.
Linked Lists are used to create trees and graphs.

Advantages of Linked Lists


 They are a dynamic in nature which allocates the memory when required.
 Insertion and deletion operations can be easily implemented.
 Stacks and queues can be easily executed.
 Linked List reduces the access time.

Disadvantages of Linked Lists


 The memory is wasted as pointers require extra memory for storage.
 No element can be accessed randomly; it has to access each node sequentially.
 Reverse Traversing is difficult in linked list.

Applications of Linked Lists


 Linked lists are used to implement stacks, queues, graphs, etc.
 Linked lists let you insert elements at the beginning and end of the list.
 In Linked Lists we don't need to know the size in advance.

Types of Linked Lists


There are 3 different implementations of Linked List available, they are:

1. Singly Linked List


2. Doubly Linked List
3. Circular Linked List

Let's know more about them and how they are different from each other.

Singly Linked List


Singly linked lists contain nodes which have a data part as well as an address
part i.e. next, which points to the next node in the sequence of nodes.
The operations we can perform on singly linked lists
are insertion, deletion and traversal.
DATA LINK DATA LINK DATA LINK DATA LINK
A b B c C d D ƛ

NOTE:

IS USED TO INDICATE THE BEGINNING OF THE LINK

ƛ IS USED TO INDICATE THE END OF THE LINK

EXAMPLE: Explain how you will retrieve the data in the following link list.

index DATA LINK

1 C 4

2 D 3

3 E 9

4 I 5

5 R 7

6 F ƛ

7 E 2

→8 K 1

9 R 6

5.TREES
It a nonlinear data structure which represent data in a hierarchical order
A binary tree is composed of zero or more nodes
In Java, a reference to a binary tree may be null
Each node contains:
A value (some sort of data item)
A reference or pointer to a left child (may be null), and
A reference or pointer to a right child (may be null)
A binary tree may be empty (contain no nodes)
If not empty, a binary tree has a root node
Every node in the binary tree is reachable from the root node by a unique path
A node with no left child and no right child is called a leaf

Node A is the parent of node B if node B is a child of A


Node A is an ancestor of node B if A is a parent of B, or if some child of A is an ancestor
of B
In less formal terms, A is an ancestor of B if B is a child of A, or a child of a child of A,
or a child of a child of a child of A, etc.
Node B is a descendant of A if A is an ancestor of B
Nodes A and B are siblings if they have the same parent

The size of a binary tree is the number of nodes in it


This tree has size 12. The depth of a node is its distance from the root
a is at depth zero. e is at depth 2. The depth of a binary tree is the depth of its deepest
node. This tree has depth 4
 A binary tree is balanced if every level above the lowest is “full” (contains 2n nodes)
 In most applications, a reasonably balanced binary tree is desirable

SORTED BINARY TREE (BINARY SEARCH TREE)


 A binary tree is sorted if every node in the tree is larger than (or equal to) its left
descendants, and smaller than (or equal to) its right descendants
 Equal nodes can go either on the left or the right (but it has to be consistent)

 Look at array location (lo + hi)/2

TREE TRAVERSAL

 A binary tree is defined recursively: it consists of a root, a left subtree, and a right subtree

 To traverse (or walk) the binary tree is to visit each node in the binary tree exactly once

 Tree traversals are naturally recursive

 Since a binary tree has three “parts,” there are six possible ways to traverse the binary tree:

 root, left, right

 left, root, right

 left, right, root

root, right, left

right, root, left

right, left, root

ALGORITHM FOR TRAVERSING TREES IN


i. Preorder

ii. Postorder

iii. Inorder

Preorder: When the nodes of a binary tree are visited in preorder,


the root node of the tree is visited first, then the left sub-tree (if any)
is visited in preorder, then the right sub-tree (if any) is visited in
preorder.
Inorder: When the nodes of a binary tree are visited inorder, the left
sub-tree (if any) is visited inorder, then the root node is visited, then
the right sub-tree is visited inorder.
Postorder: When the nodes of a binary tree are visited in postorder,
the left sub-tree is visited in postorder, then the right sub-tree is
visited in postorder, and then the root node is visited.
 class BinaryTree<V> {
V value;
BinaryTree<V> leftChild;
BinaryTree<V> rightChild;

// Assorted methods…
}

 A constructor for a binary tree should have three parameters, corresponding to the three fields

 An “empty” binary tree is just a value of null

IN PREORDER, THE ROOT IS VISITED FIRST

Here’s a preorder traversal to print out all the elements in the binary tree:

public void preorderPrint(BinaryTree bt) {


if (bt == null) return;
System.out.println(bt.value);
preorderPrint(bt.leftChild);
preorderPrint(bt.rightChild);
}
IN INORDER, THE ROOT IS VISITED IN THE MIDDLE

Here’s an inorder traversal to print out all the elements in the binary tree:
public void inorderPrint(BinaryTree bt) {
if (bt == null) return;
inorderPrint(bt.leftChild);
System.out.println(bt.value);
inorderPrint(bt.rightChild);
}
IN POSTORDER, THE ROOT IS VISITED LAST

Here’s a postorder traversal to print out all the elements in the binary tree:
public void postorderPrint(BinaryTree bt) {
if (bt == null) return;
postorderPrint(bt.leftChild);
postorderPrint(bt.rightChild);
System.out.println(bt.value);
}

TREE TRAVERSALS USING “FLAGS”


The order in which the nodes are visited during a tree traversal can be easily determined by imagining
there is a “flag” attached to each node, as follows:

THE OTHER TRAVERSALS ARE THE REVERSE OF THESE THREE STANDARD ONES
That is, the right subtree is traversed before the left subtree is traversed
 Reverse preorder: root, right subtree, left subtree
 Reverse inorder: right subtree, root, left subtree
 Reverse postorder: right subtree, left subtree, root

6. GRAPH
Graph is a data structure that consists of a set of nodes (vertices) and a set of edges that
relate the nodes to each other the set of edges describes relationships among the vertices.

c. study the matrix below and use it to answer the questions


The Adjacency Matrix A[i][j]=1 if (i,j) is an edge; 0 otherwise. The degree of the vertex could be
expressed as
n 1

 adj _ mat[i][ j ]
j 0

Calculate
i. the In-degree where
n 1
ind ( vi )  A[ j , i ]
j 0

ii. The out-degree where

n 1
outd ( vi )  A[i , j ]
j 0

d. An inorder traversal of the tree visits the nodes in the order m, b, p, k, t, d, a, g, c, f, h. A


preorder traversal visits the nodes in the order d, b, m, k, p, t, c, a, g, f, h. And a postorder
traversal visits the nodes in the order m, p, t, k, b, g, a, h, f, c, d. Draw the tree 2mks

3.a. Explain with practical examples how stacks differ from queue? 3mks

b. If pre-order traversal of a pure binary tree is CDKMONQYZ, what will be the post order traversal?
2mks
c.i. construct the adjacency matrix for the following adjacency list 2mks

ANS

ii. What will be the adjacency matrix for the following graph? 3mks
ANS

Explain how you will retrieve the data in the following link list.

index DATA LINK

1 C 4

2 D 3

3 E 9

4 I 5

5 R 7

6 F ƛ

7 E 2

→8 K 1

9 R 6

Construct a binary search tree using the following nodes:

91, 92, 93, 94, 95, 96, 97, 89, 99, 100,101,102, 103,104,105,106,107,108,109,110,111.

A tree constructed must have the left nodes of the parent less than the parent node and right nodes
greater than the parent node

What is the different between directed and undirected graph. Explain with specific examples

ANS

UNDIRECTED GRAPH
DIRECTED GRAPH

Both directed and undirected graphs have paths. But in an undirected graph, you may
travel in either direction

a. Array is a container which can hold a fix number of items and these items should be of the same type.
Most of the data structures make use of arrays to implement their algorithms. Develop an algorithm to
implement the following operations of arrays;
a. insertion
b. deletion
c. searching

i. Two of the most common divide-and-conquer sorting algorithms are quick sort and merge sort.
In practice quick sort is often used for sorting data in main storage rather than merge sort. Give
a reason why quick sort is likely to be the preferred sorting algorithm for this application.

ii. There are many different data structures, including the following: List (linked list or array), Tree,
2-dimensional (or higher) array, Binary search tree, Stack, Undirected graph, Queue, Directed
graph, Hash table, Directed Acyclic Graph (DAG). For each of the following applications, indicate
which of these data structures would be most suitable and give a brief justification for your
choice.
Map of the highway system used to display traffic travel times on a web page. The map displays
principle cities, intersections, and major landmarks, the roads that connect them, and the travel times
between them along those roads. Travel times along

7.HASH TABLE
What is Hash table?
A hash table (hash map) is a data structure that implements an associative array abstract data
type, a structure that can map keys to values. A hash table uses a hash function to compute an
index, also called a hash code, into an array of buckets or slots, from which the desired value can
be found. During lookup, the key is hashed and the resulting hash indicates where the
corresponding value is stored.

Explain Linear Probing (open addressing) and Separate Chaining as a technique in dealing with
collision in hashing?
State two application of hash table in computing?

1) Explain Linear Probing and Separate Chaining as a technique in dealing with collision in hashing?

REQUIRED:
Leaner probing scans through the next available space in the hash table when there is a
collision and store the node in there but chaining handles collision by using link list. A scheme
in which each position in the hash table has a list to handle collisions. Each position may be
just a link to the list (direct chaining) or may be an item and a link, essentially, the head of a
list.
2) State two application of hash table in computing?
REQUIRED: some applications

 Message Digest
 Password Verification
 Data Structures(Programming Languages)
 Compiler Operation
 Rabin-Karp Algortithm
 Linking File name and path together

Indicate where the following elements will be located in the hash table provided:

i. @Hash (David) =?

ii. # Hash (Mia) =?

iii. $Hash (Frank) =?

iv. &Hash (bigSAM) =?

v. ΩHash (Patapaa) =?

REQUIRED

David = 60+97+118+105+100 =488 =>488/10 =48 R 8

Therefore @hash(David) =8
Mia = 77+105+97 =279 => 279/10 = 27 R 9

# Hash (Mia) =9

Frank = 70+114+97+110+107 = 498 =>498/10 = 49 R 8

$Hash (Frank) =8

BigSAM = 98+105+103+83+65+77 = 531 =>531/10 =53 R 1

&Hash (bigSAM) =1

Patapaa = 80+97+116+97+112+97+97 = 696 =>696/10 = 69 R6

ΩHash (Patapaa) =6

HASH TABLE

& Ω @ #

Note: see Appendix provided at the back of the question paper

APPENDIX

Complete List of Ascii codes Format: Word Document


www.theasciicode.com.ar

symbol

ascii code 65 A (Capital A )


ascii code 66 B (Capital B )
ascii code 67 C (Capital C )
ascii code 68 D (Capital D )
ascii code 69 E (Capital E )
ascii code 70 F (Capital F )
ascii code 71 G (Capital G )
ascii code 72 H (Capital H )
ascii code 73 I (Capital I )
ascii code 74 J (Capital J )
ascii code 75 K (Capital K )
ascii code 76 L (Capital L )
ascii code 77 M (Capital M )
ascii code 78 N (Capital N )
ascii code 79 O (Capital O )
ascii code 80 P (Capital P )
ascii code 81 Q (Capital Q )
ascii code 82 R (Capital R )
ascii code 83 S (Capital S )
ascii code 84 T (Capital T )
ascii code 85 U (Capital U )
ascii code 86 V (Capital V )
ascii code 87 W (Capital W )
ascii code 88 X (Capital X )
ascii code 89 Y (Capital Y )
ascii code 90 Z (Capital Z )
ascii code 91 [ (square brackets or box brackets)
ascii code 92 \ (Backslash)
ascii code 93 ] (square brackets or box brackets)
ascii code 94 ^ (Caret or circumflex accent)
ascii code 95 _ (underscore, under strike, underbar or low line)
APPENDIX

ascii code 96 ` (Grave accent)


ascii code 97 a (Lowercase a )
ascii code 98 b (Lowercase b )
ascii code 99 c (Lowercase c )
ascii code 100 d (Lowercase d )
ascii code 101 e (Lowercase e )
ascii code 102 f (Lowercase f )
ascii code 103 g (Lowercase g )
ascii code 104 h (Lowercase h )
ascii code 105 i (Lowercase i )
ascii code 106 j (Lowercase j )
ascii code 107 k (Lowercase k )
ascii code 108 l (Lowercase l )
ascii code 109 m (Lowercase m )
ascii code 110 n (Lowercase n )
ascii code 111 o (Lowercase o )
ascii code 112 p (Lowercase p )
ascii code 113 q (Lowercase q )
ascii code 114 r (Lowercase r )
ascii code 115 s (Lowercase s )
ascii code 116 t (Lowercase t )
ascii code 117 u (Lowercase u )
ascii code 118 v (Lowercase v )
ascii code 119 w (Lowercase w )
ascii code 120 x (Lowercase x )
ascii code 121 y (Lowercase y )
ascii code 122 z (Lowercase z )
ascii code 123 { (curly brackets or braces)
ascii code 124 | (vertical-bar, vbar, vertical line or vertical slash)

NOTE: The main advantage of hash tables over other table data structures is speed. This
advantage is more apparent when the number of entries is large. Hash tables are particularly
efficient when the maximum number of entries can be predicted in advance, so that the bucket
array can be allocated once with the optimum size and never resized.
If the set of key-value pairs is fixed and known ahead of time (so insertions and deletions are not
allowed), one may reduce the average lookup cost by a careful choice of the hash function,
bucket table size, and internal data structures. In particular, one may be able to devise a hash
function that is collision-free, or even perfect. In this case the keys need not be stored in the
table.

SORTING AND SEARCHING


Bubble sort
Selection and Exchange sort
Linear search
Binary search

You might also like