0% found this document useful (0 votes)
2 views3 pages

Data Structures QA Answers

The document defines key concepts in data structures, including data structures, abstract data types, time and space complexity, and sparse matrices applications. It also covers string functions, linear arrays operations, linked list characteristics, recursion, types of queries, and distinctions between trees and binary trees. Additionally, it explains graphs and hashing techniques.

Uploaded by

vinaygowda42479
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)
2 views3 pages

Data Structures QA Answers

The document defines key concepts in data structures, including data structures, abstract data types, time and space complexity, and sparse matrices applications. It also covers string functions, linear arrays operations, linked list characteristics, recursion, types of queries, and distinctions between trees and binary trees. Additionally, it explains graphs and hashing techniques.

Uploaded by

vinaygowda42479
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/ 3

1. Define Data Structures.

A data structure is a way of organizing and storing data so that it can be accessed and modified efficiently.

Common data structures include arrays, linked lists, stacks, queues, trees, and graphs.

2. What is abstract data type?

An Abstract Data Type (ADT) is a data type where only behavior (operations) is defined but not

implementation. Examples include Stack, Queue, List, etc. The implementation is hidden from the user.

3. What is Time and space complexity?

Time Complexity refers to the amount of time an algorithm takes to run as a function of the size of its input.

Space Complexity refers to the amount of memory space an algorithm uses as a function of the size of the

input.

Example: For linear search, time complexity is O(n).

4. Mention the applications of Sparse Matrices.

Sparse matrices are used when most of the elements in a matrix are zero. Applications include:

- Storing large graphs

- Image compression

- Network data storage

- Solving partial differential equations

5. Write any two built in functions of strings with syntax and example.

a) len() - returns length of string

Example:

s = "Hello"

print(len(s)) # Output: 5

b) upper() - converts string to uppercase

Example:
s = "hello"

print(s.upper()) # Output: HELLO

6. Mention the operations of linear arrays.

- Traversal - accessing elements one by one

- Insertion - adding an element

- Deletion - removing an element

- Searching - finding an element

- Updating - modifying an element

7. What are the characteristics of linked list?

- Dynamic memory allocation

- Each node contains data and a pointer to the next node

- Efficient insertion and deletion

- No memory wastage

- Linear data structure

8. Define Recursion.

Recursion is a technique where a function calls itself to solve smaller instances of the same problem.

Example:

def factorial(n):

if n == 0:

return 1

else:

return n * factorial(n-1)

9. Mention different types of queries.

- Select Query - to retrieve data

- Update Query - to modify data


- Insert Query - to add new data

- Delete Query - to remove data

- Join Query - to combine data from multiple tables

10. Distinguish between tree and binary Tree.

Tree:

- Can have any number of children

- General hierarchical structure

Binary Tree:

- At most two children (left and right)

- More specific structure

11. Define graph with an example.

A graph is a collection of nodes (vertices) and edges that connect pairs of nodes.

Example:

Vertices: A, B, C

Edges: (A-B), (B-C), (A-C)

12. What is Hashing?

Hashing is a technique to convert a given key into an index using a hash function. This index determines

where the data should be stored or retrieved from in a hash table.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy