Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
SNS COLLEGE OF TECHNOLOGY COIMBATORE – 35 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING (UG & PG) First Year 2 Marks Question and Answer Subject Code & Name : 16IT101 / Advanced C Programming Class: I CSE B Prepared by: P.Poonkodi AP/CSE UNIT V 1. What is ADT? An abstract data type (ADT) is an object with a generic description independent of implementation details. This description includes a specification of the components from which the object is made and also the behavioural details of the object. Instances of abstract objects include mathematical objects (like numbers, polynomials, integrals, vectors), physical objects (like pulleys, floating bodies, missiles), animate objects (dogs, Pterodactyls, Indians) and objects (like poverty, honesty, inflation) that are abstract even in the natural language sense. 2. In order to define ADT what are needed to be specified? The components of an object of the ADT. A set of procedures that provide the behavioural description of objects belonging to the ADT. 3. What is list ADT and specify some of the ADT List Operations A list is a sequential data structure, ie. A collection of items accessible one after another beginning at the head and ending at the tail. 4. Creating a list Traversing the list Inserting an item in the list Deleting an item from the list Concatenating two lists into one What happens if you want to insert an item at a specified position in an existing array? Write over the current contents at the given index (which might not be appropriate), or The item originally at the given index must be moved up one position, and all the items after that index must shuffled up 5. 6. Advantages and disadvantages of array based implementation Advantage Fast, random access of elements Very memory efficient, very little memory is required other than that needed to store the contents Disadvantage Slow deletion and insertion of elements Size must be known when the array is created and is fixed (static) Describe about the linked list implementation and list its types A linked list is a linear data structure where each element is a separate object. Singly linked lists Circular linked lists Doubly linked lists 7. Explain about singly linked list Singly linked lists contain nodes which have a data part as well as an address part i.e. next, which points to the next node in sequence of nodes. The operations we can perform on singly linked lists are insertion, deletion and traversal. 8. Explain about doubly linked list In a doubly linked list, each node contains two links the first link points to the previous node and the next link points to the next node in the sequence. 9. Explain about circular linked list In the circular linked list the last node of the list contains the address of the first node and forms a circular chain. 10. How is linked list different from array? An array is a static data structure. This means the length of array cannot be altered at run time. While, a linked list is a dynamic data structure. In an array, all the elements are kept at consecutive memory locations while in a linked list the elements (or nodes) may be kept at any location but still connected to each other. 11. Explain about cursor based linked list If linked lists are required and pointers are not available, then an alternate implementation must be used. The alternate method we will describe is known as a cursor implementation.The two important items present in a pointer implementation of linked lists are The data is stored in a collection of structures. Each structure contains the data and apointer to the next structure. A new structure can be obtained from the system's global memory by a call to mallocand released by a call to free. Our cursor implementation must be able to simulate this. 12. Applications of list Linked lists are used to implement stacks, queues, graphs, etc. Linked lists let you insert elements at the beginning and end of the list. In Linked Lists we don’t need to know the size in advance. .