Data structures provide a structure for organizing data and are building blocks of programs. They can be categorized as primitive or non-primitive. Primitive data structures include basic types like numbers and characters while non-primitive structures like arrays, linked lists, stacks, queues, and trees require machine instructions to manipulate. Data structures store and organize data to aid retrieval and search operations. Their efficiency depends on factors like the number of operations required for different input sizes, which is expressed using mathematical functions to describe their best, average, and worst case time complexities.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0 ratings0% found this document useful (0 votes)
8 views3 pages
Algorithm Questions
Data structures provide a structure for organizing data and are building blocks of programs. They can be categorized as primitive or non-primitive. Primitive data structures include basic types like numbers and characters while non-primitive structures like arrays, linked lists, stacks, queues, and trees require machine instructions to manipulate. Data structures store and organize data to aid retrieval and search operations. Their efficiency depends on factors like the number of operations required for different input sizes, which is expressed using mathematical functions to describe their best, average, and worst case time complexities.
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 3
1. Define Data Structure. Give some examples.
- building a blocks of any program or the Software.
-provides a structure set of variables that are associated with each other in different ways. Examples are: Arrays, Linked Lists, Stacks, Queue, and Trees.
2. In how many ways can you categorize data structures?
Explain each of them. -You can categorize it in 2 ways, Primitive and Non-Primitive Data Structures Primitive - consist of the numbers and the characters which are built in programs. These can be manipulated or operated directly by the machine level instructions. Non-Primitive- These data structures cannot be operated or manipulated directly by the machine level instructions.
3. Discuss the application of data structures.
- Storing list of data elements belonging to same data type - Auxiliary storage for other data structures -Storage of binary tree elements of fixed count -Storage of Matrices
4. Explain the different types of data structures. Also discuss
their merits and demerits. -Array -Linked List -Stacks -Queues -Trees -Graphs 5. What do you understand by a graph? -also known as Non-Linear Data Structures - each data elements is called vertex and connected to many other vertexes through connections called edges.
6. Define an algorithm. Explain its features with the help of
suitable examples.
-It is a step-by-step procedure, which defines a set of instructions
to be executed in a certain order to get the desired output.
-Clear and Unambiguous: Each of its steps should be clear in
all aspects and must lead to only one meaning. -Well-Defined Inputs: If an algorithm says to take inputs, it should be well defined inputs. -Well-Defined Outputs: Must clearly define what output will be yielded and it should be well-defined as well. Finiteness: Must be finite, it should not end up in an infinite loops or similar.
7. Explain and compare the approaches for designing an
algorithm. Top-Down Approach- Starts with identifying major components of system or program decomposing them into their lower level components and iterating until desire level of module complexity is achieved.
Button-Up Approach- starts with designing most basic or
primitive component & proceeds to higher level components. 8. What do you understand by the efficiency of an algorithm? - The efficiency of an algorithm is to count how many operations it needs in order to find the answer across different input sizes.
9. How will you express the time complexity of a given
algorithm? -Time complexity of an algorithm represent the amount of time required by the algorithm to run completion. - Time requirement can be defined as a numerical function T(n), where T(n) can be measured as the number of steps, provided each step consumes constant time.
10. Discuss the best case, worst case and average case complexity of an algorithm.
Best case Analysis- If the algorithm takes the least amount of
time to execute a specific set of input, then is called the best case time complexity.
Average case Analysis- provides necessary information about
an algorithm’s behavior on a typical random input.
Worst Case Analysis- If an algorithm takes maximum amount
of time to execute for a specific set of input, then it is called the worst case complexity.