+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Short dec
1. ARRAY
an array data structure or simply an array is a data structure consisting of a collection
of elements (values orvariables), each identified by at least one array index or key.
Applications
Arrays are used to implement mathematical vectors and matrices, as well as other kinds of
rectangular tables.
One-dimensional arrays
A one-dimensional array (or single dimension array) is a type of linear array. Accessing its
elements involves a single subscript which can either represent a row or column index.
As an example consider the C declaration int anArrayName[10];
Multidimensional arrays
For a two-dimensional array, the element with indices i,j would have address B + c · i + d · j,
where the coefficients c and d are the rowand column address increments, respectively.
For example: int a[3][2];
STACK::
A stack is a list in which insertion and deletion take place at the same end
This end is called top
The other end is called bottom
Stacks are known as LIFO (Last In, First Out) lists.
The last element inserted will be the first to be retrieved
Primary operations: Push and Pop
Push
Add an element to the top of the stack
Pop
Remove the element at the top of the stack
Implementation of Stacks
Any list implementation could be used to implement a stack
Arrays (static: the size of stack is given initially)
Linked lists (dynamic: never become full)
CODE)CHECK IT
LB=O;
TOP=LB; INSEERTION
WHILE TOP!= 4
READ X
NUM[TOP]=X
TOP=TOP+1
TOP=TOP-1
WHILE TOP!= -1 DELETION
{TOP= TOP -1}
QEUEE
2. Like a stack, a queue is also a list. However, with a queue, insertion is done at one end, while
deletion is performed at the other end.
Accessing the elements of queues follows a First In, First Out (FIFO) order.
Like customers standing in a check-out line in a store, the first customer in is the first customer
served.
Enqueue and Dequeue
Primary queue operations: Enqueue and Dequeue
Like check-out lines in a store, a queue has a front and a rear.
Enqueue – insert an element at the rear of the queue
Dequeue – remove an element from the front of the queue
Implementation of Queue
Just as stacks can be implemented as arrays or linked lists, so with queues.
Dynamic queues have the same advantages over static queues as dynamic stacks have over static
stacks
Queue Implementation of Array
There are several different algorithms to implement Enqueue and Dequeue
Naïve way
When enqueuing, the front index is always fixed and the rear index moves forward in the array.
rear rear rear
3 3 6 3 6 9
front front front
Enqueue(3) Enqueue(6) Enqueue(9)
Naïve way (cont’d)
When dequeuing, the front index is fixed, and the element at the front the queue is removed.
Move all the elements after it by one position. (Inefficient!!!)
3. rear rear rear = -1
6 9 9
front front front
Dequeue() Dequeue() Dequeue()
Delete ( ):
Description: Here QUEUE is an array with N locations. FRONT and REAR points to the front
and rear of
the QUEUE.
1. If (FRONT == 0) Then [Check for underflow]
2. Print: Underflow
3. Else
4. ITEM = QUEUE[FRONT]
5. If (FRONT == REAR) Then [Check if only one element is left]
(a) Set FRONT = 0
(b) Set REAR = 0
6. Else
7. Set FRONT = FRONT + 1 [Increment FRONT by 1]
[End of Step 5 If]
8. Print: ITEM deleted
[End of
Insert ( ):
Description: Here QUEUE is an array with N locations. FRONT and REAR points to the front
and rear of
the QUEUE. ITEM is the value to be inserted.
1. If (REAR == N) Then [Check for overflow]
2. Print: Overflow
3. Else
4. If (FRONT and REAR == 0) Then [Check if QUEUE is empty]
(a) Set FRONT = 1
(b) Set REAR = 1
5. Else
6. Set REAR = REAR + 1 [Increment REAR by 1]
[End of Step 4 If]
7. QUEUE[REAR] = ITEM
8. Print: ITEM inserted
[End of Step 1 If]
9. Exit
LINKLIST
A linked list or one way list is a linear collection of data elements called nodes where the linear
order is given by means of pointers. That is each node is divided into two parts the first part
4. contains the address of the element and the second part called the link field or next pointer field
contains the address of the next node in the list.
The linked list can be of following types:
1. Linear Linked List or One Way List or Singly Linked List.
2. Doubly Linked List or Two Way List.
3. Circular Linked List.
4. Header Linked List.
5. Two Way Header Linked List.
6. Circular Header Linked List.
7. Two Way Circular Header Linked List
• Types of linked lists:
– Singly linked list
• Begins with a pointer to the first node
• Terminates with a null pointer
• Only traversed in one direction
– Circular, singly linked
• Pointer in the last node points back to the first node
– Doubly linked list
• Two “start pointers” – first element and last element
• Each node has a forward pointer and a backward pointer
• Allows traversals both forwards and backwards
– Circular, doubly linked list
• Forward pointer of the last node points to the first node and backward
pointer of the first node points to the last node
Header Linked List.
Header Linked List: A header linked list which always contains a special node, called the header node, at
the beginning of the list. The following are two kinds of widely used header list:
1. A grounded header list is a header list where the last node contains the null pointer.
2. A circular header list is a header list where the last node points back to the header node.
Unless otherwise stated or implied, our header list will always be circular list. Accordingly, in
such a case, the header node also acts as a sentinel indicating the end of the list.
Header Linked List
. Two Way Header Linked List.
The two-way list is a linear collection of data elements called nodes where each node is divided into three
parts:
1. An information field INFO which contains the data of N
2. A pointer field FORW which contains the location of the next node in the list.
3. A pointer field BACK which contains the location of the preceding node in the list.
5. The list also requires two list pointer variables: FIRST, which points to the first node in the list, and LAST,
which points to the last node in the list. Observe that the null pointer appears in the FORW field of the last
node in the list and also in the BACK field
of the first node in the list.
TREE (inorder, preorder, postfix, memory representation by
array and link list)
• Tree nodes contain two or more links
– All other data structures we have discussed only contain one
• Binary trees
– All nodes contain two links
• None, one, or both of which may be NULL
– The root node is the first node in a tree.
– Each link in the root node refers to a child
– A node with no children is called a leaf node
• Binary search tree
– Values in left sub tree less than parent
– Values in right sub tree greater than parent
– Facilitates duplicate elimination
– Fast searches - for a balanced tree, maximum of log n comparisons
6. 4
7
2 7
5 7
1 4 6 93
1 3 5
7 17 3 44 6
1 8
• Tree traversals:
– In order traversal – prints the node values in ascending order
1. Traverse the left sub tree with an in order traversal
2. Process the value in the node (i.e., print the node value)
3. Traverse the right sub tree with an in order traversal
– Preorder traversal
1. Process the value in the node
2. Traverse the left sub tree with a preorder traversal
3. Traverse the right sub tree with a preorder traversal
– Post order traversal
1. Traverse the left subtree with a postorder traversal
2. Traverse the right subtree with a postorder traversal
3. Process the value in the node
For example
can be represented by the array
Suppose we would like to represent the following tree in memory, using only lists (which are
created by chaining conses). You should already know how acons is created and what parts
constitute one. If not, go back to an introductory book on Common Lisp.
7. This tree can be represented as a set of linked lists, like in the following diagram:
The natural way to represent the previous tree as a Common Lisp list is like the following:
(1 (2 6 7 8) 3 (4 (9 12)) (5 10 11))
The first element of a list is the root of that tree (or a node) and the rest of the elements are
the subtrees (more nodes). For example, the subtree (2 6 7 8)is a tree with “2” at its root
and the elements “6 7 8” as its children.
Graph definition
A graph is a collection of nodes called vertices, and the connections between them, called edges.
An example
The following diagram shows a graph with 5 vertices and 7 edges. The edges between A and D
and B and C are pairs that make a bidirectional connection, represented here by a double-headed
arrow.
8. disjkstra algorithm to find shortest path
The indented lines under a given line are done under the condition that line. Once that condition
is no longer met you move on in the algorithm. The first part of the algorithm is an initialization
of the graph into the setup described earlier; the rest is concerned with searching through the
graph to find distances. To illustrate the algorithm we provide an example below.
In the above picture o is marked by a double circle. The Unburned node with the smallest &delta
value is orange. It will be burned at the next step in the algorithm. The yellow vertex is the one
that is currently burning. Gray vertices have been labeled as Burned by the algorithm. Neighbors
if the burning vertex whose &delta is being updated have their edges marked in orange. This
happens when δ(u) + w(u,n) < &delta(n). Edges corresponding to sources are marked in blue.
Note that the algorithm will occasionally overwrite the source of a vertex with a closer source.
Once all the vertices are Burned the algorithm is burned.
Now that we've run the algorithm how do we find the shortest path from o to another vertex? We
simply follow thesource edges (blue in the example) from the destination until we reach o, and
the distance we have travelled corresponds to the label &delta on the destination. We also know
that we have actually found the shortest path (it is possible to have more than one path tied for
being the shortest) since our fire has always chosen to take the shortest steps possible when
moving to a new location.
You might have already noticed that the blue subgraph doesn't contain any loops, and this is what
mathematicians call a tree. In fact this is a very special kind of tree called a minimal spanning
tree because it grows from the root o to all of its leaves, the other vertices in G, in the shortest
way possible. Minimal spanning trees are very useful. For instance, if a cable company needs to
wire all the houses in a neighborhood using as little wire as possible, a minimal spanning tree of
the neighborhood provides them with the most efficient way to do so.
9. Game tree (definiton)
games) game tree - A tree representing contingencies in a game. Each node in a game tree
represents a possible position (e.g., possible configuration of pieces on a chessboard) in
the game, and each branching ("edge" in graph terms) represents a possible move.
A constructor gets called automatically when you create an object of a class; if you define your
own constructor, by default a constructor is called which is the Default Constructor. A class can
have more than one constructor. It has the same name as the class itself.
Destructors are again methods of a class that enable the destruction of an object after its use;
destructors also provide the means of memory clean up after usage. Destructors are always called
in the reverse order of Constructors. There can only be one destructor per class and they neither
take an input parameter nor do they return anything. Destructors need not be called explicitly.
Code:
class Vehicle
{
Int Registration = 0;
public:
Vehicle(int regis) // constructor
{
Registration = regis;
}
Virtual void GetRegistration() = 0;
~Vehicle() // destructor
{
}
ATTRIBUTE FUNCTION
In GNU C, you declare certain things about functions called in your
program which help the compiler optimize function calls and check your
code more carefully.
The keyword `__attribute__' allows you to specify special attributes
when making a declaration. This keyword is followed by an attribute
specification inside double parentheses.
void fatal () __attribute__ ((noreturn));
void
fatal (...)
{
... /* Print error message. */ ...
exit (1);
}
Attribute Member
The member attribute is a multi-value attribute that contains the list of distinguished names for the
user, group, and contact objects that are members of the group. Each item in the list is a linked
10. reference to the object that represents the member; therefore, the Active Directory server automatically
updates the distinguished names in the member property when a member object is moved or renamed.