# Atmiya Infotech Pvt. Ltd. Data Structure. By Ajay Raiyani. Yogidham, Kalawad Road, Rajkot. Ph : ,

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Data Structure By Ajay Raiyani Yogidham, Kalawad Road, Rajkot. Ph : ,

3 Algorithm for Postorder Traversal of Binary Tree. : Application of Binary Tree: Graphs Yogidham, Kalawad Road, Rajkot. Ph : ,

9 Insertion in the middle of a doubly linked list A Left-most insertion in a doubly linked list Algorithm for the insert an element in the doubly list Function INSERT (TEMPHEAD, KEY) Yogidham, Kalawad Road, Rajkot. Ph : ,

16 If TEMPHEAD = NULL Then write ( Empty list ) Return 2. [Print the desire node] Repeat while LINK (TEMPHEAD)! = TEMPHEAD Write (INFO (TEMPHEAD)) 3. [Finished] Return Order Linked List: Trace of the construction of an ordered linked linear list using Function INSORD Algorithm: Function INSORD (TEMPHEAD, X) [This function inserts an element in the list which sorted to its info fields and X is the info field of the new node] 1. [Allocate Memory for the new node] NEW = NODE 2. [Copy the information field of the new node] INOF (NEW) = X 3. [Is the list empty?] Yogidham, Kalawad Road, Rajkot. Ph : ,

20 NULL Insertion into a linked list 1. Insertion as a first node Before insertion newnode NULL After Insertion Head newnode NULL 2. Insertion at a desired position Before Insertion Head NULL newnode Yogidham, Kalawad Road, Rajkot. Ph : ,

21 After Insertion NULL newnode Append a node in a linked list Before Append NULL After Appending newnode NULL Deletion from a Linked List Deletion of a first node newnode NULL Yogidham, Kalawad Road, Rajkot. Ph : ,

22 Before Deletion NULL After Deletion NULL Deletion of a desired node Before deletion NULL After deletion NULL Graphical Representation of Doubly Linked List Top 4000 Address of a node 5000 Address of previous node 40 Data of a node 5000 Address of next node Yogidham, Kalawad Road, Rajkot. Ph : ,

23 1000 NULL NULL Insertion into a doubly linked list As a first node Before Insertion 1000 NULL newnode NULL After Insertion newnode NULL NULL Append a node to doubly linked list Before Append 1000 NULL Yogidham, Kalawad Road, Rajkot. Ph : ,

24 NULL 8000 NewNode NULL After Append 1000 NULL NewNode NULL Deletion of node Deletion of a first node Before deletion 1000 NULL NULL After Deletion 1000 NULL NULL Yogidham, Kalawad Road, Rajkot. Ph : ,

25 NULL Deletion of a desired node Before deletion 1000 NULL NULL After deletion 1000 NULL NULL Yogidham, Kalawad Road, Rajkot. Ph : ,

26 Insertion at a desired position Before Insertion 1000 NULL newnode 8000 NULL After Insertion 1000 NULL newnode 8000 NULL Graphical Representation of Circular Linked List 2000 Address of a node 20 Data of a node 3000 Address of next node Top Insertion into a linked list Yogidham, Kalawad Road, Rajkot. Ph : ,

27 3. Insertion as a first node Before insertion newnode NULL After Insertion newnode Insertion at a desired position Before Insertion newnode After Insertion Yogidham, Kalawad Road, Rajkot. Ph : ,

28 newnode Append a node in a linked list Before Append After Appending newnode NULL newnode Deletion from a Linked List Deletion of a first node Before Deletion Yogidham, Kalawad Road, Rajkot. Ph : ,

29 After Deletion Deletion of a desired node Before deletion After deletion Stack What is Stack? Ans. A stack is a data structure in which addition of New element or deleting of existing elements always takes place at the same end. This end is often known as top of stack. This situation can be compared to a stack of plates in a cafeteria where every new plate added to the stack is added at the top. Similarly, every new plate taken off the stack is also from the top of the stack. Yogidham, Kalawad Road, Rajkot. Ph : ,

30 When add an item to a stack we say that we push it on the stack & when we remove an item we say that pop it from the stack. So we can say there are mainly two types of operations, Push & Pop, stack also sometimes called LIFO (Last In First Out). The real life example of Stack: Ans. As we talk about real life example, we all are familiar with a railway system for shutting cars, A railway Shutting system Representation As shown in figure, in this system the last railway car to be placed on the stack is the First-level. Using respectively the insertion & deletion operations permits the cars to be arranging on the output railway line in various orders. What is the major advantage of pointer Implementation stack over array Implementation of stack? Ans. 1. With the array Implementation of stack. It is necessary to preallocate the max. Stack size at the time of implementing the program. 2. In pointer Implementation of stack is not need of the stack size. 3. With array implementation of stack, we must check for stack overflow but with linked list implementation we don t need this. 4. In array implementation if we want to insert a large number of element then we must define the big array. So allocate the memory as per our requirements. 5. When we delete the item from memory that memory can t use for any other purpose. 6. In pointer implementation when we delete the item, the memory is free for any other purpose. Application of the stack: Ans. Yogidham, Kalawad Road, Rajkot. Ph : ,

31 There are several applications where stack can be put to use. 1. Recursion 2. Polish Notation 3. Stack Machine 1. Recursion: - Recursion is the name given to the technique of defining a set on a process in term of itself. OR When a called function in turn calls another function a process of chaining occurs recursion a special case of this process when a function calls itself. There are two important conditions that must be satisfied by any recursive procedure. 1) Each time a procedure calls itself (either directly or indirectly) it must be nearer in some sense, to a solution. In the case of the factorial function, each time that the function calls itself, it argument is decrement by one, so the argument of the function is getting smaller. 2) There must be a decision criterion for stopping the process or computation. In the case of the factorial function, the value of n must be zero. 2. Polish notation: - We are already familiar with arithmetic expressions in infix notation. In this notation a binary operator is placed between its operands. For example: - A + B C A ( C D ) / ( B * D ) A + B * D E / F The operations are normally carried out from left to right. We also have procedure rules for evaluating expressions. A*B+C+D*E would be to multiply B & A, then adding it to C, saving that result temporarily say in RESULT, Then multiplying D & E, and add it to the RESULT. Therefore we have to followed the sequence as given below, AB * C + DE * + Yogidham, Kalawad Road, Rajkot. Ph : ,

32 This notation is called the postfix notation or reverse-polish notation. We can convert infix notation to postfix notation by using stack data structure. 3. Stack Machine: - One of the main problem with using machines which have a very limited no of registers is how to handle the store of intermediate results to solve this problem such machines are known as stack machine. Many of the machines, which are appearing on the market, include in their architecture hardware stacks or stack mechanisms. The such machines are the PDP-11 & the Burroughs Both machines are particularly well suited for the stacking of local variables & parameters that arise in procedure calls of block nested languages. What is push operation? Write an algorithm to push an element in to the stack. Ans. When an item is added to a stack, It is pushed on to the stack, given a stack & an item I, performing the operation push (st,i) adds the item I to the top of stack st. Push operation is applicable to any stack. Push I, to the stack st tos I Stack st Algorithm for push operation Variables Size Total no of elements tos Top of the stack. val Information which you want to insert in stack. Stack[] Array of stack. Step 1 [Check that the stack is Full] If tos = size-1 then (print message) Stack is full. Return. Step 2 [else] [Increment tos by 1] tos tos+1 Yogidham, Kalawad Road, Rajkot. Ph : ,

33 Step 3 [Input the element to stack] Stack[tos] val Step 4 [Stop] What is pop operation? Write an algorithm to pop an element in to the stack. Ans. The pop operation removes the top most item to understand after removed of top most information new value of the pointer top becomes the previous value of top that is top=top-1 & free position is allocated as free space. tos I B A Stack (st) Operation: POP I from the stack. tos B A Stack (st) Algorithm: Step 1 [Check that stack is empty] if tos=-1 then (print message) Stack is Empty return Step 2 [Else] Step 3 [Decrement tos by 1] tos tos-1 return. [Stop] What is peep operation? Write an algorithm to peep an element from the stack. Ans. Yogidham, Kalawad Road, Rajkot. Ph : ,

34 The peep operation does not removes the item from the stack but by using peep we can view the elements from stack. So after peep operation value of tos is unchanged. tos I B A Stack (st) Operation: PEEPS 2nd element from the stack. tos I B A Peeped element is : B Algorithm: Stack (st) This function returns the value of ith element from top of the stack(containing SIZE elements) Step 1 [Check for stack underflow] if tos I + 1 < 0 then (print message) Stack is Empty return Step 2 [Return the Ith element from top of stack] return St[tos I + 1]; Graphical Representation of Stack Array representation of stack with five elements for following operations 1. insert insert insert 30 Yogidham, Kalawad Road, Rajkot. Ph : ,

35 4. delete node 5. delete node 6. insert insert push(10) push(20) push(30) pop( ) 10 pop( ) push(40) push(50) Yogidham, Kalawad Road, Rajkot. Ph : ,

36 Queue What is queue? Ans. Queue is very useful in computer science. We define a queue to be a list in which all addition to the list is made at the one end & all deletion from the list is made at other end. Queue are also called First In First Out list of FIFO for sort. We may draw queue in any one of the forms as given below. rear Data front Data Data Data Data Data Data front Data rear Queue makes two open ends called front & rear. Similarly to stack operation, that operation define a queue are given below, 1. Create a queue 2. Check whether queue is empty 3. Check whether queue is full 4. Add item at the rear queue 5. Remove item from front of queue 6. Read the front of queue 7. Print the enter queue There are mainly two types of queue, 1. Priority queue. 2.Circular queue. For example: - The railway reservation counter is an example of queue where the people collect their tickets on the first in first out basis. Implementation of Queue: Yogidham, Kalawad Road, Rajkot. Ph : ,

37 A queue as pointer front & rear pointing to the front & rear elements of the queue, respectively consider a queue Q consisting of (n) elements & element value which we have to insert in to Q the value NULL of front pointer implies an empty queue. Queue is also called FCFS(First Come First Served). Draw a queue using following data. Ans. Consider a size 6. Assume that the queue is initially empty. It is required to insert element 1,2 & 3 followed by delete 1 & 2 & insert 4,5 & 6. 1 front rear 1 2 Front rear Front rear 2 3 Front rear 3 Front rear 3 4 Front rear Front rear Yogidham, Kalawad Road, Rajkot. Ph : ,

38 Front rear Now, if we try to insert 7, an overflow occurs even through the first two cells are free. To avoid this drawback, we can arrange these elements in a circular fashion with Queue[0] following Queue[n-1]. It is then called a circular array representation. We may depict a circular queue as given in figure, Note:- To see the disadvantage of queue see the advantage of circular queue. Algorithm for simple queue:- Insert function: Variables: - val = Information of user. rear = Variable for last subscript value. front = Point first element in queue. size = Total no of elements. queue = Array of queue. Yogidham, Kalawad Road, Rajkot. Ph : ,

39 Step 1:- Step 2:- Step 3:- Step 4:- Step 5:- [Check that queue is full] if rear = (size 1) then [Print message] Queue is overflow return [else] read value [Check that the element is first element] if rear = -1 then rear = rear +1 front = front +1 [Input an element] queue [rear] val [Stop] Delete Function Step 1. [Check that queue is empty] If front = -1 then (print message) Queue is empty return Step 2. [Check that front & rear both points to same element] If front = rear then Front -1 Rear -1 Return Step 3. [Else] [Increment front by 1] Front front +1 Step 4. Return Step 5. [Stop] Yogidham, Kalawad Road, Rajkot. Ph : ,

40 Print function Step 1. [Check that queue is empty] If front = -1 then (print message) Queue is empty return Step 2. [Print Queue from front to rear] for i front to rear print queue[i] Step 3. [Stop] Search Function Step 1. [Check that queue is empty] If front = -1 then (print message) Queue is empty return Step 2. [Which value you want to search] Read key value Step 3. [Search whole queue] for i front to rear Step 4. [Check that value found] if queue[i] = key then [print message] key Value Found return Step 5. [Stop] Update function Step 1. [Check that queue is empty] If front = -1 then (print message) Queue is empty return Step 2. [Which value you want to update] Read key value Yogidham, Kalawad Road, Rajkot. Ph : ,

41 Step 3. [Search whole queue] for i front to rear Step 4. [Check that value found] if queue[i] = key then read queue[i] return Step 5. [Stop] Circular Queue Explain Circular Queue:- Any number of items could be placed on the queue, so long as items were also being taken off. This implementation of a queue is called circular queue, because it uses its storage array as if it were a circular instead of a linear list. In essence of queue is full when the stored index is one index less that the retrieve index, otherwise there is room in the queue for another event. Circular Queue Perhaps the most common use of a circular queue is in operating system where a circular queue holds the information read from & written to disk files on the console. Circular queues are also used in Real Time Application s programs. Which must continue to process information while buffering I/O request. Advantages of circular queue over simple queue Ans. But in circular queue we can insert new item to the location from where previous item to be deleted using crap cround of the queue. Yogidham, Kalawad Road, Rajkot. Ph : ,

42 In circular queue we can insert n numbers of elements continuously but condition is that we must used deletion. Where as in simple queue continuously insertion is not possible. If a computer need to provide continues scheduling of batch job, without interruption then by using circular implementation we can achieve it. Disadvantages of Circular queue Ans. In circular queue implementation the full queue condition & empty queue condition became same & it is inefficient for program therefore it in necessary to delete the full queue condition at (Array size 1) location meaning that if we have array of 10 location than we can use only a location to insert a queue. Algorithm for Circular Queue: - Insert function: Variables: - Front = Points first element of queue. Rear = Variable for last subscript value. Queue = Array of queue Size = Total no of elements. Step 1. Step 2. Step 3. queue] [Check that Queue is full] If front = 0 & rear = size-1 then [Print message] Queue is overflow return [Else] [Check that Queue is full] if rear = front-1 then [Print message] Queue Overflow return [Else] [Check that rear points to last element of if rear = size-1 then rear 0 Yogidham, Kalawad Road, Rajkot. Ph : ,

43 Step 4. element] queue[rear] val return [Else] [Check that rear doesn t points to any if rear=-1 then front 0 rear 0 queue[rear] val return P.T.O. Step 5. Step 6. Step 8. [Else] [Increment rear by 1] rear rear+1 [assign value in queue] Queue[rear] val [Stop] Delete Function: Step 1. [Check that front & rear both points to same] If front = rear then Front -1 Rear -1 Return Step 2. [Else] [Check front points to last element] If front = size 1 then Front 0 Step 3. [Else] [Increment front by 1] Front front +1 Step 4. Return Step 5. [Stop] Print Function: Yogidham, Kalawad Road, Rajkot. Ph : ,

44 Step 1. [Check that front points to any before rear element] If front <= rear then [Repeat i up to rear] for i front to rear print queue[i] Step 2. [else] [Repeat i up to last element] for i rear to size 1 print queue[i] Step 3. [Repeat i up to front] for i 0 to front print queue[i] Step 4. [Stop] Application of Queue: In a computer network messages from one to another computer are generally created asynchronously. These messages therefore need to be buffered until the receiving computer is ready for it these communication buffers make extensive use of Queues by storing of Queues by storing these message in a queue. Also the messages need to be sent to receiving computer in the some order in which they are created. I.e. FIFO. Yogidham, Kalawad Road, Rajkot. Ph : ,

45 Tree Definition:- o A Tree structure means that the data is organized as branches, which relate the info. It is a non-linear data structure. One very common gynecological chart that is used to represent tree structure is lineage. The lineage chart represents ancestors. Explain Tree:- o A Tree structure means that the data is organized as branches, which relate the info. o It is used to represent the relationship among data element in so many applications. o Tree is a non-linear data structure. o Trees are encountered frequently in every life. o An arrays, lists, stacks, queues are linear data structure. o Graphs are classified in the non-linear category of data structure. You may recall from the previous blocks on graph that an important class of graph is called Trees. o In Tree structure each node may paint to several other nodes. Thus a tree is a very flexible & powerful data structure that can be used for a glide variety of application. o Although the nodes in a general tree may contain any no of pointer to the other tree nodes. o A large no of data structure have at the most two pointers to the other tree nodes. This type of tree is called Root. Together with two binary trees called the left sub tree & right sub tree of the root. o Gaining from the leaves to the root is called climbing the tree & gaining from the root to the leaves is called descending the tree. o One of the most fundamental & useful concept is computer science. o Trees find their application such as compiles construction database design, operating systems etc. o For (e.g.) :- Suppose we wish to use a data structure to represent a person & all of his or her descendants. Assume that the person s name is Rahul & that he has 3 Children, sanjay, Sameer, Nisha. Also suppose that sameer has 3 children, Abhay, Ajit & Madhu and nisha has a child Neha. We can represent rahul & his descendants guit naturally with the tree structure shown below. Yogidham, Kalawad Road, Rajkot. Ph : ,

46 The set of tree is called forest. Binary Tree:- o A Binary tree is a finite set of element that is either empty or is partitioned into three disjoint subsets. The first subset contains a single element called the root of the tree. The other two subsets are themselves binary trees called the left & right subtree of the original tree. A left or right subtree can be empty. Each element is called a NODE of the tree. o For (e.g):- We have a root R & two disjoint binary tree, T1 & T2 (Which are called the left sub tree & right sub tree respectively). If T1 is non-empty then the root of the T1 is called the left successor of R. If T2 is non-empty then the root of T2 is called as right successor of R. Yogidham, Kalawad Road, Rajkot. Ph : ,

47 Here root is 1 & its predecessor is 2 & right successor is 3. Similarly left successor of 2 is 4& right successor is 5. Representation OR Implementation of Binary Tree. There are two traditional popular techniques that are used to maintain binary tree in to the memory these are, Sequential Representation (Linear) Linked list Representation (Link) Sequential Representation:- A Sequential Representation of a binary tree requires numbering of nodes starting with nodes on level then level 1 & so on. The nodes are numbered from left to right. The nodes of the binary tree are maintained in a one-dimensional array. Once the size of array has been determined the following method is used to represent the tree. Stare the root in 1 st location of array. If a node is in location n of the array. Stare its left & location in & its right child location (zn+1) Advantages:- The main advantage of this method i.e in its simplicity & the fact that given a child node, its parent node can be determined immediately, If the child nodes at location N in the array then its parents node is at location N/Z (integer division). It can be implemented easily in elder language such as BASIC & FORTRAN. In tree searching is faster than linked list. Disadvantages:- Yogidham, Kalawad Road, Rajkot. Ph : ,

49 Threading the tree can offset the first disadvantage. The second disadvantage can be offset by adding a parent field to a node Operation Of Binary Tree o There are several operation that can be performed in binary trees such as, Insertion Deletion Searching Traversal of the tree etc. Traversal:- One of the most common operation performed on tree structure is that the Traversal. This is procedure by which each node in the tree is processed exactly once. There are mainly three types of traversing binary tree. Preorder Inorder Postorder Preorder:- In this technique first of all we processed the root R of the binary tree T. Then we traversal the left subtree T1 & R in preorder Which means that we traversal root of the subtree T1 first & then its left subtree. First of all consider the root node A then consider its left subtree as shown in upper figure. Yogidham, Kalawad Road, Rajkot. Ph : ,

50 Now we process root of subtree T1 & then its left subtree T3 that is a terminal node o. Now, consider the right subtree of T1 that T4, the root of T0 is E & then left subtree of T4 is T7 that is the terminal of all the nodes of the left subtree T1 is finished & is given as, B,D,E,F. Continue the same process for the right subtree of A & its nodes. After completion of the preorder traversing of binary tree we get list of nodes as following, A, B, D, E, F, C, G, H, I, J. The preorder traversal of a binary tree is defined as follows, First process the root node. Second traversal the left subtree in preorder. Third traversal the right subtree in preorder. Algorithm for preorder:- Temproot:- Temporary pointer variable initialized with root. Info:- Information part of node. Left:- Pointer to left most node. Right:- Pointer to right most node. Step-1:-( Repeat step 2,3,4 & check that temproot is not equal to NULL) If temproot is not equal to NULL then Step-2:-(Print information part of node) Print info(temproot) Step-3:-(Call function itself as a left most node) Preorder(left(temproot)) Step-4:-(Call function itself as a right most node) Preorder(right(temproot)) Step-5:-(Stop) Inorder:- In inorder traversal method first of all we have to process the left subtree T1 of the root R in Inorder then process the root R & at the last. We process the right subtree T2 of R. Yogidham, Kalawad Road, Rajkot. Ph : ,

51 Consider the figure we first process the node D then the root of D is B node & then the right subtree of B. now the left subtree of e is f that is the terminal node thus, all the nodes of left subtree of root is processed & resulting list is as follows: Left Tree:- T1 B D T3 E T4 J T9 Then we process the root A & then process the right subtree T2. Combining all the list of elements of the left subtree T1 & root & T2 element of the right subtree T2, We get the list of all the element in the binary tree T as following Yogidham, Kalawad Road, Rajkot. Ph : ,

52 D, B, J, E, A, F, C, H, G, I. The inorder to traversal of a binary tree is define as follows, Traverse the left tree in Inorder. Process the root node. Traverse the right tree in Inorder. Algorithm For Inorder Traversal of Binary Tree:- Variable:- Same as Preorder. Step-1:- (Repeat step2,3 & 4 & check that temproot is not equal to NULL) If temproot is not equal to NULL then Step-2:-(Call function itself as a left most node) Inorder (left(temproot)) Step-3:-(print Information part of node) Info (temproot) Step-4:-(Call function itself as a right most node) Inorder (right(temproot)) Step-5:-(Stop) Postorder Traversal:- In the postorder traversal first of all we process the left subtree T1 of root in postorder. Then, the right subtree T2 in postorder & at the last the root. A T6 T3 D B T1 C T4 T5 E G H T2 T9 F T7 I T8 J Consider the figure, we first process the terminal node D. Now, we consider right subtree of B that is E, the left subtree of E is F, so process F at the second priority as, Yogidham, Kalawad Road, Rajkot. Ph : ,

53 there is no right subtree of E & at list root of subtree T1 that is B, the resulting list of elements after traversing the left subtree in postorder is as follows T3 B T1 T4 D E T7 F The final list of elements after traversing binary tree is as follows, D, F, E, B, G, I, J, H, C, A. Postorder traversal of binary tree as defined as follows, Traverse the left subtree in postorder. Traverse the right subtree in postorder. Process the root node. Algorithm for Postorder Traversal of Binary Tree. :- Variable:- Same as preorder. Step-1:-(Repeat step 2,3,4 & check that temproot is equal to NULL) If temproot is not equal to NULL then Step-2:- (Call function itself as a left most node) Postorder(left(temproot)) Step-3:- (Call function itself as a right most node) Postorder(right(temproot)) Step-4:-(Output the information part of node) Info(temproot) Step-5:-(Stop) Application of Binary Tree:- There are three types of Binary tree application Yogidham, Kalawad Road, Rajkot. Ph : ,

54 Manipulation of Arithmetic operation. Symbol table constructor. Syntax analysis. MANIPULATION OF ARITHMETIC OPERATION We will first discuss the relationship between binary tree & formulas in prefix or suffix notation. Next we will discuss the mechanical manipulation of expressions that are represented by binary tree. We observe that the formulas in reverse polish notation are very useful in the compilations process. There is a close relationship between binary tree & formulas in prefix or suffix notation. Lets write any where the left & right subtree are as the left & right operands of the tree are the variable & constants in the expression. We may want to symbolically add, subtract, multiply, divide, differential, integrate etc. such expressions. Symbolic table Construction:- One of the criteria that a symbol table routine must meet is that the table searching must be performed efficiently. The two required operations that must be performed on symbol table are insertion & look-up each of which involves searching. A binary tree structure is chosen for two reasons. The first reason is if the symbol entries as encountered one uniformly distributed according to lexico graphic order Second a binary tree is easily maintained in lexico graphic Order in the sense that only a few paints need to be changed. Also the message needs to be sent to receiving computer in the same order in which they are created i.e. FIFO (First In First out) order. Yogidham, Kalawad Road, Rajkot. Ph : ,

55 Graphs 1) Graph:- A graph G consists of a non-empty set V called the set of nodes of the graph a set E which is the set of edge of the graph & a mapping from the set of edges E to a set of pairs of elements of V. Or A graph consists of a set of nodes & a set of edges. A pair of nodes specifies each edge in a graph. 2) Node: - 3) Structure: - 4) Forest: - A graph G consists of non empty set V called the set of Nodes of the graph. Structure is a user define data type that allows the user to perform certain(several) operations on to the different types of DATA TYPES. A set of disjoint tree is called the Forest. 5) Weighted Graph: - A graph in which weights are assigned to every edge is called a weighted graph. 6) Sling: - An edge of a graph, which joins a node to itself, is called a Sling. 7) Complete Graph: - A graph is complete or completely connected if and only if every pair of vertices are connected in at list one direction. 8) Mixed Graph: - If some of the edges are directed and some of the edges are undirected in a graph then the graph is called Mixed graph. Yogidham, Kalawad Road, Rajkot. Ph : ,

56 9) Pointer: - Pointer is a one type of utility which is provided by the C Language that can store the address of the any particular node. 10) Isolated Vertex: - In a graph, which is not adjacent to any other node is called Isolated vertex. 11) Loop: - 12) Directed Graph: - 13) Undirected Graph:- 14) Acyclic: - 15) Outdegree of node: - 16) Indegree of node: - An edge of a graph, which joins a node to itself, is called a Loop. The direction of loop of no significance, hence it can be considered either a directed or undirected edge. A graph is called a directed graph if each edge is identified by ordered pay of vertices (vi, vj) Undirected graph the first element of the pair is called the start vertex and the second element is called the end vertex of the edge. The edge is set to be directed from the start vertex to the end vertex therefore the pairs (vi, vj) and (vj, vi) represent two different edges in a directed graph. In Graph G=(V,E) an edge which has no specific direction is called an Undirected edge. A graph in which every edge is undirected is called Undirected graph. A directed graph is acyclic if it has no cycles. Otherwise graph is known as cyclic graph. The outdegree of vi is the number of edges whose start vertex is vi. Yogidham, Kalawad Road, Rajkot. Ph : ,

### Data Structure [Question Bank]

Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:

### DATA STRUCTURES USING C

DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

### 10CS35: Data Structures Using C

CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

### Algorithms and Data Structures

Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2

### PES Institute of Technology-BSC QUESTION BANK

PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions

### 5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The

### UNIVERSITI MALAYSIA SARAWAK KOTA SAMARAHAN SARAWAK PSD2023 ALGORITHM & DATA STRUCTURE

STUDENT IDENTIFICATION NO UNIVERSITI MALAYSIA SARAWAK 94300 KOTA SAMARAHAN SARAWAK FAKULTI SAINS KOMPUTER & TEKNOLOGI MAKLUMAT (Faculty of Computer Science & Information Technology) Diploma in Multimedia

### Module 2 Stacks and Queues: Abstract Data Types

Module 2 Stacks and Queues: Abstract Data Types A stack is one of the most important and useful non-primitive linear data structure in computer science. It is an ordered collection of items into which

### Data Structures UNIT III. Model Question Answer

Data Structures UNIT III Model Question Answer Q.1. Define Stack? What are the different primitive operations on Stack? Ans: Stack: A stack is a linear structure in which items may be added or removed

### Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate

### Data Structure with C

Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which

### GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. Course Curriculum. DATA STRUCTURES (Code: 3330704)

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT Course Curriculum DATA STRUCTURES (Code: 3330704) Diploma Programme in which this course is offered Semester in which offered Computer Engineering,

### Any two nodes which are connected by an edge in a graph are called adjacent node.

. iscuss following. Graph graph G consist of a non empty set V called the set of nodes (points, vertices) of the graph, a set which is the set of edges and a mapping from the set of edges to a set of pairs

### AS-2261 M.Sc.(First Semester) Examination-2013 Paper -fourth Subject-Data structure with algorithm

AS-2261 M.Sc.(First Semester) Examination-2013 Paper -fourth Subject-Data structure with algorithm Time: Three Hours] [Maximum Marks: 60 Note Attempts all the questions. All carry equal marks Section A

### MAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push) -----------------------------------------

=============================================================================================================================== DATA STRUCTURE PSEUDO-CODE EXAMPLES (c) Mubashir N. Mir - www.mubashirnabi.com

### 1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated

### COT5405 Analysis of Algorithms Homework 3 Solutions

COT0 Analysis of Algorithms Homework 3 Solutions. Prove or give a counter example: (a) In the textbook, we have two routines for graph traversal - DFS(G) and BFS(G,s) - where G is a graph and s is any

### Stack & Queue. Darshan Institute of Engineering & Technology. Explain Array in detail. Row major matrix No of Columns = m = u2 b2 + 1

Stack & Queue Explain Array in detail One Dimensional Array Simplest data structure that makes use of computed address to locate its elements is the onedimensional array or vector; number of memory locations

### Common Data Structures

Data Structures 1 Common Data Structures Arrays (single and multiple dimensional) Linked Lists Stacks Queues Trees Graphs You should already be familiar with arrays, so they will not be discussed. Trees

### Trees. Definition: A tree is a connected undirected graph with no simple circuits. Example: Which of these graphs are trees?

Section 11.1 Trees Definition: A tree is a connected undirected graph with no simple circuits. Example: Which of these graphs are trees? Solution: G 1 and G 2 are trees both are connected and have no simple

### Data Structures Using C++ 2E. Chapter 5 Linked Lists

Data Structures Using C++ 2E Chapter 5 Linked Lists Doubly Linked Lists Traversed in either direction Typical operations Initialize the list Destroy the list Determine if list empty Search list for a given

### Comp 245 Data Structures. Stacks

Comp 245 Data Structures Stacks What is a Stack? A LIFO (last in, first out) structure Access (storage or retrieval) may only take place at the TOP NO random access to other elements within the stack An

### Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Data Structures Page 1 of 24 A.1. Arrays (Vectors) n-element vector start address + ielementsize 0 +1 +2 +3 +4... +n-1 start address continuous memory block static, if size is known at compile time dynamic,

### Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent

### The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical

### Data Structure. Lecture 3

Data Structure Lecture 3 Data Structure Formally define Data structure as: DS describes not only set of objects but the ways they are related, the set of operations which may be applied to the elements

### TREE BASIC TERMINOLOGIES

TREE Trees are very flexible, versatile and powerful non-liner data structure that can be used to represent data items possessing hierarchical relationship between the grand father and his children and

### Definition. E.g. : Attempting to represent a transport link data with a tree structure:

The ADT Graph Recall the ADT binary tree: a tree structure used mainly to represent 1 to 2 relations, i.e. each item has at most two immediate successors. Limitations of tree structures: an item in a tree

### Glossary of Object Oriented Terms

Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

### Homework 15 Solutions

PROBLEM ONE (Trees) Homework 15 Solutions 1. Recall the definition of a tree: a tree is a connected, undirected graph which has no cycles. Which of the following definitions are equivalent to this definition

### Data Structures Using C++ 2E. Chapter 7 Stacks

Data Structures Using C++ 2E Chapter 7 Stacks Stacks Data structure Elements added, removed from one end only Last In First Out (LIFO) FIGURE 7-1 Various examples of stacks Data Structures Using C++ 2E

### Overview of Data Structures

UNIT 3 Concrete Data Types Classification of Data Structures Concrete vs. Abstract Data Structures Most Important Concrete Data Structures Arrays Records Linked Lists Binary Trees Overview of Data Structures

### Theorem A graph T is a tree if, and only if, every two distinct vertices of T are joined by a unique path.

Chapter 3 Trees Section 3. Fundamental Properties of Trees Suppose your city is planning to construct a rapid rail system. They want to construct the most economical system possible that will meet the

### Graph. Consider a graph, G in Fig Then the vertex V and edge E can be represented as:

Graph A graph G consist of 1. Set of vertices V (called nodes), (V = {v1, v2, v3, v4...}) and 2. Set of edges E (i.e., E {e1, e2, e3...cm} A graph can be represents as G = (V, E), where V is a finite and

### Chapter 7: Queues and Deques

Chapter 7: Queues and Deques After the stack, the next simplest data abstraction is the queue. As with the stack, the queue can be visualized with many examples you are already familiar with from everyday

### Data Structures Using C++ 2E. Chapter 7 Stacks

Data Structures Using C++ 2E Chapter 7 Stacks Linked Implementation of Stacks Disadvantage of array (linear) stack representation Fixed number of elements can be pushed onto stack Solution Use pointer

### Symbol Tables. IE 496 Lecture 13

Symbol Tables IE 496 Lecture 13 Reading for This Lecture Horowitz and Sahni, Chapter 2 Symbol Tables and Dictionaries A symbol table is a data structure for storing a list of items, each with a key and

### Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010

Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010 Problem 1. In each of the following question, please specify if the statement

### Chapter 3: Restricted Structures Page 1

Chapter 3: Restricted Structures Page 1 1 2 3 4 5 6 7 8 9 10 Restricted Structures Chapter 3 Overview Of Restricted Structures The two most commonly used restricted structures are Stack and Queue Both

### 2) Write in detail the issues in the design of code generator.

COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

### Data Structures. Level 6 C30151. www.fetac.ie. Module Descriptor

The Further Education and Training Awards Council (FETAC) was set up as a statutory body on 11 June 2001 by the Minister for Education and Science. Under the Qualifications (Education & Training) Act,

### Questions 1 through 25 are worth 2 points each. Choose one best answer for each.

Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in

### CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

### 2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

### BM267 - Introduction to Data Structures

BM267 - Introduction to Data Structures 3. Elementary Data Structures Ankara University Computer Engineering Department BLM267 1 Objectives Learn about elementary data structures - Data structures that

### Stacks. The stack ADT Stack Implementation. Stack Examples. using arrays using generic linked lists using List ADT. EECS 268 Programming II 1

Stacks The stack ADT Stack Implementation using arrays using generic linked lists using List ADT Stack Examples 1 Stacks and Queues Linear data structures each item has specific first, next, and previous

### Application of Stacks: Postfix Expressions Calculator (cont d.)

Application of Stacks: Postfix Expressions Calculator (cont d.) Postfix expression: 6 3 + 2 * = FIGURE 7-15 Evaluating the postfix expression: 6 3 + 2 * = Data Structures Using C++ 2E 1 Application of

### Bhakta Kavi Narsinh Mehta University, Junagadh

Bhakta Kavi Narsinh Mehta University, Junagadh Draft Syllabus for B.Sc. (Computer Science) Bachelor of Science (Computer Science) (Semester - 1) Effective From June - 2016 B.Sc. (C.S.) (Semester - 1) CS-101:

### 7.1 Our Current Model

Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.

### Data Structures and Data Manipulation

Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval

### Introduction to Data Structures

Introduction to Data Structures Albert Gural October 28, 2011 1 Introduction When trying to convert from an algorithm to the actual code, one important aspect to consider is how to store and manipulate

### Summary. Pre requisition. Content Details: 1. Basics in C++

Summary C++ Language is one of the approaches to provide object-oriented functionality with C like syntax. C++ adds greater typing strength, scoping and other tools useful in object-oriented programming

### Symbol Tables. Introduction

Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The

### CHAPTER 4 THE PARALLEL ALGORITHM FOR DETECTION AND EXECUTION OF ARITHMETIC OPERATIONS AT INTRAINSTRUCTION LEVEL

39 CHAPTER 4 THE PARALLEL ALGORITHM FOR DETECTION AND EXECUTION OF ARITHMETIC OPERATIONS AT INTRAINSTRUCTION LEVEL In this chapter the relevant work of parallelism exploitation within a single statement

Chapter 7. Indexes Table of Contents Objectives... 1 Introduction... 2 Context... 2 Review Questions... 3 Single-level Ordered Indexes... 4 Primary Indexes... 4 Clustering Indexes... 8 Secondary Indexes...

### PROBLEMS (Cap. 4 - Istruzioni macchina)

98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

### root node level: internal node edge leaf node CS@VT Data Structures & Algorithms 2000-2009 McQuain

inary Trees 1 A binary tree is either empty, or it consists of a node called the root together with two binary trees called the left subtree and the right subtree of the root, which are disjoint from each

### Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

### A. V. Gerbessiotis CS Spring 2014 PS 3 Mar 24, 2014 No points

A. V. Gerbessiotis CS 610-102 Spring 2014 PS 3 Mar 24, 2014 No points Problem 1. Suppose that we insert n keys into a hash table of size m using open addressing and uniform hashing. Let p(n, m) be the

### 1 2-3 Trees: The Basics

CS10: Data Structures and Object-Oriented Design (Fall 2013) November 1, 2013: 2-3 Trees: Inserting and Deleting Scribes: CS 10 Teaching Team Lecture Summary In this class, we investigated 2-3 Trees in

### KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

### Analysis of a Search Algorithm

CSE 326 Lecture 4: Lists and Stacks 1. Agfgd 2. Dgsdsfd 3. Hdffdsf 4. Sdfgsfdg 5. Tefsdgass We will review: Analysis: Searching a sorted array (from last time) List ADT: Insert, Delete, Find, First, Kth,

### Trees & Binary Search Trees

CMSC 132: Object-Oriented Programming II Trees & Binary Search Trees Department of Computer Science University of Maryland, College Park Trees Trees are hierarchical data structures One-to-many relationship

### LC-3 Data Structures. Textbook chapter 10

LC-3 Data Structures Textbook chapter 10 LC-3 data structures Abstract data structures are Defined by the rules for inserting and extracting data In this section, we will talk about The array The stack

### Unit 5 Central Processing Unit (CPU)

Unit 5 Central Processing Unit (CPU) Introduction Part of the computer that performs the bulk of data-processing operations is called the central processing unit (CPU). It consists of 3 major parts: Register

### IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

Chapter 7 Linked Lists In order to use linked lists, you need to learn how to allocate memory dynamically on the heap and you need to learn about objects. Recall that local variables are temporary which

### Binary Search Trees CMPSC 122

Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than

### Solid Modeling Techniques

ML70 LTUR Solid Modeling Techniques onstructive Solid eometry (S) omputational Solid eometry Primitive based: It is based on the notion that a physical object can be divided into a set of primitives basic

### Chapter 14 The Binary Search Tree

Chapter 14 The Binary Search Tree In Chapter 5 we discussed the binary search algorithm, which depends on a sorted vector. Although the binary search, being in O(lg(n)), is very efficient, inserting a

### INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY A PATH FOR HORIZING YOUR INNOVATIVE WORK A REVIEW ON THE USAGE OF OLD AND NEW DATA STRUCTURE ARRAYS, LINKED LIST, STACK,

### AP Computer Science AB Syllabus 1

AP Computer Science AB Syllabus 1 Course Resources Java Software Solutions for AP Computer Science, J. Lewis, W. Loftus, and C. Cocking, First Edition, 2004, Prentice Hall. Video: Sorting Out Sorting,

### CS268: Geometric Algorithms Handout #5 Design and Analysis Original Handout #15 Stanford University Tuesday, 25 February 1992

CS268: Geometric Algorithms Handout #5 Design and Analysis Original Handout #15 Stanford University Tuesday, 25 February 1992 Original Lecture #6: 28 January 1991 Topics: Triangulating Simple Polygons

### Binary Trees and Huffman Encoding Binary Search Trees

Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary

### Catalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni- versity.

7 Catalan Numbers Thomas A. Dowling, Department of Mathematics, Ohio State Uni- Author: versity. Prerequisites: The prerequisites for this chapter are recursive definitions, basic counting principles,

### Chapter 4 Index Structures

Chapter 4 Index Structures Having seen the options available for representing records, we must now consider how whole relations, or the extents of classes, are represented. It is not sufficient 4.1. INDEXES

### Data Structures Using Java

Data Structures Using Java D. S. Malik P. S. Nair THOMSON COURSE TECHNOLOGY Australia Canada Mexico Singapore Spain United Kingdom United States TABLE OF Contents PREFACE XXV 1.Software Engineering Principles

### Data Structures Using C++

Data Structures Using C++ 1.1 Introduction Data structure is an implementation of an abstract data type having its own set of data elements along with functions to perform operations on that data. Arrays

### Ordered Lists and Binary Trees

Data Structures and Algorithms Ordered Lists and Binary Trees Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/62 6-0:

### Course: Programming II - Abstract Data Types. The ADT Stack. A stack. The ADT Stack and Recursion Slide Number 1

Definition Course: Programming II - Abstract Data Types The ADT Stack The ADT Stack is a linear sequence of an arbitrary number of items, together with access procedures. The access procedures permit insertions

### GRAPH THEORY and APPLICATIONS. Trees

GRAPH THEORY and APPLICATIONS Trees Properties Tree: a connected graph with no cycle (acyclic) Forest: a graph with no cycle Paths are trees. Star: A tree consisting of one vertex adjacent to all the others.

### CMSC 451: Graph Properties, DFS, BFS, etc.

CMSC 451: Graph Properties, DFS, BFS, etc. Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Chapter 3 of Algorithm Design by Kleinberg & Tardos. Graphs

### CS 6202 PROGRAMMING & DATA STRUCTURES-I PART-B UNIT-I ANNA UNIVERSITY QUESTIONS

PART-B UNIT-I 1. Write a function that returns a pointer to the maximum value of an array of double s.if the array is empty,return null? (8) Double*maximum(double*a,int size); 2. Write a c program to find

### 4.3 Stacks and Queues. Pushdown Stacks. Data Structures and Data Types. Collections

Data Structures and Data Types 4.3 Stacks and Queues Data types Set values. Set operations on those values. Some are built in to Java: int, double, char,... Most are not: Complex, Picture, Charge, Stack,

### Compiling Scheme to a Micro 2 computer

Massachusetts Institute of Technology Course Notes 7 6.844, Spring 03: Computability Theory of and with Scheme April 22 Prof. Albert Meyer revised April 22, 2003, 1115 minutes Compiling Scheme to a Micro

### Unit 1. 5. Write iterative and recursive C functions to find the greatest common divisor of two integers. [6]

Unit 1 1. Write the following statements in C : [4] Print the address of a float variable P. Declare and initialize an array to four characters a,b,c,d. 2. Declare a pointer to a function f which accepts

### ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

ALGEBRA Pupils should be taught to: Generate and describe sequences As outcomes, Year 7 pupils should, for example: Use, read and write, spelling correctly: sequence, term, nth term, consecutive, rule,

### Linked Lists, Stacks, Queues, Deques. It s time for a chainge!

Linked Lists, Stacks, Queues, Deques It s time for a chainge! Learning Goals After this unit, you should be able to... Differentiate an abstraction from an implementation. Define and give examples of problems

### VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 603 203 DEPARTMENT OF COMPUTER APPLICATIONS QUESTION BANK IN REVISED BLOOM S TAXONOMY

ACADEMIC YEAR: 0 7 VALLIAMMAI ENGINEERING COLLEGE SRM NAGAR, KATTANKULATHUR 0 0 SEMESTER: ODD BRANCH: MCA YEAR: I SEMESTER: I SUBJECT CODE AND NAME: MC70 Problem Solving and Programming NAME OF THE FACULTY

### Stacks. Stacks (and Queues) Stacks. q Stack: what is it? q ADT. q Applications. q Implementation(s) CSCU9A3 1

Stacks (and Queues) 1 Stacks Stack: what is it? ADT Applications Implementation(s) 2 CSCU9A3 1 Stacks and ueues A stack is a very important data structure in computing science. A stack is a seuence of

### 2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

### Memoization/Dynamic Programming. The String reconstruction problem. CS125 Lecture 5 Fall 2016

CS125 Lecture 5 Fall 2016 Memoization/Dynamic Programming Today s lecture discusses memoization, which is a method for speeding up algorithms based on recursion, by using additional memory to remember

### Quiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s

Quiz 4 Solutions Q1: What value does function mystery return when called with a value of 4? int mystery ( int number ) { if ( number

### G. H. RAISONI COLLEGE OF ENGG NAGPUR-16 Session 2006-2007 DEPARTMENT CSE Semester IV SUBJECT DSPD

G. H. RAISONI COLLEGE OF ENGG NAGPUR-16 Session 2006-2007 DEPARTMENT CSE Semester IV SUBJECT DSPD LIST OF EXPERIMENTS 1.Make a database. The record tag,tstudent consists of these fields: Name[20],RollNo.[5],Address[40],Phone[12],UT-1[2,from1

### EE2204 DATA STRUCTURES AND ALGORITHM (Common to EEE, EIE & ICE)

EE2204 DATA STRUCTURES AND ALGORITHM (Common to EEE, EIE & ICE) UNIT I LINEAR STRUCTURES Abstract Data Types (ADT) List ADT array-based implementation linked list implementation cursor-based linked lists

### Singly Linked Lists and Chains

Chapter 4 Linked Lists Lecture 7-1 Singly Linked Lists and Chains Representing Chains in C++ Template Class Chain Circular Lists Available Space Lists Linked Stacks and Queues Polynomials Equivalence Classes