Unit Write iterative and recursive C functions to find the greatest common divisor of two integers. [6]
|
|
- Gordon Shepherd
- 7 years ago
- Views:
Transcription
1 Unit 1 1. Write the following statements in C : [4] Print the address of a float variable P. Declare and initialize an array to four characters a,b,c,d. 2. Declare a pointer to a function f which accepts integer as parameter and dose not return anything. 3. Read a string which will contain only alphabets. 4. Write a C program using pointers and functions to: [6] i. Read a string ii. Append a string to another string iii. Copy a string to another string. 5. Write iterative and recursive C functions to find the greatest common divisor of two integers. [6] 6. What is pointer in C? Write the output of the following code: [6] main() static int a[]=10,20,30,40,50; int *ptr=a; static int arr[2][2]=1,2,3,4; char str[]= ABCD * 4# ; char *s= str+2; int I,j; for(i=0;i<5,i++) printf( %d, * ptr++); for (i=0;i<2;i++) for(j=0;j<2;j++) printf( %d \,n, *(*(n+i)+j)); printf( %c\n%c\n%c\n, *(str + 2),*s++,*--s);
2 7. Write a C program to count the number of special characters and lines in a text file and append it to same file. [6] 8. Differentiate between the following: [4] (i) Call by value and call by reference (ii) Structure and union. 9. What is similarity between structure, union and enumeration? [6] 10. What is Macro? What are its advantages and disadvantages. [6] 11. Write a C program to interchange two variables without using third variable. [4] 12. Describe about storage allocation and scope global, extern, static, local and register variables. [8] 13. What do you mean by type- definition? Explain with example. [4] 14. Determine output of the following C statement: [4] main() int x=10,y=5,p,q; P=x>9; q=x>3 && y!=3; printf( p=% d,q= % d,p,q); main() int x; X= *8/5%10; printf( x=%d,x); 15. Write a recursive function to display nth element in Fibonacci series. With the help of stack contents give a trace of Fibonacci function by you for n=6; [6] 16. Explain the following with example with respect to files in C :[10] i. Fread ii. Fwrite iii. Fseek iv. Ftell v. Fopen 17. What is the difference between text files and binary files? [6]
3 18. Write C function to reverse the n numbers stored in one dimensional array. [5] 19. What is recursive function? Explain with example. [5] 20. Explain the following concept in C language with example.[8] (i)pointer (ii)call by value (iii)array of pointers (iv)structure 21. Write a C program to perform following operations on an array of integers of size n.using functions with parameters: [8] (i) Delete an element at a given position (ii) Count and display the prime numbers. 22. (a) Write output of code: [8] #include<stdio.h> #define N 5 int main( ) Int I,j,n=N; Int *p,list[]=10,20,30,40,50; Char name[][4]= ABC, BCD, CDE; Char (*q)[4]; P= &list[0]; Q=&name[0]; for(i=0;i<n;) print( %d \t %d \n,*(list+i++),*(p++)); for (j=0;j<3;j++) printf( %s \t %c\t%d\n,name[j],*(*(q)+j),name[j][0]); 23. Write a C program to read and store data about n machine parts in a file. The data of each machine part consists of a part
4 24. Machine part consist of a part number, name and quantity. Write a C function to display the total quantity of all parts and the part numbers having quantity less than given value.[8] 1. (a) Define the following terms: [4] Unit 2 i. Data structure ii. Pseudocode iii. Abstract data types iv. Big O notation 2. Write an algorithm to find the sum of integers in an array of size n and explain algorithm components with respect to your algorithm. [6] 3. Explain the classification of data structures with an example each [6]. 4. Give the basic statement constructs in an algorithm with example. [4] 5. Write iterative algorithm to find the factorial of a number. Determine the efficiency of your algorithm. [6] 6. Find the frequency count of each statement and each statement determine the time complexity of code given below: [6] Main() printf( %d,m); printf( %d,n); for (i=0;i<=m;i++) for(j=0;j<=n;j++) Count++; a+=b[count]; 7. Define Pointers? How do we declare the pointers?give its advantages. [6]
5 8. Diffrentiate between pass by reference and pass by value. [4] 9. Explain the effect of following statements: 1. int p,*p; 2. int q,*p=&q; 3. int(*p)++; 4. char *p; 5. int a=*p+5; 10. What is difference between null pointer and null macro? [6] 11. What are pointers really good for? [4] 12. What is recursion? Explain with example. [6] 13. Define algorithm? What are the characteristics of an algorithm? [6] 14. What is the frequency count of following: int fact(int n) int ans=1; while(n>=1) Ans=ans*n; N=n-1; Return(ans);. 15. Find out complexity? Explain linear,non linear data structure,static and dynamic data structure. [4] 16. What is abstract data types?write An ADT for an array? [6] 17. Find frequency count of each step in code: int i,j; for(i=1;i<=n;i++) for (j=1;j<=n;j++) C[i][j]=a[i][j]+b[i][j]; 18. Explain Big O,Sigma and theta notation with example? [4]
6 19. Explain the following terms with example: i. Static data structure ii. Omega notation iii. Flow charts iv. Data object 20. Write an algorithm to find sum of odd and even int in an array of integers of size n. [8] 21. Determine the efficiency of algorithm for finding minimum number from list using frequency count. [8] 22. Give the classification of data structures with respect to memory allocation and relation between elements. [8] Unit 3 1. Write an ADT for polynomial. Write pseudocode for 2-polynomial addition using arrays. Find out time complexity of it. [12] 2. Derive the formula to calculate the address of the element in one-dimensional and twodimensional array using row major representation. [6] 3. Explain the steps of fast transpose algorithm for getting the transpose of sparse matrix having maximum m rows and n columns. What is the time complexity and space complexity of it? What are the advantages of fast transpose over simpletranspose? [10] 4. Write an ADT for sparse matrix. [4] 5. What is row major and column major storage representation methods of an array? [4] 6. What is call by value and call by reference? Explain with one example for each. [8] 7. Write a C program to shift elements of an integer array one location ahead. Element present at last location of array should be shifted on first location of the array. Write separate functions for accepting array, shifting array, displaying array etc. [8] 8. Explain execution of the following code step by step and show the final output : [8] # include < stdio.h > void display (int); int main( ) int x = 4;
7 display (x); return 0; void display (int n) if (n > 0) display (n 1); printf ( %d, n); 9. Write a C program to implement a structure for automobile part with data members part number, part name, quantity etc. Write separate functions for initializing structure, updating structure, displaying structure etc. [8] 10. Wtite polynomial as ADT.Represent the following polynomials using Array: 5x 11. Write Psedo C algorithm to find the fast transpose of a sparse matrix.analyse the time complexity of the algorithm.[6] 12. Derive the address calculation formula for multidimentional array, A[u1][u2]..[un] in row major and coloumn majior representation.[6] 13. Justify array as a linear data structure.write ADT for an array[6] 14. Write psedo c algorithm to add two polynomials represented using array and analyse the time complexity[6] 15. Explain the representation of sparse matrix with an example and state its advantages.[6] 16. Define time and space complexity of an algorithm[6] 17. Explain with the example linear data structure[6] 18. Define the following terms: [4] (i)data object (ii)data type 19. What is an abstract data type? [2] 20. Define data structure.what are different types of data structure? Explain.[8]
8 21. Explain different asymptotic notation.[4] 22. What do you mean by frequency count and its importance in the analysis of algorithm[6] UNIT 4 1. Write pseudocode for searching an element in a given array using linear search. What is the time complexity of linear search in best case, average case and worst case? Explain with example. [8] 2. Write a pseudocode for quicksort to sort a given array of n numbers. Show the contents of an array after each iteration for the following array : What is worst case and average case time complexity of quicksort? [8] 3. Write an algorithm for shell sort. Apply your algorithm to sort the following numbers in ascending order. Show the contents of an array after every iteration : What is time and space complexity of shell sort? [8] 4. Write pseudocode for Fibonacci search. Apply your algorithm on the following data to search numbers : 9, 100, 10. [8] Explain Generalized Linked List (GLL) with node structure in C. Represent the following using GLL : (a, b, c, (d, (e, f, c)), g), h, i). [10] 6. Write a function to create singly linked list which is sorted while creation. [6] 7. Explain in detail the concept of data object, data structures, linear data structure and nonlinear data structure. [8] 8. What is Asymptotic notation? Write an algorithm for matrix multiplication for n n matrix and find out its time complexity by frequency count. [8] 9. What is Abstract Data Type (ADT)? Write an abstract data type for linked list. [8]
9 10. Write an algorithm for Bubble sort. Find time complexity of the algorithm and express it using asymptotic notation. [8] 11. Sort the following numbers step by step by using Radix sort : [8] 20, 15, 21, 06, 08, 05, 29, 02, 14, Write an algorithm for binary search and find out its time complexity. [8] 13. Explain with one example index sequential search. [8] 14. Write a C program to implement quicksort. [8] 15. Give any two application of sorting and searching.[4] 16. Write psedo c algorithm for merge sort and determin its time Complexity.[6] 17. write psedo c algorithm to search an element using binary search and analyze its time complexity for best and worst cases.[6] 18. Write psedo C algorithm for insertion sort and determine its time complexity [6]. 19. Write the contents of list and each bucket,after each pass radix sort for the following list of numbers: 10,2,15,246,37,4,25,62,100,17. [6] 20. What is sort efficiency and sort stability?[4] 21. Compare the selection sort and inserton sort with respective to: [8] (i) Time Complexity (ii)passes(iii) Storage requirement (iv) Sort stability 22. Sort the following data in asending order using quick sort Show all passes with pivot: 56,12,84,56,28,0,-13,47,94,31 [8] 23. Write the different application of sorting methods.[6] 24. Write psedo code for binary search with recursion.[6] 25. What is bubble sort? Explain with example [4] Unit 5 1. Explain Generalized Linked List (GLL) with node structure in C. Represent the following using GLL : (a, b, c, (d, (e, f, c)), g), h, i). [10] 2. Write a function to create singly linked list which is sorted while creation. [6] 3. Represent the following polynomial equation in Generalized Linked List (GLL) :
10 10x4y10z3 + 4x7y10z3 + 5x7y10z3 + x3y10z2 + 8x3y10z2 + 8y10. Also give the importance of the tag field in this representation. [8] 4. Write short note on garbage collection and compaction. [4] 5. Write a function to display the singly linked list in reverse without creating new. [4] 6. Show how a two-dimensional array is stored in memory. Assume that array start at the address [4] 7. Explain how a polynomial is represented using array with one example. [5] 8. Write an algorithm for fast transpose of sparse matrix and find out its time complexity. [9] 9. Write a C program to implement polynomial using array and perform its multiplication. (Write separate functions for accepting polynomial, multiplication, display). [10] 10. What is sparse matrix? Explain with one example. [4] 11. (ii) What is address of element arr[4] [3] in the array arr of size 6 6 and type integer, when arr is represented using row major and column major representations? Assume array arr starts at the address What is static memory allocation and dynamic memory allocation? [4] 13. Compare doubly linked list and circular linked list. [4] 14. Write an algorithm to delete and insert a node in doubly linked list at any position. [8] 15. What is skep list? Explain with one example. [4] 16. Draw GLL for the following expression : [4] (a, b, (c, d, (e, f), g, (h, i), ((j, k)), l), m) 17. What a C program to implement circular linked list and display the contents in reverse order. (Write separate functions for create and display) [8] 18. What do you mean by dynamic memory allocation?how is it done in c?[4] 19. Write c Function for create, insert at end,delete a given node and display list,operations on a singly linked list.[6] 20. Write a C function to concatenate two circular linked list.[6] 21. Represent the following polynomial using circular linked list: (i)12x 6-2x 5-3x + 10 (ii)3x7 + 5x 2 + 2x [4] 22. What is Doubly linked list? Explain any two application of doubly linked list.[6]
11 23. Write C function for the following operations by choosing appropriate linked list: (i)to search a given element in list (ii) to traverse the list from any node. 24. Represent the following polynomial using arrays: (i)x 3 + 2xy 5 - y 3 y +x (ii)5x 2-10xy-y Write a short note on Storage representation of order list.[6] 26. Write Pseudo C algorithm for addition of two polynomials [8] 27. Explain with the example simple and fast transpose [8] Unit 6 1. Write a short note on Josephus problem. [4] 2. Write an ADT for stack. [4] 3. Convert the following infix expression into postfix expression by showing the contents of stack for every iteration : ((A/B Ù C) + (D * E)) (A * F)). Evaluate the postfix expression obtained for A = 9, B = 3, C = 2, D = 3, E = 17, F = 3. [10] 4. List any four applications of stack and explain any one of them. [4] 5. Explain the concept of multistack with example. [4] 6. Convert the following postfix expression to infix and prefix using stack. Show the contents of stack at every stage : abcde Evaluate given postfix expression for a = 50, b = 3, c = 4, d = 2, e = 1. [10]. 7. Sort the following numbers step by step by using Radix sort : [8] 20, 15, 21, 06, 08, 05, 29, 02, 14, Write an algorithm for binary search and find out its time complexity. [8] 9. Define stack.write algorithms for operation on a stack represented using array.[6] 10. Write pseudo C algorithms for operation on a stack represented using array[6] 11. Write psedo c algorithm to convert infix expression to postfix expression using linked stack.[6] 12. Write a c function to reverse a given string using stack. check a given is palindrome or not, using this function.[6]
12 13. Define queue.write linear queue as ADT using linked organization.[6] 14. How the circular queue solves the problem in linear queue?give the representation of circular queue using array and linked list.[6] 15. Write short note on the following: [6] (i) Queue Simulation (ii) Priority Queue 16. Write C pseudo code to insert and delete an element from singly linked list [6] 17. compare linked list with arrays with reference to the following aspects: (i) accessing any element randomly (ii) insertion and deletion of an element (iii) utilization of computer [6] 18. Discuss the application of circular singly linked list in detail[6] 19. Write comparison between sequential linked organization with linked organization [6] 20. Represent the following GLL: (i) G=((a,b)((c,d),e)) (ii)(p,q(r,s(t,u,v),w)x,u)[6] 21. Write C function that removes all duplicates element from SLL.[6]
DATA STRUCTURES USING C
DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give
More information10CS35: Data Structures Using C
CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a
More informationPES Institute of Technology-BSC QUESTION BANK
PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions
More informationData Structure [Question Bank]
Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:
More informationKrishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C
Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate
More information1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++
Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The
More informationGUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. Course Curriculum. DATA STRUCTURES (Code: 3330704)
GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT Course Curriculum DATA STRUCTURES (Code: 3330704) Diploma Programme in which this course is offered Semester in which offered Computer Engineering,
More information5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.
1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The
More informationCOMPUTER SCIENCE. Paper 1 (THEORY)
COMPUTER SCIENCE Paper 1 (THEORY) (Three hours) Maximum Marks: 70 (Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time) -----------------------------------------------------------------------------------------------------------------------
More informationDEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING LESSON PLAN
ERODE SENGUNTHAR ENGINEERING COLLEGE (Approved by AICTE, New Delhi, Permanently Affiliated to Anna University - Chennai & Accredited by NAAC & National Board of Accreditation (NBA), New Delhi, Accredited
More informationAP Computer Science AB Syllabus 1
AP Computer Science AB Syllabus 1 Course Resources Java Software Solutions for AP Computer Science, J. Lewis, W. Loftus, and C. Cocking, First Edition, 2004, Prentice Hall. Video: Sorting Out Sorting,
More informationAP Computer Science Java Mr. Clausen Program 9A, 9B
AP Computer Science Java Mr. Clausen Program 9A, 9B PROGRAM 9A I m_sort_of_searching (20 points now, 60 points when all parts are finished) The purpose of this project is to set up a program that will
More informationSample Questions Csci 1112 A. Bellaachia
Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k
More informationKITES TECHNOLOGY COURSE MODULE (C, C++, DS)
KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL
More informationAnalysis of a Search Algorithm
CSE 326 Lecture 4: Lists and Stacks 1. Agfgd 2. Dgsdsfd 3. Hdffdsf 4. Sdfgsfdg 5. Tefsdgass We will review: Analysis: Searching a sorted array (from last time) List ADT: Insert, Delete, Find, First, Kth,
More informationML for the Working Programmer
ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming
More informationQuestions 1 through 25 are worth 2 points each. Choose one best answer for each.
Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in
More informationBCS2B02: OOP Concepts and Data Structures Using C++
SECOND SEMESTER BCS2B02: OOP Concepts and Data Structures Using C++ Course Number: 10 Contact Hours per Week: 4 (2T + 2P) Number of Credits: 2 Number of Contact Hours: 30 Hrs. Course Evaluation: Internal
More informationB.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011
NEW Detailed Syllabus of B.Sc.(Computer Science) and B.Sc.(IT) Effective From July 2011 SEMESTER SYSTEM Scheme & Syllabus for B.Sc. (CS) Pass and Hons. Course Effective from July 2011 and onwards CLASS
More informationSyllabus for Computer Science. Proposed scheme for B.Sc Programme under Choice Based Credit System
Syllabus for Computer Science Proposed scheme for B.Sc Programme under Choice Based Credit System SEMESTER - I Code Course Title Course Type HPW Credits BS106 SEMESTER -I I BS 206 SEMESTER -III BS 301
More informationData Structures. Level 6 C30151. www.fetac.ie. Module Descriptor
The Further Education and Training Awards Council (FETAC) was set up as a statutory body on 11 June 2001 by the Minister for Education and Science. Under the Qualifications (Education & Training) Act,
More informationBinary Heap Algorithms
CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell
More informationData Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010
Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010 Problem 1. In each of the following question, please specify if the statement
More informationCHAPTER 4 ESSENTIAL DATA STRUCTRURES
CHAPTER 4 ESSENTIAL DATA STRUCTURES 72 CHAPTER 4 ESSENTIAL DATA STRUCTRURES In every algorithm, there is a need to store data. Ranging from storing a single value in a single variable, to more complex
More informationBangalore University B.Sc Computer Science Syllabus ( Semester System)
Bangalore University B.Sc Computer Science Syllabus ( Semester System) First Semester CSIT1: Computer Fundamentals and C Programming CSIP1: C Programming Lab Second Semester CSIIT1: Data Structures and
More informationCOMPUTER SCIENCE 1999 (Delhi Board)
COMPUTER SCIENCE 1999 (Delhi Board) Time allowed: 3 hours Max. Marks: 70 Instructions: (i) All the questions are compulsory. (ii) Programming Language: C++ QUESTION l. (a) Why main function is special?
More information1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.
1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated
More informationI PUC - Computer Science. Practical s Syllabus. Contents
I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations
More informationAbstract Data Type. EECS 281: Data Structures and Algorithms. The Foundation: Data Structures and Abstract Data Types
EECS 281: Data Structures and Algorithms The Foundation: Data Structures and Abstract Data Types Computer science is the science of abstraction. Abstract Data Type Abstraction of a data structure on that
More informationLab Manual. Data Structures (Pr): COT-213 Data Structures (P): IT-215
Lab Manual Data Structures (Pr): COT-213 Data Structures (P): IT-215 !" #$%&'() * +, -. 951/6201617535973417*37311 235678976: ;7A
More informationBasic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
More informationTo My Parents -Laxmi and Modaiah. To My Family Members. To My Friends. To IIT Bombay. To All Hard Workers
To My Parents -Laxmi and Modaiah To My Family Members To My Friends To IIT Bombay To All Hard Workers Copyright 2010 by CareerMonk.com All rights reserved. Designed by Narasimha Karumanchi Printed in
More informationIntroduction to Data Structures
Introduction to Data Structures Albert Gural October 28, 2011 1 Introduction When trying to convert from an algorithm to the actual code, one important aspect to consider is how to store and manipulate
More informationData Structure with C
Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which
More informationStack & Queue. Darshan Institute of Engineering & Technology. Explain Array in detail. Row major matrix No of Columns = m = u2 b2 + 1
Stack & Queue Explain Array in detail One Dimensional Array Simplest data structure that makes use of computed address to locate its elements is the onedimensional array or vector; number of memory locations
More informationWhat Is Recursion? Recursion. Binary search example postponed to end of lecture
Recursion Binary search example postponed to end of lecture What Is Recursion? Recursive call A method call in which the method being called is the same as the one making the call Direct recursion Recursion
More informationLecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists
Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse
More informationData Structures and Data Manipulation
Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval
More informationBinary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R
Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent
More informationPseudo code Tutorial and Exercises Teacher s Version
Pseudo code Tutorial and Exercises Teacher s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy
More informationThe Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!
The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >
More informationAtmiya Infotech Pvt. Ltd. Data Structure. By Ajay Raiyani. Yogidham, Kalawad Road, Rajkot. Ph : 572365, 576681 1
Data Structure By Ajay Raiyani Yogidham, Kalawad Road, Rajkot. Ph : 572365, 576681 1 Linked List 4 Singly Linked List...4 Doubly Linked List...7 Explain Doubly Linked list: -...7 Circular Singly Linked
More informationLecture 12 Doubly Linked Lists (with Recursion)
Lecture 12 Doubly Linked Lists (with Recursion) In this lecture Introduction to Doubly linked lists What is recursion? Designing a node of a DLL Recursion and Linked Lists o Finding a node in a LL (recursively)
More informationObjected oriented Programming: C++ Unit 1 1. Introduction 1.1. Introduction to Object Oriented Programming. 1.2. C++ fundamentals.
Gujarat University Choice Based Credit System (CBCS) Syllabus for B. Sc. Semester III (Computer Science) COM 201: DATA STRUCTURE USING C++ (Theory) Hours: 4 /week Credits: 4 Objected oriented Programming:
More informationModule 2 Stacks and Queues: Abstract Data Types
Module 2 Stacks and Queues: Abstract Data Types A stack is one of the most important and useful non-primitive linear data structure in computer science. It is an ordered collection of items into which
More informationQuiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s
Quiz 4 Solutions Q1: What value does function mystery return when called with a value of 4? int mystery ( int number ) { if ( number
More informationPART-A Questions. 2. How does an enumerated statement differ from a typedef statement?
1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members
More informationClass Overview. CSE 326: Data Structures. Goals. Goals. Data Structures. Goals. Introduction
Class Overview CSE 326: Data Structures Introduction Introduction to many of the basic data structures used in computer software Understand the data structures Analyze the algorithms that use them Know
More informationCommon Data Structures
Data Structures 1 Common Data Structures Arrays (single and multiple dimensional) Linked Lists Stacks Queues Trees Graphs You should already be familiar with arrays, so they will not be discussed. Trees
More informationStacks. Linear data structures
Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations
More informationJava Software Structures
INTERNATIONAL EDITION Java Software Structures Designing and Using Data Structures FOURTH EDITION John Lewis Joseph Chase This page is intentionally left blank. Java Software Structures,International Edition
More information6. Standard Algorithms
6. Standard Algorithms The algorithms we will examine perform Searching and Sorting. 6.1 Searching Algorithms Two algorithms will be studied. These are: 6.1.1. inear Search The inear Search The Binary
More informationLinked Lists, Stacks, Queues, Deques. It s time for a chainge!
Linked Lists, Stacks, Queues, Deques It s time for a chainge! Learning Goals After this unit, you should be able to... Differentiate an abstraction from an implementation. Define and give examples of problems
More informationSources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
More informationPROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON
PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London
More informationCurriculum Map. Discipline: Computer Science Course: C++
Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code
More informationSorting Algorithms. Nelson Padua-Perez Bill Pugh. Department of Computer Science University of Maryland, College Park
Sorting Algorithms Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park Overview Comparison sort Bubble sort Selection sort Tree sort Heap sort Quick sort Merge
More informationLecture 11 Array of Linked Lists
Lecture 11 Array of Linked Lists In this lecture Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for Sparse Matrix Exercises Solutions An Array of Linked
More informationEmbedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
More informationAlgorithms and Data Structures Exercise for the Final Exam (17 June 2014) Stack, Queue, Lists, Trees, Heap
Algorithms and Data Structures Exercise for the Final Exam (17 June 2014) Stack, Queue, Lists, Trees, Heap Singly linked list (1) Data about exam results are stored into a singly linked list. Each list
More information7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
More informationOutput: 12 18 30 72 90 87. struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr;
50 20 70 10 30 69 90 14 35 68 85 98 16 22 60 34 (c) Execute the algorithm shown below using the tree shown above. Show the exact output produced by the algorithm. Assume that the initial call is: prob3(root)
More informationAlgorithms and Abstract Data Types
Algorithms and Abstract Data Types Informally, algorithm means is a well-defined computational procedure that takes some value, or set of values, as input and produces some other value, or set of values,
More informationWESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math
Textbook Correlation WESTMORELAND COUNTY PUBLIC SCHOOLS 2011 2012 Integrated Instructional Pacing Guide and Checklist Computer Math Following Directions Unit FIRST QUARTER AND SECOND QUARTER Logic Unit
More informationrecursion, O(n), linked lists 6/14
recursion, O(n), linked lists 6/14 recursion reducing the amount of data to process and processing a smaller amount of data example: process one item in a list, recursively process the rest of the list
More informationInformatica e Sistemi in Tempo Reale
Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)
More informationCSC148 Lecture 8. Algorithm Analysis Binary Search Sorting
CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)
More informationCSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential
More informationPROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE
PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :
More informationAlgorithms and Data Structures
Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2
More informationAlgorithms. Margaret M. Fleck. 18 October 2010
Algorithms Margaret M. Fleck 18 October 2010 These notes cover how to analyze the running time of algorithms (sections 3.1, 3.3, 4.4, and 7.1 of Rosen). 1 Introduction The main reason for studying big-o
More informationSorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)
Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse
More informationRecursion. Definition: o A procedure or function that calls itself, directly or indirectly, is said to be recursive.
Recursion Definition: o A procedure or function that calls itself, directly or indirectly, is said to be recursive. Why recursion? o For many problems, the recursion solution is more natural than the alternative
More informationA binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:
Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)
More informationFunctions Recursion. C++ functions. Declare/prototype. Define. Call. int myfunction (int ); int myfunction (int x){ int y = x*x; return y; }
Functions Recursion C++ functions Declare/prototype int myfunction (int ); Define int myfunction (int x){ int y = x*x; return y; Call int a; a = myfunction (7); function call flow types type of function
More information1. Relational database accesses data in a sequential form. (Figures 7.1, 7.2)
Chapter 7 Data Structures for Computer Graphics (This chapter was written for programmers - option in lecture course) Any computer model of an Object must comprise three different types of entities: 1.
More information12-6 Write a recursive definition of a valid Java identifier (see chapter 2).
CHAPTER 12 Recursion Recursion is a powerful programming technique that is often difficult for students to understand. The challenge is explaining recursion in a way that is already natural to the student.
More information1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.
Study Group 1 Variables and Types 1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. 2. What does the byte 00100110 represent? 3. What is the purpose of the declarations
More informationData Structures, Practice Homework 3, with Solutions (not to be handed in)
Data Structures, Practice Homework 3, with Solutions (not to be handed in) 1. Carrano, 4th edition, Chapter 9, Exercise 1: What is the order of each of the following tasks in the worst case? (a) Computing
More information/* File: blkcopy.c. size_t n
13.1. BLOCK INPUT/OUTPUT 505 /* File: blkcopy.c The program uses block I/O to copy a file. */ #include main() { signed char buf[100] const void *ptr = (void *) buf FILE *input, *output size_t
More informationAlgorithm Analysis [2]: if-else statements, recursive algorithms. COSC 2011, Winter 2004, Section N Instructor: N. Vlajic
1 Algorithm Analysis []: if-else statements, recursive algorithms COSC 011, Winter 004, Section N Instructor: N. Vlajic Algorithm Analysis for-loop Running Time The running time of a simple loop for (int
More informationSystem Software Prof. Dr. H. Mössenböck
System Software Prof. Dr. H. Mössenböck 1. Memory Management 2. Garbage Collection 3. Linkers and Loaders 4. Debuggers 5. Text Editors Marks obtained by end-term exam http://ssw.jku.at/misc/ssw/ 1. Memory
More informationCSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.
Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure
More informationMAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push) -----------------------------------------
=============================================================================================================================== DATA STRUCTURE PSEUDO-CODE EXAMPLES (c) Mubashir N. Mir - www.mubashirnabi.com
More informationAs previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets!
Encoding of alphanumeric and special characters As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets! Alphanumeric
More informationALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)
ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology) Subject Description: This subject deals with discrete structures like set theory, mathematical
More informationAn Introduction to Programming and Computer Science
An Introduction to Programming and Computer Science Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Software, Inc. Skylight Publishing Andover, Massachusetts Copyright 1998 by
More informationCoding Rules. Encoding the type of a function into the name (so-called Hungarian notation) is forbidden - it only confuses the programmer.
Coding Rules Section A: Linux kernel style based coding for C programs Coding style for C is based on Linux Kernel coding style. The following excerpts in this section are mostly taken as is from articles
More informationQueues Outline and Required Reading: Queues ( 4.2 except 4.2.4) COSC 2011, Fall 2003, Section A Instructor: N. Vlajic
Queues Outline and Required Reading: Queues ( 4. except 4..4) COSC, Fall 3, Section A Instructor: N. Vlajic Queue ADT Queue linear data structure organized according to first-in/first-out (FIFO) principle!
More informationMULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
More informationWhy? A central concept in Computer Science. Algorithms are ubiquitous.
Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online
More informationThe following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).
CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical
More information1 Abstract Data Types Information Hiding
1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content
More informationLINKED DATA STRUCTURES
LINKED DATA STRUCTURES 1 Linked Lists A linked list is a structure in which objects refer to the same kind of object, and where: the objects, called nodes, are linked in a linear sequence. we keep a reference
More informationThe C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
More informationA COMPARATIVE STUDY OF LINKED LIST SORTING ALGORITHMS
A COMPARATIVE STUDY OF LINKED LIST SORTING ALGORITHMS by Ching-Kuang Shene 1 Michigan Technological University Department of Computer Science Houghton, MI 49931-1295 shene@mtu.edu 1 Introduction Carraway
More informationData Structures. Topic #12
Data Structures Topic #12 Today s Agenda Sorting Algorithms insertion sort selection sort exchange sort shell sort radix sort As we learn about each sorting algorithm, we will discuss its efficiency Sorting
More informationUnordered Linked Lists
Unordered Linked Lists Derive class unorderedlinkedlist from the abstract class linkedlisttype Implement the operations search, insertfirst, insertlast, deletenode See code on page 292 Defines an unordered
More informationArrays. Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.
Arrays Atul Prakash Readings: Chapter 10, Downey Sun s Java tutorial on Arrays: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html 1 Grid in Assignment 2 How do you represent the state
More information