0% found this document useful (0 votes)
100 views5 pages

191CSC303T - DS - Unit 1

A data structure defines how data is organized and related. Data types specify variable values, while data structures organize data using data types. Linear data structures include linked lists and arrays. Linked lists have dynamic memory allocation, while arrays have contiguous memory. Operations like insertion and deletion are more efficient on linked lists. A linked list contains nodes, where each node has a data field and pointer to the next node. Singly linked lists use a next pointer, while doubly linked lists use next and previous pointers. Polynomials can be represented using linked lists by creating a node for each term. Common linked list operations include insertion, deletion, traversal, and manipulation of polynomial terms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views5 pages

191CSC303T - DS - Unit 1

A data structure defines how data is organized and related. Data types specify variable values, while data structures organize data using data types. Linear data structures include linked lists and arrays. Linked lists have dynamic memory allocation, while arrays have contiguous memory. Operations like insertion and deletion are more efficient on linked lists. A linked list contains nodes, where each node has a data field and pointer to the next node. Singly linked lists use a next pointer, while doubly linked lists use next and previous pointers. Polynomials can be represented using linked lists by creating a node for each term. Common linked list operations include insertion, deletion, traversal, and manipulation of polynomial terms.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

UNIT I - LINEAR DATA STRUCTURES -LIST

PART-A

1. What is called as a Data Structure?


A Data Structure defines a way of representing or organizing all data that contains both the data
items and their relationship with each other.

2. Differentiate between data type and data structures.


Data Type: Data Type of a variable is a set of values the variable may assume.
Eg. int, char & real
Data Structures: Data structure mean the way of organizing data values with the help of existing data
types.
Eg. Array, stack queue, & tree.

3. What are Primary Data Structures?


 Integers
 Floating-point numbers.
 Character Constants

4. What are the types of Secondary Data Structures?


 Static Data structures
 Dynamic Data structures.

5. What are the static data structures?


 Arrays
 Structures

6. What are the types of dynamic data structures?


 Linear Data Structures
 Non-Linear Data Structures

7. Give examples of Linear and Non-Linear Data Structures.


Linear Data Structures
 Linked Lists(Singly & Doubly Linked Lists)
 Circular Linked Lists (Circular-singly&Circular-doubly Linked Lists).
Non-Linear Data Structures
 Trees
 Graphs.

8. What do you mean by Abstract Data Types?


Classes encapsulate all the essential properties of the objects that are to be created. Since the classes
use the concept of data abstraction, they are known as Abstract Data Types (ADT).

9. List the operation of set ADT?


Union and Find are the two operations on set ADT
10. Give some applications of stack.
 Evaluation of Expressions
 Expression conversion
 Balancing of symbols
 Function Calls

11. Define Dequeue.


A dequeue is an ordered list in which additions and deletions may be carried out at either end.

12. State the difference between cursor and pointers.


 Pointer: Pointer is a variable, which stores the address of another variable.
 Using pointers, memory can be allocated dynamically.
 Cursor: Cursor is a temporary memory space. Memory allocated is static.

13. What is an ordered list?


An ordered list is a linear list which is been ordered by some key.
Eg. An alphabetized list of students in a class, a list of exam scores in decreasing order.
14. State the difference between array and linked list.

Array Linked List

Contiguous memory location Memory location need not be necessarily


contiguous
Operations such as insertion and Insertion and deletions are easier and
deletion are ineffective since the needs only one pointer assignment.
memory locations need to be moved
up and down respectively.
Inefficient use of memory space. A small amount of memory is been
wasted for storing a pointer, which is
been associated with each node.

15. What are the advantages and disadvantages of linked list?


Advantages:
 Memory location for a linked list is dynamic, that is memory allocation is done during run
time. So memory will not be wasted.
 Data movements during insertion and deletion will be eliminated. So time will not be wasted.
 Memory allocation for each node of a linked list need not be continuous.

Disadvantages:
 Nodes of a linked list cannot be accessed directly. To access a particular node accessing
should start only from the beginning.
 To store a single data, along with data, memory must be allocated for a pointer also, which
wastes memory.
16. Write the steps required to evaluate the postfix expression.
 Repeatedly read characters from postfix expression
 If the character read is an operand, push the value associated with it into the stack
 If it is an operator, pop the top two values from stack, apply the operator to them and push the
result back onto the stack.

17. Define Singly Linked List.


A singly linked list is a list structure in which each node contains a single pointer field that points to
the next node in the list, along with a data field.

18. Define Doubly Linked List.


A doubly linked list is a list structure in which each node contains two pointer fields along with a
data field namely,
BLINK – Points to the previous node in the list
FLINK – Points to the successive node in the list

19. What are the disadvantages of linked list over array? (NOV/DEC 2018)
 Random access is not allowed. We have to access elements sequentially starting from the first node.
So we cannot do a binary search with linked lists.
 Extra memory space for a pointer is required with each element of the list.
 Arrays have better cache locality that can make a pretty big difference in performance.

20. State the advantage of ADT? (NOV/DEC 2018) (April/May 2018)


 Abstraction: the user of a type does not need to know or understand any implementation details of the
type, which reduces the complexity of the programming task.
 Localization of errors: if there are errors either in the representation or implementation of the type, the
errors are local to the ADT, and cannot be caused by code that uses the type.
 Localization of changes: if the programmer decides to change the representation of a type (e.g., to
change the representation of a set from a list of elements to a bit vector), then only the implementation
of the ADT need be changed; code that uses the type is not affected.

21. What are the disadvantages of using simple array implementation of lists? (April/May
2018)

22.
PART-B

1. Design a routine to delete an element in a linked list.


2. Develop an algorithm for insertion operation in a singly linked list.
3. Describe in detail about Polynomial manipulation in linked list.
4. What is a linked list? Describe the suitable routine segments for any four operations.
5. Examine the algorithms to implement the doubly linked list and perform all the operations on the
created list.
6. Identify the array implementation of list and show all its operation.
7. Discuss the creation of a doubly linked list and appending the list. Give relevant coding in C.
8. Write C code for singly linked list with insert, delete, display operations using structure pointer.
9. Differentiate single linked list and doubly linked list with an example.
10. Explain the application of linked list in detail.
11. Consider an array A[1: n] Given a position, write an algorithm to insert an element in the Array. If
the position is empty, the element is inserted easily. If the position is already occupied the element
should be inserted with the minimum number of shifts.(Note: The elements can shift to the left or to
the right to make the minimum number of moves).
12. Analyze and write C code for circular linked list with create, insert, delete, display operations.
13. Explain the various operations of the list ADT with examples.
14. Analyze the doubly linked list and circular linked list. Mention its advantages and disadvantages.
15. Explain the steps involved in insertion and deletion into a singly linked list.
16. Recommend an algorithm to add two polynomials when the polynomials are represented singly
linked lists.
17. Compose an algorithm to Reverse the elements of a single linked lists, count the number of nodes in
a given singly linked list. Searching the element from linked list.
18. Given a list 10,20,30,40 generalize the steps to delete a node from the beginning of the linked list,
deletion of last node in a deletion of middle node in a list.
19. Develop a C program to split a linked list into sub lists containing odd and even ordered elements in
them respectively.
20. What is the way to insert a node in linked list? Write down an algorithm for inserting a node before a given
node in linked list. (NOV/DEC 2018)
21. Write a procedure to deleting the last node from circular linked list. (NOV/DEC 2018)
22. What are the various operation on array? Write a procedure to insert an element in middle of the array.
(NOV/DEC 2018)
23. State the polynomial representation for 6x3+9x2+7x+1 using linked list. Write procedure to add and multiply
two polynomial and explain with suitable example. (NOV/DEC 2018)
24. Give the algorithm for inserting an element and deleting an element in a linked List (APRIL/MAY2011)
(NOV/DEC 2012)
25. Implement Singly Linked List with insert, delete and display operations. Trace your code for inserting
1,2,3,4,5 in an initially empty singly linked list, delete 4 .And then display the remaining values in the list.
(April/May 2018)
26. Discuss how to represent single-variable polynomials using linked lists. Provide C program to add two
polynomials. With an example show that your code works. (April/May 2018)

You might also like