Chapter4: Data Structures. Data: It is a collection of raw facts that has implicit meaning.

Size: px
Start display at page:

Download "Chapter4: Data Structures. Data: It is a collection of raw facts that has implicit meaning."

Transcription

1 Chapter4: s Data: It is a collection of raw facts that has implicit meaning. Data may be single valued like ID, or multi valued like address. Information: It is the processed data having explicit meaning. Data has to be processed to give meaning. To process, the data has to be organized. Organizing requires structuring the data. Space and time plays an important role in structuring the data. What are data structures? Data structure is a way of collecting and organizing data such that operations on the data can be performed in an effective way. Data Types Operations s Classification of data structures How are data structures classified? 1

2 What are primitive data structures? They are Data structures that can be operated directly by machine level instructions. Give an example for Primitive data structure. Examples are int, char float, double, pointer What are non-primitive data structures? They are Data structures that cannot be manipulated directly by machine level instructions. Mention any one non primitive data structure. Examples are Array, stacks, queues, linked lists, trees, graphs Depending on the type of relationships between the data elements, non primitive data structures can be classified as linear and nonlinear data structures. What is meant by linear data structure? They are Non primitive data structures that show relationship of logical adjacency between elements Mention any one linear data structure. Arrays, stacks, queues, linked lists What are nonlinear data structures? They are Data structures that establish relationship other than adjacency are called non primitive data structures. Give an example for nonlinear data structures. Trees, Graphs are some examples of non linear data structures. Operations on s: Mention the various operations performed on data structures. Operations on primitive data structures: CREATE DESTROY SELECT UPDATE CREATE: It reserves memory for the program element Example int x = 10; 2

3 This causes memory to be allocated for variable x and it allows integer value 10 to be stored. SELECT: It is frequently used to access data within a data structure. Example: cout<<a[5]; The array element a[5] is selected for printing. UPDATE: It is used to change or modify the data in the data structure. Example: int x=3; x=10; This modifies the value of x from 3 to 10 DESTROY: It is used to deallocate the memory. It is not essential operation since the memory allocated is freed automatically when the execution ends. Note!! C programming provides free () function, C++ provides destructors and Java provides a mechanism of Garbage collection to free memory. Operations on non primitive data structures What is meant by traversal? Traversal: It is the process of accessing (visiting) each element exactly once so as to perform certain operations on it. What is searching? Searching: It is the process of finding the presence of an element which satisfies one or more given conditions and displaying its position. Insertion: It is the process of adding a new element to the structure. For this the position should first be identified and only then the new element can be inserted. Deletion: It is the process of removing an element from the existing structure. What is meant by sorting? Sorting: It is the process of arranging elements in some logical order. Merging: It is the process of combining the elements in two different structures into a single structure. 3

4 What is an array? It is a non-primitive linear data structure that is a collection of homogeneous elements which can be accessed through a single name and occupies continuous memory location. An index or subscript is a number used to represent the size of the array or locate the position of the element in an array. Application of arrays: Arrays are used to perform matrix operations Databases use arrays to hold elements as records. They are used to implement other data structures like stacks, queues etc. Advantages of arrays Data accessing is faster: we can access any data item efficiently just by specifying the index of that item. Simple: Arrays are simple to understand and use. They can represent multiple data items of same type by using only single name. It can be used to implement other data structures like linked lists, stacks, queues, trees, graphs etc. 2D arrays can be used to represent matrices. Disadvantages of arrays The size of the array is fixed: The memory required for most of the applications often cannot be predicted while writing a program. Array items are stored contiguously: Even though the total free memory space is sufficient, this space cannot be used since arrays require contiguous storage space. Insertion and deletion operation involving arrays is tedious job: if the applications require extensive manipulation of stored data, in the sequential representation, more time is spent only in the movement of the data. Types of arrays Mention the different types of arrays. Based on the number of indices, arrays are classified into 1. One Dimensional Array 2. Two dimensional Array 3. Multi Dimensional Array 4

5 One Dimensional Array: It is an array in which elements are accessed using only one subscript. This subscript represents the position of the element in the array. The amount of memory occupied by the array depends on the number of subscripts and the data type of the subscripts. Syntax for Declaring One Dimensional Array data_type array_name [size]; Data_type indicates what type of data is stored in the array. It can be int, char, float, double, structure, union Size is an integer expression that specifies the number of elements in the array. If the value is n, the range of index values is 0 through n-1 and not 1 to n. Note: Data type of the Subscript should be int only. Character array terminate with a NULL character. Calculating length of array The length of the array can be calculated by L = UB-LB+1. Where LB is the lower bound which is zero by default. UB is upper bound which is the value of the subscript of the last element in the array. Example: LB=0 UB= A[0] A[1] A[2] A[3] A[4] Size of the Array L = = 5 Representation of one dimensional array in memory Explain the memory representation of a one dimensional array. Location Content Address Arrays are stored in continuous memory location. However, the name of the array points to the first address called base address and not the complete array address. The address of any element of the array is calculated by Location * size of data type + base address Example: Address of A[3] = 3 * =

6 Basic operations on 1-D arrays Array is a non primitive data structure hence the operations that can be performed include Traversing Searching Insertion Deletion Sorting Merging Traversing: Program to accept and display the elements of the array #include<iostream.h> #include<conio.h> class array private: int a[10], n,i; public: void input() cout<< enter the number of elements <<endl; cin>>n; cout<< enter the array elements <<endl; for(i=0;i<n; i++) cin>>a[i]; void output() cout<< elements of the array are <<endl; for(i=0;i<n;i++) cout<<a[i]<< \t ; ; void main() array a; clrscr(); a.input(); a.output(); getch(); 6

7 Write an algorithm for traversal in a linear array. Algorithm: Let A be the linear array, N be the size of the array, I be the variable for traversing through the array. Step1: Start Step 2: Input N Step 3: For I=0 to N-1 Do Input A[I] End of For loop Step 4: For I=0 to N-1 Do Output A[I] End of For loop Step 5: Stop only logic of the program for 3 marks Searching: The searching algorithms are important for areas like web search and other real world applications. The various search algorithms are sequential search, Binary Search, Interpolation Search, Hashing. Mention the types of searching in the array. Linear search and binary search are the search algorithms in array. Linear Search: (Sequential Search) It is the simplest search algorithm. The principle of linear search is: Start comparing the search element with every element of the array, from the beginning till the end one after the other. If the element is matched, search process is stopped and the position is retrieved. Search is unsuccessful if the position is not retrieved. Algorithm for Linear search: Let A be an array with N elements. SE be the search element. The algorithm displays the location loc where the search element is found. Initially the value of loc is -1. This value does not change if the element is not found. Step1: Start Step 2: loc= -1 Step 3: For I = 0 to N-1 If (A[I] = SE) Loc=I + 1; Go to Step 3 End of if End of for Step 4: if (loc > =0) 7

8 Display loc Else Display Element not found Step 5: Stop Program for Linear search #include<iostream.h> #include<conio.h> class lsearch int a[10],i,se,n,loc; public: void input() cout<<"enter the size of the array"<<endl; cin>>n; cout<<"enter the array elements"<<endl; for(i=0;i<n;i++) cin>>a[i]; cout<<"enter the search element"<<endl; cin>>se; void compute() loc=-1; for(i=0;i<n;i++) if(a[i]==se) loc=i; break; void output() if(loc>=0) cout<<"element found at "<< loc << " position"; else cout<<"element not found"; ; void main() lsearch L; 8

9 clrscr(); L.input(); L.compute(); L.output(); getch(); Advantages: Very simple approach Works well for small arrays. It can be used on unsorted arrays too. Disadvantages: Less efficient if the array size is large. If the elements are sorted, linear search is not efficient. Binary Search: It works on the principle of Divide and Conquer. It is best suited for sorted arrays and not suited for unsorted arrays. We compare the search element with the middle element, if it matches, then the search is successful. Otherwise the list is divided into two halves one from 0 th element to the middle element 1 and another from middle element + 1 to the last element. The searching will proceed in either of the two halves depending upon whether the element is greater or smaller than the middle element. The same procedure is repeated within each half until the element is found. Example: Elements Position Number of elements N=5 Search element SE = Low=0 High =N-1 5-1=4 Mid = (low + High ) /2; = (0+4) / 2 = 2 Compare search element and mid element 33 > 30, search in the right half. 2. Low= mid +1 = 2 +1 = 3 High = 4 (No change) Mid = (3 + 4) / 2 = 7/2 = 3 (7/2 integer division hence 3 and not 3.5) 9

10 Search Element = mid element, search successful. So element found at position 3 Some more examples Assignment a. Search for the element 35 using binary search for the following sequence of elements 10, 20, 30, 35, 40, 45, 50, 55, 60 b. Search for 92 80,82, 84, 86, 88, 90, 92, 94, 96,

11 Write an algorithm to search an element in an array using binary search. Algorithm Let A be a sorted array of size N with lower bound LOW=0, Upper bound HIGH=N-1, Let MID denote location of mid element. ELE is the search element. Step 1: Start Step 2: Input N Step 3: For I=0 to N-1 Do Input A[I] [End of Step3 For loop] Step 4: Input ELE Step 5: LOW=0 Step 6: HIGH=N-1 Step 7: LOC=-1 Step 8: while (LOW<=HIGH) DO Step 9: MID=(LOW+HIGH)/2 Step 10: If(ELE =A[MID]) Then Step11: LOC=MID+1 Go To Step 15 Endif Step12:If(ELE<A[MID]) Then Step13: HIGH=MID-1 ELSE Step14:LOW=MID+1 Endif End of While Loop Step15:If(LOC>=0) Then Step16: Display ELE,"Found in location", LOC Else Step17: Display ELE, "Not Found" Endif Step18:Stop 11

12 Lab Program 5 #include<iostream.h> #include<conio.h> class bsearch int a[25],n,i,ele,loc; public: void input() cout<<"enter the number of elements"; cin>>n; cout<<"enter the array elements"; for( i=0;i<n;i++) cin>>a[i]; cout<<"enter the element to be searched"; cin>>ele; void compute() int low,high,mid ; loc=-1 low=0; high=n-1; while(low<=high) mid=(low+high) / 2; if(ele= =a[mid]) loc=mid+1; break; if(ele<a[mid]) high =mid-1; else low=mid+1; void output() if(loc<0) cout<< search unsuccessful ; else cout<< element found at <<loc<< position ; ; void main() bsearch b; clrscr(); b.input(); b.compute(); b.output(); getch(); 12

13 Insertion Adding the elements to the array is termed as insertion. When we insert an element to the array at any given position, the existing elements have to be moved one position up from the end till the given position. Write an algorithm to insert an element into the array Let A be an array of size N, I be the variable for traversing through array, ELE be the element to be added at the position POS. Step1: Start Step 2 : Input N Step 3: For I=0 to N-1 Do Input A[I] [End of Step 3 For loop] Step 4: Input ELE Step 5: Input POS Step 6: For I=N to POS Do A[I] = A[I-1] [End of Step 6 loop] Step 7: A[POS]= ELE Step 8: N=N+1 Step 9: For I=0 TO N-1 DO Display A[I] [End of Step 9 loop] Step 10: Stop 13

14 Lab Program 2 #include<iostream.h> #include<conio.h> #include<process.h> class insertion private: int a[10],n,i,ele,pos; public: void input() cout<<"enter size"<<endl; cin>>n; cout<<"enter elements"<<endl; for(i=0;i<n;i++) cin>>a[i]; cout<<"enter position"<<endl; cin>>pos; cout<<"enter the element"<<endl; cin>>ele; void compute() if(pos>n) cout<<"invalid"; exit(0); else for(i=n;i>pos;i--) a[i]=a[i-1]; a[pos]=ele; n++; void output() cout<<"array after insertion"<<endl; for(i=0;i<n;i++) cout<<a[i]<<endl; ; void main() insertion i; clrscr(); i.input(); i.compute(); i.output(); getch(); 14

15 Deletion When we delete an element from the array from any given position, elements have to be shifted one lower order position from the given position till the end. Write an algorithm to delete an element from the array Step 1: Start Step 2: Input N Step 3: For I=0 to N-1 Do Input A[I] [End of Step3 For loop] Step 4: Input ELE Step 5: Input POS Step 6: For I=POS to N-1 Do A[I] = A[I+1] [End of Step5 loop] Step 7: N=N-1 Step 8: For I=0 TO N-1 DO Display A[I] [End of Step6 loop] Step 9: Stop 15

16 Lab Program 2 #include<iostream.h> #include<conio.h> #include<stdlib.h> class deletion int a[10],n,i,pos; public: void input() cout<<"enter the size of the array"<<endl; cin>>n; cout<<"enter the array elements"<<endl; for(i=0;i<n;i++) cin>>a[i]; cout<<"enter the position to be deleted"<<endl; cin>>pos; void compute() if(pos>n-1) cout<<"invalid position"; getch(); exit(0); else for(i=pos;i<n;i++) a[i]=a[i+1]; n=n-1; void output() cout<<"array after deletion is "<<endl; for(i=0;i<n;i++) cout<<a[i]<<endl; ; void main() deletion d; clrscr(); d.input(); d.compute(); d.output(); getch(); 16

17 Sorting: It is an important concept used extensively in the field of computer science. It is the process of re arranging the elements in a specified order either ascending or descending. There are many methods of sorting like Bubble Sort, Selection Sort, etc. Insertion Sort: It is a simple Sorting algorithm which sorts the array by shifting elements one by one. It is efficient for smaller data sets, but inefficient for larger lists. Example: 17

18 Write an Algorithm to sort the elements using insertion sort Step1: Start Step 2: Input N Step 3: For I=0 to N-1 Do Input A[I] [End of Step 3 For loop] Step 4: For I=1 to N-1 Do J=I Step 5: While(J>=1) Step 6: If(A[J]<A[J-1]) Then Step 7: TEMP=A[J] Step 8: A[J] = A[J-1] Step 9: A[J-1]=TEMP Endif Step 10: J=J-1 End While loop End Step 4 For loop Step11: For I=0 to N-1 Do Display A[I] End of Step11 For loop Step12: Stop 18

19 Lab Program 4: #include<iostream.h> #include<conio.h> #include<stdlib.h> class sorting int a[10],n,i; public: void input() cout<<"enter the size of the array"<<endl; cin>>n; cout<<"enter the array elements"<<endl; for(i=0;i<n;i++) cin>>a[i]; void compute() int j,temp; for(i=1;i<n;i++) j=i; while(j>=1) if(a[j]<a[j-1]) temp=a[j]; a[j]=a[j-1]; a[j-1]=temp; j=j-1; void output() ; void main() sorting s; clrscr(); s.input(); s.compute(); s.output(); getch(); cout<<"array after sorting is"<<endl; for(i=0;i<n;i++) cout<<a[i]<<endl; 19

20 Two dimensional arrays A two-dimensional array is nothing more than an array of arrays. It helps to think of a two-dimensional array as a grid of rows and columns. It can be defined as an array with 2 subscripts. Declaring Two Dimensional Arrays Syntax data_type array_name [row-size] [ column-size] ; As with the single dimension array, each dimension of the array is indexed from zero to maximum size -1. The first index selects the row and the second index selects the column. A 2-dimensional array a, which contains three rows and four columns can be shown as below: But in the memory it is stored contiguously. Example an array of 3 rows and 3 columns is stored as row 0 row 1 row [0][0] [0][1] [0][2] [1][0] [1][1] [1][2] [2][0] [2][1] [2][2] Representation of 2D arrays in memory A 2D array s elements are stored in continuous memory locations. It can be represented in memory using any of the following two ways: 1. Column-Major Order 2. Row-Major Order Row major order. In this method, elements of the array are arranged sequentially row by row. Thus elements of first row occupies first set of memory locations reserved for the array, elements of second row occupies the next set of memory and so on. 20

21 Consider the following example in which a two dimensional array consists of two rows and four columns stored sequentially in row major order as Column 0 Column 1 Column 2 Column 3 Row Row Address Representation Element Row 2000 A [0] [0] A [0] [1] A [0] [2] A [0] [3] A [1] [0] A [1] [1] A [1] [2] A [1] [3] 80 The location of element A[i][j] can be obtained by evaluating expression Loc (A [i,j]) = Base Address + W [M(i) + j] Where Base Address is the address of the first element of the array W is the word size, i.e. size occupied by each element N is the number of rows in the array M is the number of columns in the array. Example: if we want to calculate the address of element A[1][2] It can be calculated as Base address = 2000, W=2, N= 2, M=4, I=1, J=2 Loc (A [i,j]) = Base Address + W [M(i) + j] = *(4*1 + 2) = =

22 Column Major Order. In this method, elements of the array are arranged sequentially column by column. Thus elements of first column occupies first set of memory locations reserved for the array, elements of second column occupies the next set of memory and so on. Consider the following example in which a two dimensional array consists of two rows and four columns stored sequentially in column major order as Column 0 Column 1 Column 2 Column 3 Row Row Address Representation Element Column 2000 A [0] [0] A [1] [0] A [0] [1] A [1] [1] A [0] [2] A [1] [2] A [0] [3] A [1] [3] 80 The location of element A[i][j] can be obtained by evaluating expression Loc (A [i,j]) = Base Address + W [N(j) + i] Where Base Address is the address of the first element of the array W is the word size, i.e. size occupied by each element N is the number of rows in the array M is the number of columns in the array. Example: if we want to calculate the address of element A[1][2] It can be calculated as Base address = 2000, W=2, N= 2, M=4, I=1, J=2 Loc (A [i,j]) = Base Address + W [N(j) + i] = *(2*2 + 1) = =

23 // Program to read and Print elements in column major order #include<iostream.h> #include<conio.h> class arraytwod int a[5][5], i,j,r,c; public: void input() cout<<"enter the order of the matrix"<<endl; cin>>r>>c; cout<<"enter the array elements"<<endl; for(i=0;i<r;i++) for(j=0;j<c;j++) cin>>a[i][j]; void output() cout<<"elements in column major order is"<<endl; for(i=0;i<c;i++) for(j=0;j<r;j++) cout<<a[j][i]<<endl; ; void main() clrscr(); arraytwod d; d.input(); d.output(); getch(); 23

Downloaded from

Downloaded from Unit-II Data Structure Arrays, Stacks, Queues And Linked List Chapter: 06 In Computer Science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.

More information

Types of Data Structures

Types of Data Structures DATA STRUCTURES material prepared by: MUKESH BOHRA Follow me on FB : http://www.facebook.com/mukesh.sirji4u The logical or mathematical model of data is called a data structure. In other words, a data

More information

CSE202- Lec#6. (Operations on CSE202 C++ Programming

CSE202- Lec#6. (Operations on CSE202 C++ Programming Arrays CSE202- Lec#6 (Operations on Arrays) Outline To declare an array To initialize an array Operations on array Introduction Arrays Collection of related data items of same data type. Static entity

More information

Arrays. Elementary Data Representation Different Data Structure Operation on Data Structure Arrays

Arrays. Elementary Data Representation Different Data Structure Operation on Data Structure Arrays Arrays Elementary Data Representation Different Data Structure Operation on Data Structure Arrays Elementary Data Representation Data can be in the form of raw data, data items and data structure. Raw

More information

An array is a collection of similar elements that is all the elements in an array should have same data type. This means that an array can store

An array is a collection of similar elements that is all the elements in an array should have same data type. This means that an array can store An array is a collection of similar elements that is all the elements in an array should have same data type. This means that an array can store either all integers, all floating point numbers, all characters,

More information

The time and space are the two measure for efficiency of an algorithm.

The time and space are the two measure for efficiency of an algorithm. There are basically six operations: 5. Sorting: Arranging the elements of list in an order (either ascending or descending). 6. Merging: combining the two list into one list. Algorithm: The time and space

More information

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer:

Chapter-11 POINTERS. Important 3 Marks. Introduction: Memory Utilization of Pointer: Pointer: Chapter-11 POINTERS Introduction: Pointers are a powerful concept in C++ and have the following advantages. i. It is possible to write efficient programs. ii. Memory is utilized properly. iii. Dynamically

More information

NCS 301 DATA STRUCTURE USING C

NCS 301 DATA STRUCTURE USING C NCS 301 DATA STRUCTURE USING C Unit-1 Part-3 Arrays Hammad Mashkoor Lari Assistant Professor Allenhouse Institute of Technology www.ncs301ds.wordpress.com Introduction Array is a contiguous memory of homogeneous

More information

Introduction to Arrays

Introduction to Arrays Introduction to Arrays One Dimensional Array. Two Dimensional Array. Inserting Elements in Array. Reading Elements from an Array. Searching in Array. Sorting of an Array. Merging of 2 Arrays. What is an

More information

Lecture 6 Sorting and Searching

Lecture 6 Sorting and Searching Lecture 6 Sorting and Searching Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 6 77 42 35 12 101 5 1 2 3 4 5 6 5 12 35 42 77 101 There are many algorithms for sorting a list

More information

Programming in C++ (Educational Support)

Programming in C++ (Educational Support) Programming in C++ (Educational Support) http:// 1. WRITE A PROGRAM TO TRAVERSING OF AN ARRAY. #include # include void main () int a [10], lb = 1, ub, k, I; cout

More information

UNIT-I Fundamental Notations

UNIT-I Fundamental Notations UNIT-I Fundamental Notations Introduction to Data Structure We know that data are simply values or set of values and information is the processed data. And actually the concept of data structure is much

More information

UNIT 2 ARRAYS 2.0 INTRODUCTION. Structure. Page Nos.

UNIT 2 ARRAYS 2.0 INTRODUCTION. Structure. Page Nos. UNIT 2 ARRAYS Arrays Structure Page Nos. 2.0 Introduction 23 2.1 Objectives 24 2.2 Arrays and Pointers 24 2.3 Sparse Matrices 25 2.4 Polynomials 28 2.5 Representation of Arrays 30 2.5.1 Row Major Representation

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure Model wer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in

More information

Columns A[0] A[0][0] = 20 A[0][1] = 30

Columns A[0] A[0][0] = 20 A[0][1] = 30 UNIT Arrays and Strings Part A (mark questions). What is an array? (or) Define array. An array is a collection of same data type elements All elements are stored in continuous locations Array index always

More information

Higher National Diploma in Information Technology. First Year Second Semester Examination IT 2003-Data Structure and Algorithm.

Higher National Diploma in Information Technology. First Year Second Semester Examination IT 2003-Data Structure and Algorithm. Higher National Diploma in Information Technology First Year Second Semester Examination-2013 IT 2003-Data Structure and Algorithm Answer Guide (01) I)What is Data structure A data structure is an arrangement

More information

List of Practical for Class XII Computer Science

List of Practical for Class XII Computer Science List of Practical for Class XII Computer Science P.01. Write a complete C++ program to define class Garment with following description: Private members: Code - type string Type - type string Size - type

More information

Introduction to Computer Science Midterm 3 Fall, Points

Introduction to Computer Science Midterm 3 Fall, Points Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do

More information

Q (Quaternary) Search Algorithm

Q (Quaternary) Search Algorithm Q (Quaternary) Search Algorithm Taranjit Khokhar Abstract In computer science, there are many ways to search the position of the required input value in an array. There are algorithms such as binary search

More information

Arrays. Week 4. Assylbek Jumagaliyev

Arrays. Week 4. Assylbek Jumagaliyev Arrays Week 4 Assylbek Jumagaliyev a.jumagaliyev@iitu.kz Introduction Arrays Structures of related data items Static entity (same size throughout program) A few types Pointer-based arrays (C-like) Arrays

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 17 EXAMINATION Subject Name: Data Structure Using C Model Answer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as

More information

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305 Q.1 If h is any hashing function and is used to hash n keys in to a table of size m, where n

More information

Functions. Introduction :

Functions. Introduction : Functions Introduction : To develop a large program effectively, it is divided into smaller pieces or modules called as functions. A function is defined by one or more statements to perform a task. In

More information

AE52/AC52/AT52 C & Data Structures JUNE 2014

AE52/AC52/AT52 C & Data Structures JUNE 2014 Q.2 a. Write a program to add two numbers using a temporary variable. #include #include int main () int num1, num2; clrscr (); printf( \n Enter the first number : ); scanf ( %d, &num1);

More information

DC54 DATA STRUCTURES DEC 2014

DC54 DATA STRUCTURES DEC 2014 Q.2 a. Write a function that computes x^y using Recursion. The property that x^y is simply a product of x and x^(y-1 ). For example, 5^4= 5 * 5^3. The recursive definition of x^y can be represented as

More information

Arrays a kind of data structure that can store a fixedsize sequential collection of elements of the same type. An array is used to store a collection

Arrays a kind of data structure that can store a fixedsize sequential collection of elements of the same type. An array is used to store a collection Morteza Noferesti Arrays a kind of data structure that can store a fixedsize sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful

More information

CSE101-lec#19. Array searching and sorting techniques. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming

CSE101-lec#19. Array searching and sorting techniques. Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU. LPU CSE101 C Programming CSE101-lec#19 Array searching and sorting techniques Created By: Amanpreet Kaur & Sanjeev Kumar SME (CSE) LPU Outline Introduction Linear search Binary search Bubble sort Introduction The process of finding

More information

C Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 2 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee C Language Part 2 (Minor modifications by the instructor) 1 Scope Rules A variable declared inside a function is a local variable Each local variable in a function comes into existence when the function

More information

Answers. 1. (A) Attempt any five : 20 Marks

Answers. 1. (A) Attempt any five : 20 Marks Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

High Institute of Computer Science & Information Technology Term : 1 st. El-Shorouk Academy Acad. Year : 2013 / Year : 2 nd

High Institute of Computer Science & Information Technology Term : 1 st. El-Shorouk Academy Acad. Year : 2013 / Year : 2 nd El-Shorouk Academy Acad. Year : 2013 / 2014 High Institute of Computer Science & Information Technology Term : 1 st Year : 2 nd Computer Science Department Object Oriented Programming Section (1) Arrays

More information

Sample Paper - II Subject Computer Science

Sample Paper - II Subject Computer Science Sample Paper - II Subject Computer Science Max Marks 70 Duration 3 hrs Note:- All questions are compulsory Q1) a) What is significance of My Computer? 2 b) Explain different types of operating systems.

More information

Ashish Gupta, Data JUET, Guna

Ashish Gupta, Data JUET, Guna Categories of data structures Data structures are categories in two classes 1. Linear data structure: - organized into sequential fashion - elements are attached one after another - easy to implement because

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS 1. Define global declaration? The variables that are used in more

More information

Sorting Algorithms. Selection Sort Algorithm

Sorting Algorithms. Selection Sort Algorithm Sorting Algorithms 015-016 Kirkuk Common problem: sort a list of values, starting from lowest to highest. List of exam scores, Words of dictionary in alphabetical order, Students names listed alphabetically,

More information

Sorting & Searching. Hours: 10. Marks: 16

Sorting & Searching. Hours: 10. Marks: 16 Sorting & Searching CONTENTS 2.1 Sorting Techniques 1. Introduction 2. Selection sort 3. Insertion sort 4. Bubble sort 5. Merge sort 6. Radix sort ( Only algorithm ) 7. Shell sort ( Only algorithm ) 8.

More information

wwwashekalazizwordpresscom Data Structure Test Paper 3 1(a) Define Data Structure Mention the subject matters of data structure The logical and mathematical model of a particular organization of data is

More information

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array?

Unit 1 - Arrays. 1 What is an array? Explain with Example. What are the advantages of using an array? 1 What is an array? Explain with Example. What are the advantages of using an array? An array is a fixed-size sequenced collection of elements of the same data type. An array is derived data type. The

More information

Sorting and Searching Algorithms

Sorting and Searching Algorithms Sorting and Searching Algorithms Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale tessema.mengistu@siu.edu Room - Faner 3131 1 Outline Introduction to Sorting

More information

Data Structures. Chapter 04. 3/10/2016 Md. Golam Moazzam, Dept. of CSE, JU

Data Structures. Chapter 04. 3/10/2016 Md. Golam Moazzam, Dept. of CSE, JU Data Structures Chapter 04 1 Linear Array A linear array is a list of finite number N of homogeneous data elements such that: The elements of the array are referenced respectively by an index set consisting

More information

DELHI PUBLIC SCHOOL TAPI

DELHI PUBLIC SCHOOL TAPI Loops Chapter-1 There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed

More information

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size];

Computer Programming. C Array is a collection of data belongings to the same data type. data_type array_name[array_size]; Arrays An array is a collection of two or more adjacent memory cells, called array elements. Array is derived data type that is used to represent collection of data items. C Array is a collection of data

More information

Arrays. Dr. Madhumita Sengupta. Assistant Professor IIIT Kalyani

Arrays. Dr. Madhumita Sengupta. Assistant Professor IIIT Kalyani Arrays Dr. Madhumita Sengupta Assistant Professor IIIT Kalyani INTRODUCTION An array is a collection of similar data s / data types. The s of the array are stored in consecutive memory locations and are

More information

4. SEARCHING AND SORTING LINEAR SEARCH

4. SEARCHING AND SORTING LINEAR SEARCH 4. SEARCHING AND SORTING SEARCHING Searching and sorting are fundamental operations in computer science. Searching refers to the operation of finding the location of a given item in a collection of items.

More information

Module 6: Array in C

Module 6: Array in C 1 Table of Content 1. Introduction 2. Basics of array 3. Types of Array 4. Declaring Arrays 5. Initializing an array 6. Processing an array 7. Summary Learning objectives 1. To understand the concept of

More information

To store the total marks of 100 students an array will be declared as follows,

To store the total marks of 100 students an array will be declared as follows, Chapter 4 ARRAYS LEARNING OBJECTIVES After going through this chapter the reader will be able to declare and use one-dimensional and two-dimensional arrays initialize arrays use subscripts to access individual

More information

Chapter 10 - Notes Applications of Arrays

Chapter 10 - Notes Applications of Arrays Chapter - Notes Applications of Arrays I. List Processing A. Definition: List - A set of values of the same data type. B. Lists and Arrays 1. A convenient way to store a list is in an array, probably a

More information

8/5/10 TODAY'S OUTLINE. Recursion COMP 10 EXPLORING COMPUTER SCIENCE. Revisit search and sorting using recursion. Recursion WHAT DOES THIS CODE DO?

8/5/10 TODAY'S OUTLINE. Recursion COMP 10 EXPLORING COMPUTER SCIENCE. Revisit search and sorting using recursion. Recursion WHAT DOES THIS CODE DO? 8/5/10 TODAY'S OUTLINE Recursion COMP 10 EXPLORING COMPUTER SCIENCE Revisit search and sorting using recursion Binary search Merge sort Lecture 8 Recursion WHAT DOES THIS CODE DO? A function is recursive

More information

KareemNaaz Matrix Divide and Sorting Algorithm

KareemNaaz Matrix Divide and Sorting Algorithm KareemNaaz Matrix Divide and Sorting Algorithm Shaik Kareem Basha* Department of Computer Science and Engineering, HITAM, India Review Article Received date: 18/11/2016 Accepted date: 13/12/2016 Published

More information

CSCE 110 PROGRAMMING FUNDAMENTALS. Prof. Amr Goneid AUC Part 7. 1-D & 2-D Arrays

CSCE 110 PROGRAMMING FUNDAMENTALS. Prof. Amr Goneid AUC Part 7. 1-D & 2-D Arrays CSCE 110 PROGRAMMING FUNDAMENTALS WITH C++ Prof. Amr Goneid AUC Part 7. 1-D & 2-D Arrays Prof. Amr Goneid, AUC 1 Arrays Prof. Amr Goneid, AUC 2 1-D Arrays Data Structures The Array Data Type How to Declare

More information

Chapter 3:- Divide and Conquer. Compiled By:- Sanjay Patel Assistant Professor, SVBIT.

Chapter 3:- Divide and Conquer. Compiled By:- Sanjay Patel Assistant Professor, SVBIT. Chapter 3:- Divide and Conquer Compiled By:- Assistant Professor, SVBIT. Outline Introduction Multiplying large Integers Problem Problem Solving using divide and conquer algorithm - Binary Search Sorting

More information

Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays)

Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) In this lecture, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of

More information

PERFORMANCE OF VARIOUS SORTING AND SEARCHING ALGORITHMS Aarushi Madan Aarusi Tuteja Bharti

PERFORMANCE OF VARIOUS SORTING AND SEARCHING ALGORITHMS Aarushi Madan Aarusi Tuteja Bharti PERFORMANCE OF VARIOUS SORTING AND SEARCHING ALGORITHMS Aarushi Madan Aarusi Tuteja Bharti memory. So for the better performance of an algorithm, time complexity and space complexity has been considered.

More information

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty!

calling a function - function-name(argument list); y = square ( z ); include parentheses even if parameter list is empty! Chapter 6 - Functions return type void or a valid data type ( int, double, char, etc) name parameter list void or a list of parameters separated by commas body return keyword required if function returns

More information

Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon

Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon Data Structures &Al Algorithms Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon What is Data Structure Data Structure is a logical relationship existing between individual elements

More information

MODULE 1. Introduction to Data Structures

MODULE 1. Introduction to Data Structures MODULE 1 Introduction to Data Structures Data Structure is a way of collecting and organizing data in such a way that we can perform operations on these data in an effective way. Data Structures is about

More information

DATA STRUCTURES/UNIT 3

DATA STRUCTURES/UNIT 3 UNIT III SORTING AND SEARCHING 9 General Background Exchange sorts Selection and Tree Sorting Insertion Sorts Merge and Radix Sorts Basic Search Techniques Tree Searching General Search Trees- Hashing.

More information

How to declare an array in C?

How to declare an array in C? Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous values.

More information

Q2: Write an algorithm to merge two sorted arrays into a third array? (10 Marks) Ans Q4:

Q2: Write an algorithm to merge two sorted arrays into a third array? (10 Marks) Ans Q4: Model Answer Benha University 1 st Term (2013/2014) Final Exam Class: 2 nd Year Students Subject: Data Structures Faculty of Computers & Informatics Date: 26/12/2013 Time: 3 hours Examiner: Dr. Essam Halim

More information

// array initialization. void main() { cout<<b[4]<<endl; cout<<b[5]<<endl; } Output is 9

// array initialization. void main() { cout<<b[4]<<endl; cout<<b[5]<<endl; } Output is 9 UNIT-2 DATA STRUCTURES A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. The data structure can be classified into following two types:

More information

MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Code: 17330 Model Answer Page 1/ 22 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model

More information

CS201- Introduction to Programming Current Quizzes

CS201- Introduction to Programming Current Quizzes CS201- Introduction to Programming Current Quizzes Q.1 char name [] = Hello World ; In the above statement, a memory of characters will be allocated 13 11 12 (Ans) Q.2 A function is a block of statements

More information

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples:

Data type of a pointer must be same as the data type of the variable to which the pointer variable is pointing. Here are a few examples: Unit IV Pointers and Polymorphism in C++ Concepts of Pointer: A pointer is a variable that holds a memory address of another variable where a value lives. A pointer is declared using the * operator before

More information

POINTERS - Pointer is a variable that holds a memory address of another variable of same type. - It supports dynamic allocation routines. - It can improve the efficiency of certain routines. C++ Memory

More information

Pointers, Dynamic Data, and Reference Types

Pointers, Dynamic Data, and Reference Types Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation The new operator The delete operator Dynamic Memory Allocation for Arrays 1 C++ Data Types simple

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2017 Spring Exam 3 Monday, April 17, 2017 Total - 100 Points B Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,

More information

CSCE 206: Structured Programming in C++

CSCE 206: Structured Programming in C++ CSCE 206: Structured Programming in C++ 2017 Spring Exam 3 Monday, April 17, 2017 Total - 100 Points A Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,

More information

SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION MAX MARKS:70 CODE - A DURATION : 3 Hours

SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION MAX MARKS:70 CODE - A DURATION : 3 Hours SBOA SCHOOL & JUNIOR COLLEGE, CHENNAI 101 COMPUTER SCIENCE CLASS: XI HALF YEARLY EXAMINATION 2016 MAX MARKS:70 CODE - A DURATION : 3 Hours All questions are compulsory. Do not change the order of the questions

More information

Computer Science & Engineering 150A Problem Solving Using Computers

Computer Science & Engineering 150A Problem Solving Using Computers Computer Science & Engineering 150A Problem Solving Using Computers Lecture 06 - Stephen Scott Adapted from Christopher M. Bourke 1 / 30 Fall 2009 Chapter 8 8.1 Declaring and 8.2 Array Subscripts 8.3 Using

More information

Downloaded from

Downloaded from Unit I Chapter -1 PROGRAMMING IN C++ Review: C++ covered in C++ Q1. What are the limitations of Procedural Programming? Ans. Limitation of Procedural Programming Paradigm 1. Emphasis on algorithm rather

More information

SRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS

SRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS SRI SARASWATHI MATRIC HR SEC SCHOOL PANAPAKKAM +2 IMPORTANT 2 MARK AND 5 MARK QUESTIONS COMPUTER SCIENCE VOLUME I 2 MARKS 1. How to work with multiple documents in StarOffice Writer? 2. What is meant by

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model answer and the answer written by candidate may

More information

DC104 DATA STRUCTURE JUNE Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

DC104 DATA STRUCTURE JUNE Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? The heterogeneous linked list contains different data types in its nodes and we need a link

More information

Looping statement While loop

Looping statement While loop Looping statement It is also called a Repetitive control structure. Sometimes we require a set of statements to be executed a number of times by changing the value of one or more variables each time to

More information

Lists (Section 5) Lists, linked lists Implementation of lists in C Other list structures List implementation of stacks, queues, priority queues

Lists (Section 5) Lists, linked lists Implementation of lists in C Other list structures List implementation of stacks, queues, priority queues (Section 5) Lists, linked lists Implementation of lists in C Other list structures List implementation of stacks, queues, priority queues By: Pramod Parajuli, Department of Computer Science, St. Xavier

More information

Programming 1. Lecture 6 Structured data types. Arrays

Programming 1. Lecture 6 Structured data types. Arrays Programming 1 Lecture 6 Structured data types. Arrays Objectives Understand the difference between simple and structured data types Manage the following structured data types: one-dimensional and two-dimensional

More information

UNIT III ARRAYS AND STRINGS

UNIT III ARRAYS AND STRINGS UNIT III ARRAYS AND STRINGS Arrays Initialization Declaration One dimensional and Two dimensional arrays. String- String operations String Arrays. Simple programs- sorting- searching matrix operations.

More information

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.

An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Data Structures Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure using C Model wer Subject Code: 22317 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given

More information

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE A6-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF

More information

Algorithm Efficiency & Sorting. Algorithm efficiency Big-O notation Searching algorithms Sorting algorithms

Algorithm Efficiency & Sorting. Algorithm efficiency Big-O notation Searching algorithms Sorting algorithms Algorithm Efficiency & Sorting Algorithm efficiency Big-O notation Searching algorithms Sorting algorithms Overview Writing programs to solve problem consists of a large number of decisions how to represent

More information

Before we start - Announcements: There will be a LAB TONIGHT from 5:30 6:30 in CAMP 172. In compensation, no class on Friday, Jan. 31.

Before we start - Announcements: There will be a LAB TONIGHT from 5:30 6:30 in CAMP 172. In compensation, no class on Friday, Jan. 31. Before we start - Announcements: There will be a LAB TONIGHT from 5:30 6:30 in CAMP 172 The lab will be on pointers In compensation, no class on Friday, Jan. 31. 1 Consider the bubble function one more

More information

PART I. Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++.

PART I.   Part II Answer to all the questions 1. What is meant by a token? Name the token available in C++. Unit - III CHAPTER - 9 INTRODUCTION TO C++ Choose the correct answer. PART I 1. Who developed C++? (a) Charles Babbage (b) Bjarne Stroustrup (c) Bill Gates (d) Sundar Pichai 2. What was the original name

More information

Sorting. Bringing Order to the World

Sorting. Bringing Order to the World Lecture 10 Sorting Bringing Order to the World Lecture Outline Iterative sorting algorithms (comparison based) Selection Sort Bubble Sort Insertion Sort Recursive sorting algorithms (comparison based)

More information

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011

CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 CSC 307 DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ SPRING 2011 Date: 01/18/2011 (Due date: 01/20/2011) Name and ID (print): CHAPTER 6 USER-DEFINED FUNCTIONS I 1. The C++ function pow has parameters.

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Principles of Programming. Chapter 6: Arrays

Principles of Programming. Chapter 6: Arrays Chapter 6: Arrays In this chapter, you will learn about Introduction to Array Array declaration Array initialization Assigning values to array elements Reading values from array elements Simple Searching

More information

FOR Loop. FOR Loop has three parts:initialization,condition,increment. Syntax. for(initialization;condition;increment){ body;

FOR Loop. FOR Loop has three parts:initialization,condition,increment. Syntax. for(initialization;condition;increment){ body; CLASSROOM SESSION Loops in C Loops are used to repeat the execution of statement or blocks There are two types of loops 1.Entry Controlled For and While 2. Exit Controlled Do while FOR Loop FOR Loop has

More information

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010

CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011. MIDTERM EXAMINATION Spring 2010 CS201- Introduction to Programming Latest Solved Mcqs from Midterm Papers May 07,2011 Lectures 1-22 Moaaz Siddiq Asad Ali Latest Mcqs MIDTERM EXAMINATION Spring 2010 Question No: 1 ( Marks: 1 ) - Please

More information

ARRAY FUNCTIONS (1D ARRAY)

ARRAY FUNCTIONS (1D ARRAY) ARRAY FUNCTIONS (1D ARRAY) EACH QUESTIONS CARRY 2 OR 3 MARKS Q.1 Write a function void ChangeOver(int P[ ], int N) in C++, which re-positions all the elements of the array by shifting each of them to the

More information

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List in Data Structure By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List Like arrays, Linked List is a linear data

More information

Test points UTA Student ID #

Test points UTA Student ID # CSE Name Test points UTA Student ID # Multiple Choice. Write your answer to the LEFT of each problem. points each. Which of the following statements is true about HEAPSOT? A. It is stable.. It has a worse-case

More information

C/C++ Programming Lecture 18 Name:

C/C++ Programming Lecture 18 Name: . The following is the textbook's code for a linear search on an unsorted array. //***************************************************************** // The searchlist function performs a linear search

More information

Sample Paper -V Subject Computer Science Time: 3Hours Note. (i) All questions are compulsory. Maximum Marks: 70 Q.No.1 a. Write the header file for the given function 2 abs(), isdigit(), sqrt(), setw()

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

What is Pointer? Pointer is a variable that holds a memory address, usually location of another variable.

What is Pointer? Pointer is a variable that holds a memory address, usually location of another variable. CHAPTER 08 POINTERS What is Pointer? Pointer is a variable that holds a memory address, usually location of another variable. The Pointers are one of the C++ s most useful and powerful features. How Pointers

More information

a) State the need of data structure. Write the operations performed using data structures.

a) State the need of data structure. Write the operations performed using data structures. Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

CSCE 110 Notes on Recursive Algorithms (Part 12) Prof. Amr Goneid

CSCE 110 Notes on Recursive Algorithms (Part 12) Prof. Amr Goneid CSCE 110 Notes on Recursive Algorithms (Part 12) Prof. Amr Goneid 1. Definition: The expression Recursion is derived from Latin: Re- = back and currere = to run, or to happen again, especially at repeated

More information

CSE 230 Intermediate Programming in C and C++ Arrays and Pointers

CSE 230 Intermediate Programming in C and C++ Arrays and Pointers CSE 230 Intermediate Programming in C and C++ Arrays and Pointers Fall 2017 Stony Brook University Instructor: Shebuti Rayana http://www3.cs.stonybrook.edu/~cse230/ Definition: Arrays A collection of elements

More information

Data Structure for Language Processing. Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions

Data Structure for Language Processing. Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions Data Structure for Language Processing Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions INTRODUCTION: Which operation is frequently used by a Language Processor? Ans: Search. This

More information