[go: up one dir, main page]

0% found this document useful (0 votes)
24 views4 pages

Data Structure Notes

Data structures notes by me.
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)
24 views4 pages

Data Structure Notes

Data structures notes by me.
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/ 4

Q1) What is Data:

Ans. Data can be anything like, collection of facts, figures, symbols, or descriptions that can be
processed and analyzed to extract meaningful information.

Q2) What is Data Structure:

Ans. The data structure is a way to store and organize data so that it can be used efficiently.
The data structure is not any programming language like c,c++,java,python etc.
It is a set of algorithms that we can use in any programming language to structure data in memory.

Q3) What operations we can do on Data Structure:

Ans. 1. Insertion

• Adding a new element to the data structure.


Example: Adding a new student's name to a list.

2. Deletion

• Removing an existing element.


• Example: Deleting an item from your shopping cart.

3. Traversal

• Visiting each element one by one (often to display or process).


• Example: Printing all elements of an array.

4. Sorting (not always basic but very common)

• Arranging elements in a specific order (ascending/descending).


• Example: Sorting prices low to high on a shopping website.

5. Updation

• Modifying the value of an element.


• Example: Changing a student’s grade from B to A.

Q4) What are the types of Data Structure:

Ans. 1. Linear Data Structure:


- The arrangement of data in a sequential manner is known as linear data structure
The data strucures used for this purpose are Arrays,Linked lists,Stacks,Queues.
In this data structure one element is conneted to only one another element in the
linear form.
2. Non-Linear Data Structure:
- When one element is connected to the ‘n’ number of element is known
as Non-linear Data Structure. Eg. Trees and Graphs.
- in this case elements are arranged in a random manner.

Q5) What is Algorithm:

Ans. An algorithm is a step-by-step set of instructions to solve a problem or perform a


task.It is a set of rules required to perform or solve a problem.

Q6) What are the charecteristics of an algorithm:

Ans. 1. Input: An algorithm has some input values. We can take zero or some other input val
2. Output: It produces at least one result.
3. Finitness: An algorithm must have finiteness means limited number of introductions.
4. Effectiveness: All steps must be simple and can be done with basic operations.
5. Definiteness: Each step must be clear and unambiguous.

Q7) What is Pseudo Code:

Ans. Pseudocode is a simplified, human-readable way of writing an algorithm.


It looks like code but isn't written in any specific programming language — it's like writing
code in plain English with a programming style.
Eg.

START

Input number1

Input number2

sum ← number1 + number2

Print sum

END
Q8) Performance measurement of an Algorithms:

Ans. The performance of an algorithm tells us how efficient it is in terms of time and memory used.

There are two main ways to measure it:

1. Time Complexity:
Measures how long an algorithm takes to run as the input size increases.
It depends on the number of basic operations (like loops, comparisons).

2. Space Complexity:
Measures how much memory (RAM) an algorithm needs during execution.
Includes space for: a. Input Data
b. Temperory Variables.
c. Function calls (Like Recursion)

Q9) What is Asymptotic Notation?

Ans. Asymptotic Notation is a mathematical way to describe the performance (especially time or
space complexity) of an algorithm as the input size (n) becomes very large.
It helps compare algorithms based on how fast they grow, ignoring small inputs and constant factors.

Types of Asymptotic Notation:

1. Big O (o) – worst Case:

• Describes the maximum time an algorithm can take.


• Guarantees performance won’t be worse than this.

2. Omega (Ω) – Best Case:

• Describes the minimum time an algorithm will take.


• Useful when we want to know how fast it can be at best.

3. Theta (Θ) – Average / Exact Case:

• Describes the exact growth rate.


• Means both best and worst case are the same.
Q10) Explain Iterative and Recursive Algorithms:

Ans. 1. Iterative Algorithm:


An iterative algorithm uses loops (for, while) to repeat a set of instructions until a
condition is met.
Characteristics:

• Uses repetition
• Often uses less memory
• Generally faster in most cases
• Easier to understand for simple problems

2. Recursive Algorithm:
A recursive algorithm solves a problem by breaking it into smaller sub-
problems and calling itself to solve them.
Characteristics:

• Uses function calls


• Each call has its own memory (stack)
• Elegant for problems like trees, graphs, factorial, etc.
• Can lead to stack overflow if not handled properly

-By Sameer Pathan 2404065

You might also like