Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
101 views
Data Structure & Algorithm (PCC-CS301) - 220716 - 083206
Uploaded by
Subhadip Das
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Data Structure & Algorithm [PCC-CS301]_220716_0832... For Later
Download
Save
Save Data Structure & Algorithm [PCC-CS301]_220716_0832... For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
101 views
Data Structure & Algorithm (PCC-CS301) - 220716 - 083206
Uploaded by
Subhadip Das
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Data Structure & Algorithm [PCC-CS301]_220716_0832... For Later
Carousel Previous
Carousel Next
Save
Save Data Structure & Algorithm [PCC-CS301]_220716_0832... For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 85
Search
Fullscreen
POPULAR PUBLICATIONS INTRODUCTION @ Chapter ata Glance Data (plural of “datum” refers to qualitative or quantitative attributes ofa variable or set off variables Typicelly, data are the resus of measurements and can be the basis of graphs, images or observations of a set of variahles Metadata is 2 data, containing 1 description of other data, Earlier term for metadata is ancillary data Data structure: Data may be organied in many different ways. The logical or mathematical model of « particular organization of data is called data structure. Classification: Data structure can be classified as linear and non-linear, Linear date structure: The data structure is said to be lincar, if its clement forms a sequence ‘or linear list. Lincar data structures organize theit data elements in a linear fashion. Non-linear dats structure: In nonlinear data structures, data elements are not organized ina sequential fashion A data item ina nonlinear daa structure could be attached to several other data elements to reflect special relationship among ther and all the data items cannot b traversed in 2 single run. Various operations can be performed on data structure. List of some frequently us cperatons are pve below: process the da 2. Searching: finding the location of record to be processed. 3. Inserting: adding 2 new record to the structure 4. Deleting: removing the record from the structure. 5. Sorting: aranging the record in some logical order. (6. Merging: combining two different sets of records to form a final set of records, ‘Abstract data type (ADT): Absvact Data Types are a set of data values and associ ‘operations that are precisely independent of any particular implementation. The term ab signifies that the datatype will nly set the rule of it's usage but how it will be used dey con the implementation. For example stacks and queues are called abstract data types. stack datatype defines two abstract methods PUSH and POP. j ‘The basic properties of an algorithm are: ‘Input: Each algorithm is supplied with azero or more extemal quantities. Ouput: Each algorithm must produce atleast one quantity, Definiteness: Each instruction must be clear and unambiguous. Finiteness: The algorithm must terminate after a finite number of steps within finite time. Effectiveness: Each instructen must be sufficiently basic and also be feasible. ‘Analysis of an algorithm means to determine the amount of resources (such as time storage) necessary to execute it. Most algorithms are designed to work with inputs of length. Usually the efficiency or running time ofan algorithm is stated as a function rel: the input lengh wo the manber of steps (Kime complxiy) or storage locations (spat complexity). In theoretical amas of algorithms it common to esiate their complexity in the ‘asymptotic sense, ie. to estimate the complexity function for arbitrarily large input. Big O. DSA-2 Scanned with CamScannerDATA STRUCTURE & ALGORITHM notation, omega notation and theta notation are used for this Usually asymptotic estimates are used because different implementations of the same algorithm may differ in efficiency. However the efficiencies of any two “reasonable” implementations of a given algorithm are related by a constant multiplicative factor called a hidden constant. «Complexity: There are two types of complexities of an algorithm, time complexity and space complexity. The dime complexity of an algorithm is the amount of time the computer requires to execute the algorithm. ‘The space complexity of an algorithm is the amount of memory space the computer requires, completing the execution of the algorithm. Multiple Choice Type Questions 4, Each element of an array arr{20]{50] requires 4 bytes of storage. Base address of arr Is 2000. Tho location of arr{10]{10] when the array is stored as column majors a) 2820 ) 2840 ) 4048 ) 4840 Answer: (b) 2. In C language, malloc{ ) returns [WBUT 2003] a) Integer pointer b) structure pointer cc) null pointer 4) void pointer Answer: (©) 3. Which of the following Is the best time for an-algorithm? | —»-(WBUT 2010) a) O(n) b) O(log, n) ©) 0(2") 4) O(nlog, n) ‘Answer: (b) ; . 4, Four algo.s do the same task. Which algo. should execute the slowest for large values of n? [WBUT 2010] a) O(n) b) O(n) ¢) O(log, n) 4) 0(2") Answer: (4) 5, In C language, arrays are stored in which representation? [WBUT 2011] a) Column major ,b) Row major ¢)Layer major —_d) None of these Answer: (b) 6. Which of the following algorithm should execute the slowest for large values of N? [WBUT 2012] a) O(N) b) O(N’) ¢) Oflog:N) d) None of these Answer: (b) 7. Which Is better computing time (in analysis of algorithm)? [WBUT 2013] a) O(n) b) O(2n) ¢) O(log2n) 4d) None of these Answer: (c) DSA-3 Scanned with CamScanner merePOPULAR PUBLICATIONS, 8. A dynamic data structure where we can search for desired records In O( lo time is [WBUT 201: a) heap b) binary search tree ‘ ¢) circularly linked list dary Answer: (b) 9. For Column Major, what Is the address of [3, 2] th element of a 3x4 Matrix {contains integer number)? itis given that the ‘Base Address Is 2000’. [WBUT 2013] a) 2010 b) 2012 ) 2016 d)2018 Answer: should be 2020 40. Which of the following expressions access the (I j)th entry of a (m x n) mat stored in column major order? [WBUT 204 a)nx(i-t)4] bymxg-1)+i ‘ e)mx (n=) +] d)nx(m—i) +) Answer: (b) 44. Which of the following is nondinear data structure? bust ) Strings, 4. Let the size of the elements stored in an 8 x 3 matrix be 4 bytes each. If the address of the matrix is 3500, then find the address of A [4, 2] for both row maj column major cases. What is sparse matrix? OR, What are sparse matrices? How such a matrix is represented in memory? What the types of sparse matrices? Answer: 1 Part: In row major order the adress will be . Loc (A(ij)) = Lo + ((-1)* n+G-)) *e ore j ~ Loe (A(42))=3500+ (4-1) 93+ (2-1) 94= ee Yau = 3500+ 40 = 3540 ’ In column-major order the address will be fg 2 Loc (Afij)) = Lo+ (G-i)*m+(i-1)) *e Therefore Loc (A(4,2)) = 3500 + (2-1) * 8+ (4-1) *4= see = 3500 +44 = 3544 DSA4 Scanned with CamScannerDATA STRUCTURE & ALGORITHM 2™ Pai A matrix column. If there are m rows and n columns, then total elements in a matrix or size of a matrix is m x nclements. This m x n elements requires m x n units of storage. A matrix, that is filled with mostly zeroes (more than 2/3 elements are zero), is called as a sparse matrix. Now, if there is a sparse matrix of order m * n, and if we use a 2D array of order m = n to store this matrix, then there is basically wastage of large amount of memory. ‘Now, a sparse matrix can be stored as a list of three tuples of the form (i, j, value). In this way we can store only non-zero elements. represented in memory as 2D array, like A [i, j], where i is a row and j is a 000010 200000 030000 : 000700 ' 0 0 000.30 Let us consider a matrix M(5*6) Here the number of non-zero elements t= 5. The array A (0...t, 1...3] can store all the non zero elements as given below: eee oan 5 : Tessas) Alo] 5 6 5 : : Al] 1 5 . 1 The element A (0, 1] and A [0, 2] contain the number of Af2] 2 1 2> rows and columns of the matrix. A[0, 3] contains total AB] 3 2 3 number of non-zero items. Al] 4°. 4 7 Af] 5 6 30 2. Show that the function (7) defined by: [WBUT 2007, 2010, 2016, 2018] SQ=1 S(n)= fon-+4 forn>1 ~ has the complexity O ( log n). Define Big - O, 2,4 notations. Explain the conceptual differences among these three representatives. (WBUT 2007] And, Define Big O notation. ‘ TWBUT 2010, 2012] “DSAS” Scanned with CamScannerPOPULAR PUBLICATIONS Answer: 1" Part: fin) = f{n-1)41/n = fln-2)+1/(n-I)+/n = f(n-3)41(n-2)+ (nel) %n We can evaluate this type of series just by integrating I/x from % ton +%, After integrating. we get the result as Inn + ¥4)—In 4 =Inn-0.7 Hence, we can write the complexity as (10g n). Big O notation: The Big Oh (the "O" stands for “order of") notation is used to classify functions by theip asymptotic growth function and hence finding the time complexity of an algorithm, There are two types of complenities of an algorithm, time complexity and space complexity. The time complexity ofan algorithm is the amount of time the compute requires to execute the algorithm. The space complexity of an algorithm is the amount of memory the computer needs to run to complete the execution of the algorithm, algorithms are compared based on their performances. The performance is measure terms of time complexity & space complexity. Based on the nature of the input, complexity can be of three different types: best case, average case and worst case, The different computing functions are measured as: 12, 2°, logan, nlog.n, 2". n, The rate of growth of all these functions is shown below: Q: Let f{n) and g(n) be functions, where nis a positive integer. We write fn) = Q((n)) and only if g(n) = Offi). DSA6 Scanned with CamScannerDATA STRUCTURE & ALGORITHM 6: : Let fin) and g(n) be functions, where n is a positive integer. We write An) = O(g(n)) if ! and only if g(n) = O(n). and g{n) = Q(fin)). 3. Derive values related to the average case and worst case behaviour of Bubble q Sort algorithm. Also, confirm that the best case behavior is O(n). [WBUT 2007] OR, Write an algorithm for sorting a list numbers in ascending order using bubble sort } technique and find its time complexity. [WBUT 2017] t Answer: The algorithm for bubble sort is given as follows: procedure: BubbleSort (List{]) j Inputs: List(] - A list of numbers Locals: i, j - integers Begin: For i = 0 to List.Size-1 For j = itl to List.Size-1 If List{i] > List(j], Then Swap List{i] and List{j] ! End If Next j Next i Analysi The size of the sorting problem is related to the size N of the list. As N increases, we expect the execution time to increase as well. The innermost instruction is to swap two list elements. Regardless of how long the list is, this always takes the same amount of time, and so the swap instruction is O(1) with respect to N. Surrounding that instruction is an if statement, which either executes its body, or does'not; in the worst case, it will execute its body. Again, the if statement is (1). The if statement is executed as many times as the inner loop iterates, and the inner loop executes as many times as the outer loop iterates. During the first iteration (i = 0), the inner loop executes N— | times, during the second iteration (i= 1), N—2 times, and so on. o( Sev-1-9 beh )) - oN? —. i i number-of-oops time-per-loop So the complexity is O(N2) in the average case as well worst case. | The best case would be if the list were already sorted. There will be comparisons as it is but no exchanges and execution time is in O(N2). But if we keep a track of exchanges in each pass and terminate the program checking if no there are no exchanges, then the program would require only one pass and max. (N-1) comparisons are required in that single pass and we can say that the complexity is of order of O(N). DSA-7 i Scanned with CamScannerPOPULAR PUBLICATIONS. : 4, What Is linear data structure? [BUT 2965 Answer: A data structure is said to be linear ifits elements form a sequence or @ linear list, Examples: + Amays + Linked Lists + Stacks, Queues The Operations that can be done on linear structures are: Traversal: Trave! through the data structure Search; Traversal through the data structure for a given element Insertion: Adding new elements to the data structure Deletion: Removing an element from the data structure Sorting: Arranging the elements in some type of order Merging: Combining two similar data structures into one. raion Prove that, O(f{x)) + Olg{x)) = 0 (max{fixh%)) Suppose (in O(t) +g) en isin Olan), 6) besnse two timestf {greatest of f(x) and g(x) is greater than or equal tothe sum. More precisely: G(X) <= (F(X) + e(x)) <= 2e{man(flx), £(%))- Next, suppose q(x) is in O(max(f{x), g(x)) then q(x) is in O(f{x) + g(x) ) because th greatest of flx) and g(x) is less than or equal the sum of the two (assuming the ty 4 functions are positive valued). In formulas: (x) <= c max (fx), g(x),h(x)) <= € (f(x) + £(2)). Hence proved. Structure? Answer: t ‘An abstract data type (ADT) is an object with a generic description independent implementation details. If for a particular collection of data only the structure of data the functions to be performed on the data is defined but the implementation is defined, then such a collection of data is called Abstract data type. In dynamic Data Structure memory allocation for the data structure takes place at the time and only required amount of memory is allocated. E.g:: Link lists, Stacks, Queues, Trees 7. T(n) = 4n? + 3n log n, express T(n) in Big (0) notations. Answer: In Big (O) notation the complexity is O(n’). 8. Write the difference between a[} [] anda. Answer: The main difference between riultidimensional arrays (al}(]) and arrays of pointer (**8) refers to an array of particular datatype arrays (a pointer to pointers to that datatatype) is ‘the fact that multidimensional arrays are rectangular data structures, with the sar DSA : ; Scanned with CamScannerDATA STRUCTURE & ALGORITHM number of elements allocated for each specified dimension. This constraint is not necessarily present in an array of pointers. 9, Do a comparison among Data Type, Abstract Data Type and Data structure. (WBUT 2013) Answer: Data type consists of the values it represents and the operations defined upon it.. Integer or character data types are found in neatly all computers, and they have well-defined operations that can be done with them. For example, the integer data type has operations for addition, subtraction, multiplication, and division. The computer knows how to perform these arithmetic operations with any two integers because these operations are part of the integer data type. A data type can be considered abstract when it is defined in terms of operations on it, and its implementation is hidden (so that we can always replace one implementation with another for, ¢.g., efficiency reasons, and this will not interfere with anything in the program). Thus, speaking about such a type, we leave its implementation aside considering it irrelevant to the topic, unless we directly discuss the implementation. ‘A data structure is an arrangement of data in a computer's memory or even disk storage. An example of several common data structures are arrays, linked lists, queues, stacks, binary trees, and hash tables. Data Structure is an implementation of ADT. Many ADT can be implemented as the same Data Structure. 40. What are the differerices between linear and non-linear data structures? (WBUT 2013, 2014] OR, Explain linear and non-linear data structure with example. [WBUT 2019] Answer: Data structure can be classified as linear and non-linear. Linear data structure: The data structure is said to be linear, if its element forms a sequence or linear list. There are two basic ways of representing such structure in memory. Here the elements are traversed sequentially starting from the beginning. (1) Linear relationship between data elements is represented by means of sequential memory locations. Ex: Arrays. (2) Linear relationship between data elements is represented by means of pointers and « links. Ex: Linked list. Non-linear data structure: They are used to represent the data having a hierarchical relationship between elements. Here the elements are not traversed sequentially, rather they are traversed in a non linear fashion. For example, in case of the tree, we have to start from the root but we have to traverse either left subtree or right subtree, but not the both. Ex: Graphs and Trees. Scanned with CamScannerPOPULAR PUBLICATIONS. 44, What are the characteristics of algorithm? [WBUT 2014) Answer: + Precision — the steps are precisely stated(defined). ‘© Uniqueness ~ results of cach step are uniquely defined and only depend on the input and the result ofthe preveding steps. Finiteness — the algorithm stops after a finite number of instructions are executed, Input - the algorithm receives input. Output - the algorithm produces output. ‘Generality — the algorithm applies to a set of inputs. 42. 2) Suppose one 2-D array is initialized as int a[5][7]; Base address is 4000. Find the location of element a[2][4]in row major form and column major form. b) Define Sparse Matrix. [WBUT 2014] Answer: a) Assume that the sizeof each element is 4 bytes. In row major order the address will be Loc (A(ij))= Lo+(i-I)* ntG-t))%e Therefore, Loc (
[email protected]
)) = 4000+ (2 eT 1) * 4= 4000+ (7+3) #4 = 4000440 b) Refer to Question No. 1(2" Part) of Short Answer Type Questions. 13. What is the default return type of malloc( )? Why do we need to typecast it? [WBUT 2016] Answer: ye malloc retums a void pointer (void *), which indicates that it is a pointer to a region of unknown data type. ‘The (char*) or (int*) is an explicit type conversion, converting the pointer returned by malloc from a pointer to anything, to a pointer to char or integer. This is unnecessary in C, since it is done implicitly, and it is recommended not to do this, since it can hide some errors. 14.1f T(n) =a, +a,x+0,x +a’ +...+0,2", then prove T(n)=(x") {WBUT 2017] Answer: To prove that f{n) = @(g(n)) we have to find cl, c2 > 0 and no such that 0 < cyg(n) < f{n) < exg(n). Now cy andey are two valid constants for n=>ng: anise d)a Scanned with CamScannerwhere Hence proved. aziz} 1. Write short note on Abstract Data Type. (WBUT 2012, 2015] Answer: Refer to Question No. 6 of Short Answer Type Questions. 2. Define pseudo-code. [MODEL QUESTION] Answ Actual purpose of using pseudo-code is that it is easier for humans to understand than conventional programming language code, and that it is an efficient and environment- independent description of the key principles of an algorithm. Pseudo-code is an artificial and informal language that helps programmers develop algorithms. It is a "text-based" detail (algorithmic) design tool. Pseudo-code is a compact. and informal high-level description of a computer programming algorithm that uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. Pseudo-code typically omits details that are not essential for human understanding of the algorithm, such as variable declarations, system-specific code and subroutines. Examples: 1. If student's grade is greater than or equal to 80 Print "passed" _ else Print "failed" 2. Set total to zero Set grade counter to one While grade counter is less than or equal to ten Input the next grade Add the grade into the total Set the class average to the total divided by ten Print the class average. 3. Initialize total to zero Initialize counter to zero Input the first grade while the user has not as yet entered the sentinel add this grade into the running total { add one to the grade counter | DSA-11 Scanned with CamScannerPOPULAR PUBLICATIONS: Multip’ 1. A linear list in which elements can be edded or removed at either end but not tthe middie is known (WBUT 2007, 2008, ee 2) queue b) deque o) stack d) tre Answer: (b) ia 2. The prefix expression for the infix expression a*(b+e)/e-fls [WBUT 2008] a)Pesbe-of — byPeabeet —c)-Pas beet —d) None of these Answer: (2) ‘3. The number of etacks required to implement mutual recursion Is [WBUT 2011] a3 2 ot d) none of these Answer: (c) 4. Priority queue can be implemented using (WBUT 2011) a) array b) linked list c)heap d) all of these Answer: (¢) §. Reserve Polish notation is often known as wour 2012) 2) infix b) Prefix ©) Postfix, 4 none of th Answer: (c) f 6. The evaluation of the post expression [WBUT 2012] 3,5,7,°,4,12,% = a2 5 3 <0 43.7 i Answer: (2) 7. The operation for adding an entry to a stack is traditionally called [WBUT 2013] a) Add b) Append ¢) Insert d) Push - Answer: (d) 8. The best data structure to evaluate an arithmetic expression in postfix form is [WBUT 2013] 2) Queue b) Stack o) Tree ) Linked List Answer: (b) 9. The heap (represented by an array) constructed from the list of numbers 30, 10, 80, 60, 15, 65, 17 is - [WBUT 2014] 12) 60, 80, 5, 20, 10, 17,15 ) 80, 55, 60, 15, 10, 30, 17 4 ) 80, 60, 30, 17, 85, 15,10 4) none of these 3 “Answer: (b) 40. The postfix equivalent of the preix*+ ab~cd is (WBUT 2014, 2046, 2016, 2019] a)ab+cd-* b)abed+-* c)abt+ed*- d)ab+-cd*" 4 Answer: (a) % DSA-14 Scanned with CamScannerLi 1M 11, The following sequence of operations is performed on a stack: push (1), push (2), pop. push (1), push (2), pop, pop, pop, push (2), pop. The sequence of popped are [WBUT 2014, 2019] 244442 0)2,2,4,2,2 ©) 2,1,2,2,4 )2,1,2,2,2 Answer: (a) 42, Stack cannot be used to [weurt 2015) a) evaluate an arithmetic expression in postfix form b) Implement recursion ¢) allocate resources (like CPU) by the operating system 4) convert infix expression to its equivalent postfix expression ‘Answer: (c) 43. The following sequence of operations is performed on a stack _ [WBUT 2015] push(1), push(2), pop( ), push(t), push(2), pop), Pop«), Pop«), push(2), pop), the sequence of popped out values are a)2,2,4,2,1 b)2,2,4,4,2 €)2,1,2,2,2 )2,1,2,24 Answer: (b) : 14. The deque can be used [weUT 2016] a) as a stack b) as a queue c) both as a stack and as a queue 4) none of these Answer: (b) 15. Inserting an item into the stack when stack is not full is called ..... operation and deletion of item from the stack, when stack is not empty is called operation. [WBUT 2017] 'b) pop, push ¢) delete, insert Answer: (a) 46. To make a queue empty, elements can be deleted till (WBUT 2018) a) front = rear +4 b) front = rear—1 ¢) fron 4d) None of these “Answer: (a) 17. Which among the following are applications of queues? [WBUT 2019) a) Queues keep track of events waiting to be handled, like multiple button clicks b) Queues are used for evaluation of arithmetic expressions ¢) Queues are used in parsing d) None of these Answer: (a) DSA-IS ‘Scanned with CamScannerPOPULAR PUBLICATIONS 4. 8) Convert the following infix expression into equivalent postfix expression using stack: (A+ B)*C-(D-E)I(F 4G), {WBUT 2009, 2010, 2016) b) What is 8 Max Heap? (WBUT 2009) Answer: a) a / Symbol scanned | _ Stack Output { ( see : A ( A . . A a ‘ AB H : ‘ABE : = AB+ c - [ABC 7 E ABC t < ‘ABC i D 4 ABCD | 5 za ABCD E (- ABHC’DE ) = ‘ABYC'DE- ! 1 ‘AD+CDE- “I ‘ABIC*DE- E il ABCDEF + ole ABYCDEF c ie ABYC'DE-FG ) saecram| el ABHC'DE-FG+ NONE EMPTY ABCDE-FGH- b) A heap is a tree-based data structure that satisfies the heap property: if B is a child node of A, then key(A) > key(B). This implies that an element with the greatest key is always in the root node, and so such a heap is sometimes called a max-heap. 2. What is a priority queue? [WBUT 2009, 2012, 2013, 2019) Mention the different design options for priority queue. [WBUT 2008) Answer: : ‘A priority queue is essentially alist of items in which each item has associated with it a priority. In general, different items may have different priorities and we speak of one item having a higher priority than another. Given such a list we can determine which is the highest (or the lowest) priority item in the list. Items are inserted into a priority queue in any, arbitrary order. However, items are withdrawn from a priority queue in order of their priorities starting with the highest priority item first DSA-16 ‘Scanned with CamScanner} DATA STRUCTURE & ALGORITHM | Two elements with the same priority are processed according to the order in which they i were added to the queue, ' ‘Often a type of binary tree called a heap is used to store the items in a priority queue. A et heap has a root node (usually draw at the top) and it has two children, a left child and a | right child. Each node (parent, and left or right child) has a value associated with it, with the property that the parent's value is more than either of its children. When we add an a item to the heap we check to sec if the parent's value is more ot less than it. Ifit is more, then we swap the child with the parent. We check again, and maybe swap again, until the tree is "balanced," (I.c. that it obeys the heap property). | There are some other methods of implementing priority queue which are not so efficient. They are | | Sorted list implementation: 0 Unsorted list implementation: Keep a list of elements as the queue. To add an element, | append it tothe end. To get the next element, search through all elements for the one with saat the highest priority. 1a 1] 3, Define dequeue? [WBUT 2010] i | OR, What Is dequeue? Z (WBUT 2015) | Answer: : a Dequeue is a linear data structure, where insertions and deletions are made to or from i either end of the structure, | 4. Convert the following Infix expression to postfix notation by showing the | operator stack and output string after reading each Input token: j A*B+C*(D-E)-F*G [WBUT 2014] { Answer: i ‘Symbol se Stack Output : ! i A =Jo)-]=] [> ; zlo] [=]: t ONE: NONE ‘ABYCDE-"FG*+ DSA-17 Scanned with CamScannerPOPULAR PUBLICATIONS 5. a) Consider the array int & [10} [10] and the base address 2000, then calculate the address of the array a [2} [3] in the row and column major ordering. [WBUT 2012] Answer: In row major ordering the linear offset from the beginning of the array to any given clement A[row [column] can then be computed a8: offset = row*NUMCOLS + column Thus a[2][3] will have address = 2000 + 241043 = 2023 In column major ordering the memory offset could then be computed as: offset= row + column*NUMROWS ; Thus af2][3] will have address = 2000 + 243°10 = 2032 i 'b) Write the advantage of circular queue over linear queue, [WBUT 2012] Why circular queue is better than simple queue? " DWBUT 2016) OR Why circular queue is used over simple queue [WBUT 2017) What is the necessity of having circular queue? [WBUT 2019] Answer: ‘ ‘ Refer to Question No. 5 of Long Answer Type Questions. 6. Evaluate the following postfix expression: [WBUT 2013] 4,5,4,2, 0642.2, 0,9 5h% Write pseudo code for evaluating postfix expression. ; 2" Part: Refer to Question No. 2 of Long Answer Type Questions. Fis 7. How many types of priority queues are there? Can you consider stack as a Ke priority queue? If yes, how? [WBUT 2013) Answer: £ i Mainly there are two kinds of priority queue: 1) Static priority queue 2) Dynamic priority queue. DSA-18 Scanned with CamScanner‘DATA STRUCTURE & ALGORITHM stack can be considered as a priority queue where the priorities of each element being inserted ate considered higher than the previous one. This will let it behave e like a LIFO structure (i.¢., stack). 8, Suppose a quer implemented by an array. Write an algorithm to insert a new ‘olement at the kth position of the array. (WBUT 2015] Answer: static int head, tail; // Declare global indices to head and tail of queue static char theQueue(MAX SIZE] ; // The queue WV 7 // Function: Initqueue() // Purpose: Initialize queue to cmpty. // Returns: void We void InitQueue() { : head = tail = -1; } M- // Function: Enqueue() // Purpose: Enqueue an item into the kth position of queue. // Returns: TRUE if enqueue was successful " or FALSE if the enqueue failed. int Enqueue(char ch, k) int ¢; WJ Check to see if the Queue is full if(isFull()) return FALSE; d/ Increment tail index tailes; for (c = MAX SIZE - 1; ¢ >= k - 1; €--) array(c+1) = array(cl; array[position-1] = ch; i return TRUE; §. Wee the algorithms for PUSH and POP for linked representation of stack, RUT 2019) Answer; Refer 0 Question No.6 of Long Answer Type Questions. Scanned with CamScannerPOPULAR PUBLICATIONS LINKED LIST ——— © Chapter at a Glance pat stadeliaahthatintatht © Singly linked lists: A linked list is a data structure where data can be represented as a chain, ‘of nodes. Each node of a linked list contains two parts: one is the address part another isthe data part. The address part holds the address of the node which is next to or previous to the current node. ‘Typically the first node ofa linked lis is called the HEAD node, Ifthe head node is then the entire list pets destroyed as well. Depending on the traversal requirement a linked list ‘can be designed as circular, bi-directional etc. In it's simplest form the following diagram, ‘shows the structure of a uni-directional linked list also known as singly linked list. Several operations: (Insertion, deletion, Traversing Searching) ‘Insertion: The algorithm for insening in the above manners given below: Let ws assume that xis dt ale tobe inset afer the ode contin the data value y,p initially contains the address of the head node. ‘Step I: start traversing the linked list from the head node Step 2: if the date value ofthe head node is not equal to y goto step 8 Step 3: create a new node ‘Step 4 place x to the data field of the new node Step $: place the next address of the head node tothe next address ofthe new node Step 6: change the next address of the head node by the new node address Step 7: Goto Step 13 ‘Step 8: Identify the address of the node containing data value y as follows Step 2) ifthe data value of the next node of pis equal toy” Step 8b) else change p by its next node address Step 9: create a new node Step 10: place y tothe data field of thenew node =, Step 11: place the next address of p node tothe next address of new node Step 12: change the next address ofthe p node by the new node address ‘Step 13: End ‘ © Circular linked list: the circular linked list, the adress of the last node contains the address of the first node, as shown in the figure below: 20 2050 4000 3050 1}—-2 Ti} T} © Doubly linked list: The node of a doubly linked list contains two link fields, instead of one. ‘One link is used to point to the predecessor node, i.e, the previous node & the other link is used to point to the successor node, i.e., the next node. So, the two links are directed, one ‘towards the front and another towards the back. 2000 2050 4000 DSA-32 Scanned with CamScannerDATA STRUCTURE & ALGORITHM + Linked representation of polynomial In gener ary poll A(x) can be written as ip eran, ; , where x is variable, a i its coefficient & e is the exponent. If a,=0, then the term is zero term, otherwise it is nonzero term. Multiple Choice Tyy tions 4, In a circularly linked fist organization, insertion of a record involves the modification of [WBUT 2008, 2018] a)no pointer —_—b) 4 pointer ¢) 2 pointers 4) 3 pointers Answer: (c) 2. Linked list are not suitable for [WBUT 2012, 2016] a) Stack. b) Deque c) AVL Tree d) Binary search Answer: (4) 3. Dynamic memory allocation use [WBUT 2012] a) Calloc b) Malloc ©) Free d)all of these Answer: (d) 4. Which type of linked List contains a pointer to the next as well as previous node inthe sequence? : [WUT 2013] 2) Singly Linked List b) Circular Linked List ¢) Doubly Linked List d) All of these Answer: (c) 6. Linked list is not suitable data structure for which one of the following problems? b) radix sort ee a) Insertion sort 4) polynomial addi a ech 1) polynomial addition Answer: (c) din defining 6. Self-referential pointer Is use b) a node of linked-list Beet 2054 4 anaray d) all of these qi Answer: (4) 7.Inserting anode after a given node ina doubly linked list rei, UT 2016, 204 a) four pointer exchanges 3 ba ee changes 8) ¢) one pointer exchange iain Answer: (b) ossible for WBUT 204 8 Bln sarch isnot pore lit ¢) stack @) queue 7 Answer: (b) iat) DSA-33 Scanned with CamScannerPOPULAR PUBLICATIONS ; (weut 8. Atnear ink st can be traversed USI°@— uy) and(c) aro correct 2017) ‘I a 4) both (a) and (c) are wrong ¢) stac Answer: (a) i 8 10. The data structure used to solve recursive onl . 4) rome 2) Linked list —_b) Queue i we Answer: (c) . al a ae] 14. Linked listis a jedata aches UT 2049) a) Linear data structure Borer ) Self referential data structure gal Answer: (4) 12, One limitation of linked list is 2) it requires huge memory space b) it requires contiguous memory space ) nodes can only be accessed sequentially ¢) nodes can only be accessed randomly | | (WELT 2019) Short Answer 41. Write an algorithm to add two polynomials. (BUT 2007) Answer: Let us assume that the two polynomials are represent is also using a linked lst. : ; Let pheadl, phead2 and phead3 represent the pointers of the three lists under consideration. Let each node contain two integers: exp and coff. _ Let us assume that the two linked lists already contain relevant data about the two polynomials. ‘ v ‘Also assume that we have got a function append to insert a new node at the end of the giver list. 4 pl =pheadl; | pl = phead2; | o Let us call malloc to create a new node p3 to build the third list Y ; p3 = phead3; a og /* now traverse the lists till one list gets exhausted */ ‘ | while ((p1 != NULL) || (p2 = NULL) oy ed using linked list and the resultant i 7 1'* if the exponent of pl is higher than that of p2 then the next term in final list is going to be the node of pl* / ig while (pl ->exp > p2-> exp) * if : > DSA-34 3h a Scanned with CamScannerp3 -> exp = pl -> exp; i 3 -> coff = pl -> coff ; ie append (p3, phead3); ay |} /* now move to the next term in list 1*/ } pl = pl -> next; ) y 1 * if p2 exponent turns out to be higher than make p3 same as p2 and append to final iW list */ i while (pl ->exp < p2 -> exp ) | t j p3 -> exp = p2 -> exp; i | p3 -> coff = p2 -> coff ; ‘ append (p3, phead3) ; an = p2 -> next; ) A J* now consider the possibility that both exponents are same , then we must add the al coefficients to get the term for the final list */ Wl while (pl ->exp = p2 -> exp ) { p3-> exp = pl-> exp; p3->coff = pl->coff + p2-> coff ; append (p3,. phead3) ; a * pl = pl->next ; 4 p2 = p2->next ; ‘ie ) ) /* now consider the possibility that list2 gets exhausted , and there are terms remaining only in listl. So all those terms have to be appended to end of list3. However, one does | not have to do it term by term, as pl js already pointing to remaining terms, so simply 7 append the pointer pl to phead3 */ y if ( pl != NULL) append (pl, phead3) ; 4 else ” | append (p2, phead3); 2. What are the advantages of linked list over an array? * [(WBUT 2008] } Write an algorithm to insert a data X after a specific data item Y in a linked list. } [WBUT 2008, 2016, 2018) i 4 Answer: | 1 Part: ig The advantages of linked list over an array are: if Refer to Question No. 4 of Short Answer Type Questions. : i | 2 Part: Assuming the linked list already contains n integer elements. The — to insert a data X after a specific data item Y in a linked list is as follows: node *insertXafter¥(node *p, int y, ‘int x) DSA-35 Scanned with CamScannera= r = (node*)malloc (sizeof (node) ); while (p->next != NULL) =P: if (p->data == x) . break; [WBUT 2010, 204 Answer: We can represent the polynomial by a linked lst, where each node contains deg, coef and 2 pointer to the next node. So, the diagram will be as follow: Gl tha-te Pes array? Answer: _ 5 Linked list advantages over array a 1, Linked lists do not need contiguous blocks of memory; extremely large data stored in an array might not be able to fit in memory. i 2. Linked list storage does not need to be preallocated (again, due to arrays needi ‘contiguous memory blocks). 3.- Inserting ot removing an element into a linked list requires one data update, inserting or removing an element into an array requires n (all elements after the modified ind need to be shifted). Linked list disadvantages over array: 1. Arrays have contiguous memory allocation which makes it easy to access elements between. # 2. As memory is allocated during compilation makes the program faster 3. Fixed in size so if we ae avae ofthe exact size of datas then there can be no memory wastage which is also an advantage linked list has. DSA-36 Scanned with CamScannerDATA STRUCTURE & ALGORITHM ii 4, Insertion and deletion at the end of the array is easy but not in between. 5 Accessing data is easy, Example, a(2) | | | | 5, Write a C language function to delete nth node of a singly-linked list. The error | conditions are to be handled properly. (WBUT 2044] , ‘Answer: struct node* DeleteNode(struct node* head, int n) { struct node* temp = head; i int length = LinkedListLength(temp) ; a int i; i if(n <= 0 |[ n> length){ printf ("ERROR: Node does not exist!\n" jelse( if(n == 1)( head = head->next; //move from head (1st node) to second node Jelse{ for(i = 1; i < n-1; ++i){ //move through list temp = temp->next; } | temp->next = temp->next->next; a ) | ) : j return head; | ) : | 6. a) How the polynomial 4x’ ~ 10x? +3 can be represented using a linked list? b) Compare and contrast between an array and a single linked list. [WBUT 2012) ‘Answer: 1) We can Fepresent the polynomial by a linked list, where each node contains deg, coef | and a pointer to the next node. So, the diagram will be as follow:. Cle[}{2hy bf] p> b) Refer to Question No. 4 of Short Answer Type Questions. yy 7. What is a self referential structure? ” ooo [WBUT 2012] Answer: ¥ A self-referential structure is one of the data structures which refer to the pointer to (points) to another structure of the same type. For example, a linked list is supposed to be a self-referential data structure. The next node of a node is being pointed, which is of the ‘same struct type. For example, typedef struct listnode ( void *dal struct listnode ‘next; ) linked_list; DSA-37 Scanned with CamScannerPOPULAR PUBLICATIONS In the above example, the listnode is a self-referential structure ~ becauise the *next is of the type sturct listnode, 8. Write an algorithm to find the largest and smallest element in a single linear list. [WBUT 2014) Answer: Linked List definition in C: typedef struct linked_list ( int data; struct linked_list ‘next; ) Nodes ‘Code to find largest and smallest elements. // finds the largest and smallest in the list . // assumes that head pointer is defined elsewhere ‘ype int MaxMinInbist(int *nax, int ‘min) t { J/ start at the root Node *currentNode = head; if (currentNode == NULL) return 0; // list is empty // initialize the max and min values to the first node ‘max = ‘min = currentNode->data; Jf loop through the list for (currentNode = currentNode->next; currentNode != NULL; currentNode = currentNode->next) { ‘ if (currentNode->data > *max) ‘nax = currentNode->data; else if (currentNode->data < ‘nin) é ‘min = currentNode->data; * 3 J // we found our answer return 1; ) 4 ve ‘9. Write an algorithm to delete the last node of a linked-tist. Answer: C function to delete last node is as given below: Je vette, i aa struct node *delete(struct node *head) “ { < 2 struct node *temp =head; struct node *! if (head->next==NULL) 5 { ' free(head); head=NULL; : Scanned with CamScannerelse ( , while(temp->next {= NULL) ( tstemp; ., temp-temp->ne ) free(t->next) ; t->next=NULL; ) return head; , 40. Write an algorithm to insert an element in the middle of a linked list. [WBUT 2015) ‘Answer: Node Structure for Singly Linked List: struct node ( int data; struct node ‘next; jstart = NULL; Insert node at middle position : Singly Linked List void insert_mid() ( int pos,i; struct node *new_node, *current, *temp, *templ; new_node=(struct node *)malloc(sizeof (struct node)); print£("nEnter the data: * scanf (*8d", &new_node->data) ; new_node->next=NULL; st: fi printf (*nEnter the position scanf (*8d", &pos) ; if (pos>=(1ength()+1)) { printf("nError : pos > length * goto st; “apibearteemmnny “MPR ‘ start=new_node; current=new_node; } else { temp -= start; for (i=1;i ( Scanned with CamScannerPOPULAR PUBLICATIONS temp = temp->next; } tempi=temp->next; temp->next = new_node; new_node->next=temp1; d d 11, What is the difference between array and linked-list? [WBUT 2015) Answer: ‘The primary difference between an array or ArrayList and a linked list is that the array or ArrayList permits random access into the list structure using a subscript; each data item has a “named” storage location (named by the subscript). In contrast, with a linked list all focations are relative to the next or previous locations. With an array or ArrayList, we can access the 10 data item, say, with one probe to subscript 9 (indexing zero-up). With a linked list, we cannot access the 10" item without first traversing the first nine items, ‘Searching through a linked list is thus inherently a sequential process. On the other hand, because all locations are relative, additions and deletions to a linked list can be made without affecting any of the data items already stored in the list. insertions and deletions require only that the next and previous pointers be changed exactly 2s needed; no data needs to be moved. When a deletion takes place, no hole is left. The deleted node becomes unused memory. 12. Show how linked list can be used to add the following polynomials: Sx! +5x° +100? 48x43 [WBUT 2016) 3x5 +22? +7248. Answer: Let us assume that the two polynomials (p1 and p2) are represented using linked list and the resultant is also using a linked list. Let each node contain two integers: exp and coff. The two linked lists already contain relevant data about the two polynomials. We will create a linked list lst3 (p3) with 2 single node to begin with. Steps: We traverse the lists tll one list gets exhausted 1) if the exponent of pl is higher than that of p2 then the next term in final list is going to be the node of pi 2) iff p2 exponent tums out to be higher than make p3 same as p2 and append to final list 3) now consider the possibilty that both exponents are same, then we must add the coefficients to get the term forthe final list 4) now consider the possiblity that list2 gets exhausted , and there are terms remaining only in list. So all those terms have to be appended to end of list3. The final so'ution would be 5x4 + 8x’3 + 12x"2 + 15x + II based on the above algorithm. : DSA-40 Scanned with CamScannerDATA STRUCTURE & ALGORITHM 43. How a polynomial such as 8x° + 4x’ -9x" +2x-17 can be represented using a linked list? What are the advantages and disadvantages of linked list over an array? {WBUT 2017] Answer: 1" part: We can represent the polynomial by a linked list, where each node contains deg, coef and a pointer to the next node, So, the diagram will be as follow: 4518 33]5> 2-99 11290/-17 2" part: Refer to Question No. 4 of Short Answer Type Questions. 44, Compare and contrast linked list with static and dynamic array. [WBUT 2018] Answer: In contrast, linked lists are dynamic and flexible and it can expand and contract is size. In , an static array, memory is assigned during compile time. While in a dynamic array and a linked list, it is allocated during execution or runtime. Elements are stored consecutively in arrays whereas it is stored randomly in linked lists. Compare: 1. An array is the data structure that contains a collection of similar type data elements whereas the linked list is considered as non-primitive data structure contains a collection of unordered linked elements known as nodes. 2. Accessing an element in an array is fast, while linked list takes linear time, so it is quite a bit slower. 3, Arrays are of fixed size. Linked lists are dynamic and flexible and can expand and contract its size. 4, In addition memory utilization is inefficient in an array. Conversely, memory utilization is efficient in the linked list. 45. How can the polynomial 4x° +7x° +2 be represented using a linked list and an array? Also explain why arrays should not be used in this regard. [WBUT 2019] Answer: ‘We can represent the polynomial by a linked list, where each node contains deg, coef and a pointer to the next node. So, the diagram will be as follow: 6 [43733029 é Using array for polynomial operations will consume a lot of space. ‘For solving polynomial equations, you need to have'two parallel data structures. Index of both the data structures move forward to perform the desired operation. DSA-41 Scanned with CamScannerTREES & Chapter at a Glance ia © Tree: A tree isa finite set of one or more nodes connected by edges such that a) There isa specially designated node called the root 4 ii) The remaining nodes are partitioned into n (>=) mutually exclusive disjoint sety © Basic Terminology: ea 4) Node: Each data item in a tre is called a node. I specifies the data information jg (branches) to other data items. Inthe example of Fig(I)the tree has 13 nodes, lik i Root: Its the parent of al eher nodes of ate. Act node docs not have any paren, | fi) Degree ofa node: The number of sub ress of a node is called its degree. I oUt examyy the root node has thee sub ees (B,C, D). Hence, the degree of the root node A is 3 peelt of Bis 2 Degree of Cis 1. And soon, oe fv) Degree of « tre: iis the maximum degree of nodes ina given tee. In our example root node A has the highest degre. Hence, the degree ofthe tee is 3. : ¥) Terminal nodts):& node with degre zi led a tena nodes) o leaf nod external node(s). In our example E, F, G, | are leaf nodes. og vi) Non Terminal node(s): Any node whose degre isnot zero is called non-terminal cor internal nodes or interior noda(s). In our example A, B, C, D & H ate the none, node(). a vid Path: isa sequence of coseoive ees fom the source node to the destination mn In our example the path between A & Lis given bythe edges (A, D)(D, H) & (H, 1), # Binary tree: A binary wee is ether empty or consists of one single vertex called the ro together with two disjoint binary tres called IeR sub-tee & right sub-tree. Number branches of any node is either zero or one o a most two. : Binary search tre: A binary search tre (BST isa binary re that is either empty or every. data node that forms the tre satisfies the fllowing conditions. i) The data inthe left child ofa node is es than the data in its parent node, ii) The data inthe right child ofa nodes greater than the data in its parent node. The left and right subtrees ofthe root are also binary search trees. The fig. show below Binary search tree. (%) @ ® 4c GS % @) © Threaded Binary tree: In linked-list representation of binary trees, additional storage s is required to store the two links of each node. The null pointers just results in w values called threads. DSA-46 Scanned with CamScanner1. Ifa binary tree Is threaded for in-order traversal a right NULL link of any node is replaced by the address of its PYEUT 2007 a0) a) successor b) predecessor ¢) root Jew | Answer: (a) | 2.[n a height balanced tree the heights of two sub-trees of every node never differ by more than [WBUT 2007, 2009, 2018] a) 2 bo on ae E Answer: (¢) 4. Maximum possible height of an AVL Tree with 7 nodes is IWBUT 2008, 2013, 2016, 2018] a3 bys os Me ‘Answer: (a) tree i ie 4, 7 ‘awaye balanced » ian ordeccd rats 2008, 2018) c) A direct tree ) All of these . Answer: (d) 5. In array representation of Binary tree, if the index number of a child node is 6 dex number of its present node is etd oc aa index ni 93 aA an “3 Answer: (d) th n nodes 6. The depth of a complete binary tree witl a a)togtnt yt by log (n) ¢) log(n-t}+4 fa 2) Answer: (a) 7. In a binary search tree ifthe number of nodes of a tree is 9, then the minimum height of the tree Is (weur 201 7 ms 4 4) None of thea Answer: (4) aa ae a Vinien method of traversal does not stack to hold nodes that are waiting to be processed: b) Depth - first DwBUT 2012} ; Breadth frat 4) None of these Answer: (a) 9. Which of the following is essential for converting an infix expression to the Postfix expression efficiently? byAhOpermd atack (WUT 2013) a) An operator stack k dA t 7 ¢) An operand stack and operator stack 4) A parse tree Answer: (a) DSA-47 —_— Scanned with CamScannerPOPULAR PUBLICATIONS - (WBUT 2 10. Number of all possible binary trees with 4 nodes: is a) 15 1 2) yr ae Answer: (c) re 411. Ifthe inorder and preorder traversal of a binary 00 Oe int trae igh 2 A.B,D,EF,G, hen the poston MADEGABCHE WF HDS ERG, wane CC.GHLFL ELBA OO e | Answer: (4) } ~ 42, The number of possible distinc binary trees with 12 nodes Is soe Pa a) 4082 ) 4084 3082 ' Answer: (b) 5 in this 43. A binary tree has " leaf nodes, The number of nodes of degree 2 TWSUT ap, es . od d) cannot be aaig Answer: (é) a 44, The minimum height of a binary tree of n nodes Is (WBUT 2016) oe a cyn2-2 4) log,(n+1) Answer: (@) 15. The number of edges in a full binary tree of height / is (WBUT 2017) d) 2-2 a) 2-1 b) 2-1 2! Answer: (c) 16. Minimum number of nodes required to make a complete binary tree of height h is [WBUT 2017] _ a) 2*-1 b) 2 oy 241 @) 2" Answer: (b) : 17. Which one is required to reconstruct a binary tree? (WBUT 2017) 2) Only inorder sequence b) Both preorder and postorder sequences ¢) Both inorder and postorder sequences d) Only postorder sequence Answer: (c) 18. Number of nodes in a complete binary tree of depth kis “[WBUT 2018) a) 2 b) 2k c) 2-1 d) None of these Answer: (c) 18. A full binary tree with n non-deaf nodes contains (WBUT 2019] a) log 2n nodes _b) n+4 nodes ¢) 2n nodes d) 2n+1 nodes Answer: (d) DSA-48 Scanned with CamScanner4, Construct the expression tree for the following expression: [WBUT 2010] E=(2a+5b)(x-7y)' Answer? 2. Write an algorithm for non-recursive in-order traversal ofa threaded binary tree. (WBUT 2011, 2018] Answer: ‘Step-1: For the current node check whether it has’a left child which is not there in the visited list. If it has then go to step-2 or else step-3. Step-2: Put that left child in the list of visited nodes and make it your current node in consideration. Go to step-6. Step-3: For the current node check whether it has a right child. If it has then go to step-4 else go to step-5 Step-4: Make that right child as your current node in consideration. Go to step-6. Step-5: Check for the threaded node and if it’s there make it your current node. Step-6: Go to step-I if all the nodes are not over otherwise quit 3. Write aC language function to find the in-order successor of the root of a binary “ [WBUT 2011] Answer: Let the structure of any node be and let d be the root node. struct Node ( int data; Node* lptr; —_// pointer to the left subtree }, Node* "ptr; // pointer to the right subtree Node* successor (Node * a) DSA-49 Scanned with CamScannerreturn Below ae two firctions — fins one to find out the minimum key in the binary tree and the second one to find the inorder successor of the root which uses first function. Bode *treesinim= (Node *roct, Bode *nil) ¢* returns e pointer to the sinimm key in a NONEMPTY tree */ wéile (roct->left Foot->lef retam(roct): nil) i Sede *treeszccessor (ode *roct, Sode *nil) { s* vetoms pointer to inorier successor of root, and to Aq nil if root is the meximm of the tree. This code ? assmmes that root != nil. */ ; Bode *treeninin= (lode *, Bode *); Bode *y: if (zoct->right != nil) » retam (treeninioe (root-sright,ni1)); roct-sperext; £& root = yoricht] s et; i . DSA-50 Scanned with CamScannerDATASTHUSTUZE Ue AUAPTIE 4, Virite an algorithm ty test whether a gi er, binary tree is a binary search tree. [W2UT 2014} Ane The «lution is 10 checy. for every node ir he tree, the min and max key valves of the nits Jeft sub tree is fess than the valu: fits key and the min and max key values nod.> jn its right sub tree is pr ster than the value fs key. This can be achieved by recursion. ‘The idea is to “bubble up” the min and mz . values of a node's oub tree, after satisfy the co idit'ons above, tu ts parent node, » «! will in turn repeat the tame process. The algorithm is designed xound pre-order tz “raversal and wolves the problem in Ofn) ithm for the curr.at node: Get the min and ss values forleft > reeif eft child exists “Af we min and n+ values are grea: ¢.¢ equal to current node's key, retum “Not BST Step 3:NE is no lef. .\.iid, set the min {0 current node’s key value Sep 4° Get the i values for rig! ~ > tree if right child exists Sty equal to current node's key, rctum “Not BST” Step ¢: Mf there is no ri, it sub tree, set the m1 value from step 1 and the max value to ‘current node's key value Step 7: Return the min uz from step 1 ar ‘rx value from step 6 5, Write an algorithm to left rotate a bina tee. {weaur 2011] ‘Ans Input: A binary wee w (may be 2 subtree of larger tree). Ouput: A (n2%) binary rez obtained from « t. performing a left rotation about uw. If wis empty or has an empty right subtree, an emjsy ree is returned. Algorithm: Bint se rovuteLefi Bin: =u) if ( u = nil o r-zhuSubtree(u)=11) return. v= rightSubtree retara buildTre rightSubtree(v) « Tree u, lefSubsree(v) lefSubtreetsu)) y: 6. What is binary trec” Construct a bi: :r, tree using the Inorder and Postorder traversal of the node g «: an below (WBUT 2012} Inorder: jee A GjCiLIJIHIK Postorde [DF 'E1BIG L{JIKIHICIA Answer: 1" Part: A Binary tree is either er 7:3 or consists of ac single vertex alled the root, together with two cisjoit binary tres called left subtree & sight subuee Number of branches of any node is either zero or on. or at most two. Binary tres are wed to implement binary scarch tres and binary heaps. DSi Scanned with CamScannerNo sr ners, we Gad A BE element if giving (G} vide the n see HR} aster Tris way Fal owes BR Ps ¢ t 7. Construct an AVL tree using the below lst. Show all the 15,16, 48, 7,654 Answer: The steps are as shown below? x. DBFE is the le child ang preorder ie. C. We Seright subtree and {Ly steps 12, 14, 13, 10, 09, (WBUT 2012, 2015) Scanned with CamScanner8. Prove that the maximum no. of nodes in a binary tree of depth k Is 2-1. (weUT 2014) Answer: The maximum number of nodes in a binary tree in level i is 2i (according theorem). Hence the maximum number of nodes:in a binary tree of depth k is , summation of maximum number of nodes from level 0 upto level k— 1, Le, eI J a2 DED Et 8 . -2(Z2) fe (e-te-n)] =2'-1 9. For the following expression draw the corresponding expression tree: atbtc-dle {WBUT 2015} Answer: DSA-53 Scanned with CamScannerPOPULAR PUBLICATIONS 10. a) Does a B tree grow at Its leave or atts root? Why? wa b) In deleting a key from a B tree, when its necessary to combine nodes? Answer: a) B Tree grows at its root (bottom up). B-trees are balanced search trees, design, work well on magnetic disks or other direct-access secondary storage devices, In tree, new nodes are inserted into the leaf level however, ifthe B-tree must increase height itis the rot level otp ofthe tree that changes, This automatically preseryeg balance of the tree and no rotation is necessary. ‘i UT 2o4g) by If 2 node has the minimum number of keys, then deleting a key from the node wi cause an underflow and it would violate the B Tree property. It needs to be merged 4 another node to fix the B Tree back. i ‘11. The post-order and in-order traversal sequences of codes in a binary tree arg given below: % Post-order: D GEBHIFCA Pre-order: DBGEACHFI * 4 Construct the binary tree. . : [WBUT.2016) Answer: : Assuming in-order is given instead of preorder 1) We first find the last node in post-order. Te last node is “A”, we kriow this'vaie is root as root always appear inthe end of postorder traversal. 2) We search “A” in in-order to find left and right subtrees of root, Everything on left of “A” in inorder isin left subtree and everything on right is in right subtree, i : a PEGA cH 3) We recur the above process for two subtrees. 7 ~ 8 NEN D E F fs fash t + eed 12, Construct one B-Tree of order 4 with the following data. 34, 67, 89, 90, 100, 2 . 36, 76, 53, 51, 12, 10, 77, 69. : [WBUT 2016] Answer: After inserting 34, 67, 89 Scanned with CamScannerafter inserting 90 [oom JLo ] After inserting 100 acai [= [or oo] After inserting 2 Scanned with CamScannerPOPULAR PUBLICATIONS After inserting 12 13. Construct a tree from the given postfix expression abc* +de" f+ g¢+ y [WBUT 2016) | Postcode traversal: abe*+de*+g*+ 14. The inorder and preorder tree traversals are given. Draw the Inorder: ABCDEFGH! Preorder: FBADCEGIH Is it possible to build up a unique binary tree when its preorder and postorder traversals are given? DWBUT 2017] Scanned with CamScanner<< at Q (2 © @) (0) S © apt part: Refer f0 Question No. 12(5) (1" Part) of Long Answer Type Questions. rt the following keys into a B-T; a ia Amine oan of given order mentioned below: a, 9, f,b, ks di hy m,J,e,8,1,1,x,¢,1,n, tu, p. (Order §) (WBUT 2018] Answer 7 ; 1 part: vee ion of B-tree: (of ordér3) pf bkhMesne 7 7 : ac ‘ats k GI CI: h [«] i>, far f~) Co Me i cal Le JLJLe DSA-5S7 Scanned with CamScanner2 Part: 1 age: The insertion steps are shown in the figure below: 2 eat Scanned with CamScanner16. What is expression tree? Draw the expression tree and write the In, Pre & Post- Order traversals for the given expression tree: E = (2x +y) (Sa—b)’. [WBUT 2018] Answer: 1" Part: An expression tree is a representation 1 of express ions arranged in a tree like data structure. It is a tree with leaves as operands of the expression and nodes contains the operators. i" Data interaction is also possible in an expression tree. art: Refer to Question No. 2(a) of Long Answer Type Questions. Long Answer Ty; 1. Write an algorithm to insert a node in a binary search tree. [WBUT 2007, 2014] Answer: Implementing binary search tree, We assume that a tree node has left and right pointers and a key element. SearchTree Insert( ElementType X, SearchTree T ) if( T == NULL ) C /* Create and return a one-node tree */ T = malloc( sizeof( struct TreeNode ) ); if( T ==-NULL ) FatalError( ‘Out.of space!!!* ); else nee a T->Element = T-sLeft = T->Right = NULL; else # DSA-59 Scanned with CamScannerPOPULAR PUBLICATIONS. GRAPHS _—_—_— = Chapter ata Glance * A graph is a mathematical tool used to represent a physical problem. It is also used to model networks, date structures, scheduling, computation and a variety of other et ‘where the relationship between the objects in the system plays a dominant role, ‘+ Types of graph: A graph often symbolized as G can be of two type 1, Undirected graph: where a pait of vertices representing an ed 2. Directed graph: where a pair of vertices representing an edge is ordered. + Graph Traversal: A graph can be traversed in two ways: Depth first search traversal: often analogous to pre-order traversal of an ordered tree. Breadth first search traversal:_ often analogous to level-by-level traversal of an ordered tree. ‘+ Spanning Tree: Given a connected, undirected graph, a spanning tree of that graph is a sub raph which is a tree and connects all the vertices together. A single graph can have many ifferent spanning trees. We can also assign a weight to each edge, which is a number. representing how unfavourable it is, and use this to assign a weight to a spanning tree by ‘computing the sum of the weights of the edges in that spanning tree, ‘© Shortest Path: In graph theory, the shortest path problem is the problem of finding a path between two vertices in a weighted graph such that the sum of the weights of its constitu edges is minimized sy ‘The most important algorithms for solving this problem are: Dijkstra's algorithm solves the single-source shortest path problems. Bellman-Ford algorithm solves the single source problem if edge weights may be negative, -A® search algorithm solves for single pair shortest path using heuristics to try to speed up the search. Multiple Choice estion: 1, The vertex, removal of which makes a graph disconnected is called [WBUT 200; 2) Pendant vertex b) bridge ©) articulation point 4) colored vertex Answer: (c) 2. A vertex of in-degree zero in a directed graph is called [WBUT 2007, 2018) a) articulation point b) sink : a c) isolated vertex . d) root vertex - Answer: (c) 3. Adjacency matrix of a digraph is [WBUT 2007, 2012, 2016) * a) identity b) symmetric . ¢) asymmetric 4) none of thes { Answer: (b) DSA-88 Scanned with CamScannerDATA STRUCTURE é ALGORITHM 4, Which data structure Is used for breadth first traversal of a graph? [WBUT 2008] a) Stack b) Queue : ¢) Both stack and queue 4) None of these Answer: (b) 6.Th ency matrix of an undirected graph is [waUT 2008, 2010) a) Unit matrix b) Asymmetric matrix ¢) Symmetric matrix d) None of these ‘Answer: (c) ‘ 6. BF [WBUT 2008] ‘Ss a) scans all incident edges before moving to the other vertex b) scans adjacent unvisited vertex as soon as possi ¢) Issamo ktracking d) none of these Answer: (b) 7. Anon-planar graph with minimum number of vertices has {WBUT 2008, 2018] a) 9 edges, 6 vertices b) 6 edges, 4 vertices c) 10 edges, 5 vertices d) 9 edges, 5 vertices Answer: (c) 8, Any connected graph with x vertices must have at least [WBUT 2009] a) x+ edges —_b) x-1 edges - ¢) xedges d)xi2 edges ‘Answer: (b) 9. Maximum number of edges in a n-node undirected graph without self loop is. [WBUT 2010) = I ae py 2er=)) en-2 4) ene) ‘Answer: (b) 10. BFS constructs [WBUT 2010, 2014, 2018] a) a minimal cost spanning tree of a graph b) a depth first spanning tree of a graph c) a breath first spanning tree of a graph d) none of these Answer: (a) 11. A complete directed graph of 5 nodes has... [WBUT 2011] as b) 10 ©) 20 4) 25 Answer: (b) : 42. A vertex with degree one In a graph Is called [WBUT 2012] a)leaf —_b) pendant vertex ) end vertex d) none of these Answer: (b) DSA-89 Scanned with CamScannerPOPULAR PUBLICATIONS UT 201: £2. Te implement DES which data etructure Is generafty used? qe O tees a} Stack b) Queve
Node A | Step 2 -> Node B | Step 3-> Node C | Step 4-2 Node F ‘Step 5-> Node G | Step 6-> Node D | Step 7-7 Node E “The steps involved in depth first traversal are as follows: [ Step 1 > Node A | Step 2-2 Node B | Step 3 » Node C Step 4 Node F | ep $ > Node D {Step 6-7 NodeG | Step 7-7 Node E DSA-94 ee Scanned with CamScannerDATA STRUCTURE & ALGORITHM 8. Describe the Edge classification of OFS algorithm. [MODEL QUESTION] oy ‘Answer: i Consider a directed graph G = (V, E). After a DFS of graph G we can put each edge into i one of four classes: ti 1. Atree edge is an edge in a DFS-tree, a 2. A back edge connects a vertex to an ancestor in a DFS-tree. Note that a self-loop is a a back edge. ie: 3. A forward edge is a non-tree edge that connects a vertex to a descendent in a DFS- an) tree. OH 4. Across edge is any other edge in graph G. It connects vertices in two different DFS- | tree or two vertices in the same DFS-tree neither of which is the ancestor of the other. i I. AForwact Etge i LA Tree Edge toa descendant te | 1 7 ae + Ageatinos i toananceaoe foeeal Any particular DFS or BFS of a directed or un-directed graph, each edge gets classified asone of the above. Ina DFS of an undirected graph, every edge is either a tree edge or back edge. Here no cross edge goes to a higher numbered or rightward vertex. The reason behind the DES algorithm is so important is that it defines a very nice ordering of edges of the graph. 1. a) Compare BFS and DFS, Discuss the two different ways of representing 2 graph. Describe BFS algorithm. [WBUT 2016] DSA-95, Scanned with CamScannerPOPULAR PUBLICATIONS SORTING & HASHING = Chapter ata Glance © Ahash table data structure is just like an array, Data is stored into this array at specific index generated by 2 hash function, A hash function hashes (converts) a number in a large range, into a number in a smaller range. ‘+ Linear search: Linear or Sequential Search i a method where the search begins at one end of the list, scans the elements af the lst fom let to right (ifthe search begins from left) until the desired record is found. This type of searching can be performed in an ordered list or an unordered list. For ordered, lists that must be accessed sequentially, such as linked lists of files with variable-length records lacking an index, the average performance can be improved by giving up at the first clement which is greater than the unmatched target value, rather than examining the entire list © Binary Search: In Binary Search the entire sorted list is divided into two parts. We first ‘compare our input item with the mid element ofthe list and then restrict our attention to only. the first or second half ofthe list depending on whether the input item comes left or tight of the mid-element. In this way we reduce the length of the list to be searched by half. * ‘© Hashing: In hash tables, there is always a possibility that two data elements will hash to the seme integer value. When this happens, a collision occurs ie. two data members try to occupy the same place in the hash table array. There are methods to deal with such situations like, Open Addressing and Chaining. : * © Bubble sort: Given an array of unsorted elements, Bubble sort performs a sorting operation ‘on the first two adjacent elements in the array then between the second & third, then between third & fourth & so on. a Insertion sort: In insertion sort data is sorted dataset by identifying an element that is out of order relative to the elements around it. It removes that element from the list, shifting all other elements up one place. , Finally it places the removed element in its correct location. For exemple, when holding a hand of cards, players will often scan their cards from left to right, looking for the first card that is out of place. If the first three cards of a player's hand are 4, 5, 2, he will often be satisfied thatthe 4 and the 5 are in order relative to each other, but, upon getting to the 2, desires to place it before the 4 and the 5. In that case, the player * typically removes the 2 from the list, shifts the 4 and the 5 one spot to the right, and then places the 2 into the first slot on the lef. © Quick sort: In Quick-Sort we divide the array into two halves. We select a pivot element (normally the middle element ofthe array) and perform a sorting in such a manner that all the elements to the left of the pivot element is lesser than it & all the elements to it’s right is greater than the pivot element. Thus we get two sub arrays. © Merge sort: In this method, we divide the array or list into two sub arrays or sub lists as nearly equal as possible and then sort them separately. Then the sub-arrays are again divided into another sub arrays. © Heap sort: A heap takes the form of a binary tree with the feature that the maximum or minimum element is placed in the root. Depending upon this feature the heap is called max- DSA-106 ee Scanned with CamScannerDATA STRUCTURE & ALGORITHM heap or min-heap respectively. After the heap construction the elements from the root are tnken out from the tree and the heap structure is reconstructed. This process continues until | the heap is empty. | Multiple Chol | 4. The ratlo of the number of items in a hash table, to the table size is‘calfed the 4 [WBUT 2007, 2009, 2016] " a)load factor —_b) Item factor ¢) balanced factor —_) all of these H ‘Answer: (a) Mf 2. Which of the following Is not a requirement of good hashing function? : Bi a) Avoid collision b) Reduce the storage space ny c) Make faster retrieval , d)None of these [WBUT 2008, 2015] a ‘Answer: (b) a a 43. Stability of Sorting Algorithm Is important for {WBUT 2007] ‘a) Sorting records on the basis of multiple keys / b) Worst case performance of sorting algorithm We c) Sorting alpha numeric keys as they are likely to be the same d) None of these } Answer: (a) | 4, Which of the following Is the best time for an algorithm? (WBUT 2007] P| a) O(n) 'b) O(log2 n) . €) O(2n) d) O(n log2 n) ie Answer: (b) : ae 5, The Linear Probing Technique for collision resolution can lead to [WBUT 2008] Lae a) Primary clustering b) Secondary clustering ) c) Overflow 4) Efficiency storage utilization 4 Answer: (a) 6. The fastest sorting algorithm for an almost already sorted array is [WBUT 2003] a) quick sort b) merge sort ¢) selection sort —_d) insertion sort Answer: (4) : 7. The time complexity of binary search is [WBUT. 2009] a) O(n’) b) O(n), €) Oflog n) 4) O(a tog n) ‘Answer: (c) 8. The best case time complexity of Bubble sort technique is [WBUT 2010) a) O(n) b) O(n") ¢) O(nlogn) 4) O(logn) DSA-107 | q 1h Scanned with CamScannerPOPULAR PUBLICATIONS 8. Which of the following sorting procedures is the slowest? (weuT 2019) 8) Quick sort b) Heap sort c) Merge sort d) Bubble ont Answer: (d) 10. Which of the following traversal techniques lists the ‘search tree in ascending order? a) pre-order b) Postorder ¢) Inorder Answer: (¢) ‘11, Binary search cannot be used In linked lists. a) True by False Answer: (b) 12. Breadth-first-search algorithm uses......-.data structure WBUT 2044) a) stack bd) queue ¢) binary tree d) none of these Answer: (b) ‘ 13. The best case complexity of insertion sort is - (wBUT 201) a) O(n') 2) O(nlos,x) ——_) O(n’) 4) O(n) Answer: (d) 44, Which of the following is not related to hashing? [WBUT 204 a)Synonyms —_) Collision ) Balance 4) Load factor Answer: (c) 15. A ma minimum time needed to sort 100 names will be approximately (WBUT 2012) a) 727 sec b) 11.2 sec ¢) 50.2 sec d) 6.7 sec. Answer: (¢) ” 16. What will be the time complexity for selection sort to sort an array of n elements? [WBUT 2012, 2046) a) Oflegn) —_b) O(n log) O(n) 4) O(n’) : Answer: (d) : : E on 17. The best sorting technique when the data is almost sorted is. [WBUT 2013] 4a) Selection sort _b) Bubble sort ¢) Quiek sort d) Insertion’ Answer: (4) 7 18. Which of the following is a hash function? [WBUT 2014] a) Quadratic probing ) chaining ) open addressing 4) folding ‘Answer: (a) Scanned with CamScannerDATA STRUCTURE & ALGORIIUM 19. Tho number of swapping ded to sort numbers 8, 22, 7, 9, 31, 19, 6, 13 In asconding order using bubble sort Is (WBUT 2014) a) tt b) 12 13 ais Answer: (d) 20. Binary search uses (WBUT 2014) a) divide and reduce strategy b) divide and conquer stratogy ¢) houristlc search 4) both (a) and (b) Answer: (b) 21. Morgo sort us . {WBUT 2015) a) divide and conquer strategy b) backtracking approach c) houristic search d) greedy approach Answer: (a) “ 22, The prerequisite condition of Binary search Is. (WBUT 2017, 2018} a) unsorted array 'b) ascending order array c) descending order array -. d) sorted array Answer: (4) 23, The worst case complexity of binary search for alist having n elements is. (weuT 2019) a) log 2" b) nlog2" on dynr2 ‘Answer: (b) 24. Consider that n elements are to be stored. What is the worst case time complexity of Bubble sort? (WBUT 2019), a) 0(1) bp) O(log 2n) ¢) O(n) 4) 0(n*2) Answer: (d) 25, What is the worst case performance of Selection sort algorithm? {WBUT 2018) a) O(log n) 'b) O(ntn) ¢) O(n) d) O(n log n) ‘Answer: (b) 26. A sort which relatively passes through a list to exchange the first element with any element less than it and then repeats with a new first vent is called : [WBUT 2019) a)insertion sort b) selection sort —_c) heap sort d) quick sort Answer: (a) Short Answer Typ estions 4. Explain the advantages of binary search over sequential search. {WBUT 2007, 2013) DSA-109 ” Scanned with CamScannerPOPULAR PUBLICATIONS Answer: A sequential scarch of cither a list, an array, o a chain looks at the first item, the second item, and so on until it either finds a particular item or determines that the item docs fot occur in the group. Average case of sequential search is O(n) A binary search of an array requires that the array be sorted. It looks first at the middle of the array to determine in which half the desired item can occur. The search repeats this strategy on only this half of the array. The benefit of binary search over linear search becomes significant for lists over about 100 elements, For smaller lists linear search may be faster because of the speed of the simple increment compared with the divisions needed in binary search. Thus for large lists binary search is very much faster than linear search, but is not worthwhile for small lists. Binary scarch is not appropriate for linked list structures (no random access for the middie term). | 2. What is hashing? [WBUT 2007, 2012, 2014, 2017) OR, Define Hashing. [WBUT 2015] What is collision? (WBUT 2017] Explain Linear Probing & Quadratic on with example. [WBUT 2007) Defin “Hashing. Explain with a en example the collision resolution scheme using linear probing with open addressing. [WBUT 201 ol ui Define Hashing. Explain one collision resolution scheme citing one example. [WBUT 201 OR, wa ‘Write two hash functions [WBUT 204; OR, . 7 Explain with suitable example the collision resolution scheme using linear probing with open addressing. (WBUT 2019) Answer: 1" Part: Hashing is a method for storing and retrieving records from a database. It lets you insert, delete, and search for records based on a search key value. When properly implemented, these operations can be performed in constant time. In fact, a properly tuned hash system typically looks at only one or two records for cach search, insert, or delete operation. This is far better than the O(log n) average cost required to do a binary search on a sorted array of n records, or the O(log n) average cost required to do an operation on a binary search tree. However, even though hashing is based on a very simple idea, it is surprisingly difficult 10 implement properly. Designers need to pay careful attention to all of the details involved with implementing a hash system. A hash system stores records in an array called a hash-table, which we will call HT. Hashing works by performing a computation on a search key K in a way that is intended to identify the position in HT that contains the record with key K. The function that does DSA-110 Scanned with CamScannerDATASTRUCTURE & ALGORTHM this calculation is called the hash function, and is usually denoted by the letter h. Since hashing schemes place records in the table in whatever order satisfies the needs of the address calculation, records are not ordered by value. A position in the hash table is also known as a slot. The number of slots in hash table HT will be denoted by the variable M with slots numbered from 0 to M- 1. 2 Part: ‘A collision between two keys K & K’ occurs when both have to be stored in the table & + poth hash to the same address in the table. 3 Part: ‘ Open addressing: It is a general collision resolution scheme for a hash table. In case of collision, other positions of the hash table are checked (a probe sequence) until an empty sition is found. The different types of Open addressing scheme includes a) Linear Probing (Sequential Probing) b) Quadratic Probing ) Double Hashing (Re Hashing) Linear probing is a used for resolving hash collisions of values of hash functions by sequentially searching the hash table for a free location. This is accomplished using two values - one as a starting value and one as an interval between successive values in modular arithmetic. The second value, which is the same for all keys and known as the stepsize, is repeatedly added to the starting value until a free space is found, or the entire table is traversed. ‘The function for the rehashing is the following: * rehash(key)=(n+1) % ks For example, we have a hash table that could accommodate 9 information, and the data to be stored were integers. To input 27, we use hash(key)= 27 % 90. Therefore, 27 is stored at 0. If another input 18 occurs, and we know that 18 % 9= 0, then a collision would occur. In this event, the need to rehash is needed. Using linear probing, we have the rehash(key)= (18+1) % 9= 1. Since 1 is empty, 18 can be stored in it. Quadratic probing: In order to prevent collision we use quadratic probing scheme. + In quadratic probing, = We start from the original hash location i = Ifalocation is occupied, we check the locations i+1?* i+2?*i+3*, i+4?... - We wrap around from the last table location to the first table location if necessary. Let us take the following example: Table Size is 11 (0.10) - Hash Function: h(x) =x mod 11 Insert keys (20, 30,2,13,25,24,10,9): + 20mod11= 9 DSA-I11 Scanned with CamScanner
You might also like
DS 2nd Yr. Quantum ? 2023-24
PDF
100% (1)
DS 2nd Yr. Quantum ? 2023-24
121 pages
Introduction
PDF
No ratings yet
Introduction
11 pages
Data Structures & Algorithms ERE 3rd Sem
PDF
No ratings yet
Data Structures & Algorithms ERE 3rd Sem
160 pages
Analysis of Algorithm
PDF
No ratings yet
Analysis of Algorithm
32 pages
DSA mcqs
PDF
No ratings yet
DSA mcqs
58 pages
Question Bank Unit 1 PDF
PDF
No ratings yet
Question Bank Unit 1 PDF
27 pages
DSA Exam Notes
PDF
No ratings yet
DSA Exam Notes
6 pages
Unit 1 - Basic Concepts of Ds
PDF
No ratings yet
Unit 1 - Basic Concepts of Ds
39 pages
Chapter-1
PDF
No ratings yet
Chapter-1
171 pages
DS Unit1-1
PDF
No ratings yet
DS Unit1-1
17 pages
TCS 200-SM02
PDF
No ratings yet
TCS 200-SM02
10 pages
Introduction To Data Structures
PDF
No ratings yet
Introduction To Data Structures
27 pages
Untitled
PDF
No ratings yet
Untitled
66 pages
ds unit 1 (1)
PDF
No ratings yet
ds unit 1 (1)
5 pages
dsa All
PDF
No ratings yet
dsa All
24 pages
Data Structure - UNIT-1
PDF
No ratings yet
Data Structure - UNIT-1
28 pages
DS Notes Removed
PDF
No ratings yet
DS Notes Removed
14 pages
Ds Unit 1
PDF
No ratings yet
Ds Unit 1
6 pages
DS Firstchapt Introduction
PDF
No ratings yet
DS Firstchapt Introduction
39 pages
L1-Linear Data Structure
PDF
No ratings yet
L1-Linear Data Structure
90 pages
Unit 1 - Basic Concepts of Ds
PDF
No ratings yet
Unit 1 - Basic Concepts of Ds
39 pages
C-1 Data Structures and Algorithms-I
PDF
No ratings yet
C-1 Data Structures and Algorithms-I
65 pages
FDS Short Answer
PDF
No ratings yet
FDS Short Answer
5 pages
UNIT1 Ds
PDF
No ratings yet
UNIT1 Ds
15 pages
Unit - 1 Introduction To Data Structures, Searching and Sorting
PDF
No ratings yet
Unit - 1 Introduction To Data Structures, Searching and Sorting
221 pages
DSA ASSIGNMENTS
PDF
No ratings yet
DSA ASSIGNMENTS
16 pages
DS Part1 Merged Compressed
PDF
No ratings yet
DS Part1 Merged Compressed
212 pages
Unit_1
PDF
No ratings yet
Unit_1
15 pages
Data Structures- Unit-I (1)
PDF
No ratings yet
Data Structures- Unit-I (1)
45 pages
Algorithms and Data Structures
PDF
No ratings yet
Algorithms and Data Structures
11 pages
1 Dsa
PDF
No ratings yet
1 Dsa
46 pages
DS Assignment 1
PDF
100% (1)
DS Assignment 1
9 pages
DS May 19 Solved
PDF
No ratings yet
DS May 19 Solved
24 pages
Chapter-1 Introduction and Searching
PDF
No ratings yet
Chapter-1 Introduction and Searching
56 pages
Iare DS PPT 0
PDF
No ratings yet
Iare DS PPT 0
221 pages
Data Structures Basic Programs
PDF
No ratings yet
Data Structures Basic Programs
132 pages
codetantra DS UNIT-1
PDF
No ratings yet
codetantra DS UNIT-1
6 pages
DS PPT
PDF
No ratings yet
DS PPT
221 pages
CS611 - L01 - Data Structures - Introduction - Saleh
PDF
No ratings yet
CS611 - L01 - Data Structures - Introduction - Saleh
32 pages
DSUnit 1A
PDF
No ratings yet
DSUnit 1A
4 pages
Unit-1 - Introduction To DS
PDF
No ratings yet
Unit-1 - Introduction To DS
38 pages
Algorithm, ADT and Arrays
PDF
No ratings yet
Algorithm, ADT and Arrays
14 pages
Unit Test 1 Need of DS: Data Structure
PDF
No ratings yet
Unit Test 1 Need of DS: Data Structure
23 pages
Handout Data Structures Final
PDF
No ratings yet
Handout Data Structures Final
73 pages
Data Structures 2
PDF
No ratings yet
Data Structures 2
31 pages
Data Structures PPTS
PDF
No ratings yet
Data Structures PPTS
221 pages
M1_2af53fa9cf49c509bb965a2b1e48ff00 (1)
PDF
No ratings yet
M1_2af53fa9cf49c509bb965a2b1e48ff00 (1)
6 pages
Data Structures Notes
PDF
No ratings yet
Data Structures Notes
193 pages
DSA - Unit 1
PDF
No ratings yet
DSA - Unit 1
149 pages
document_1676338680430
PDF
No ratings yet
document_1676338680430
23 pages
1.1 Introduction
PDF
No ratings yet
1.1 Introduction
49 pages
1.introduction DS Unit-1
PDF
No ratings yet
1.introduction DS Unit-1
39 pages
Lecture - Asymptotic Complexity and Abstract Data Types
PDF
No ratings yet
Lecture - Asymptotic Complexity and Abstract Data Types
35 pages
DS NOTES UNIT-1 (1)
PDF
No ratings yet
DS NOTES UNIT-1 (1)
51 pages
DSA Notes Unit 1 To Unit 6
PDF
No ratings yet
DSA Notes Unit 1 To Unit 6
587 pages
Introduction to Algorithm
PDF
No ratings yet
Introduction to Algorithm
3 pages
SCS214-DS2024-lec-1-Intro
PDF
No ratings yet
SCS214-DS2024-lec-1-Intro
45 pages