Answer to the following questions: a. Explain what is an algorithm and part of a
ID: 3810808 • Letter: A
Question
Answer to the following questions: a. Explain what is an algorithm and part of a data structure is an algorithm? b. Why access to index in the array is faster than linked list (use the concepts of pointers to explain it)? c. What is the smallest addressable unit in the memory? d. Explain why you need pointer to create a linked list? Why you need to create the linked list in the dynamic memory? e. What is a friend function? f. Explain how an argument can be passed to a function? You need to explain how the parameter will be initialized and used in three cases.Explanation / Answer
a)
An Algorithm is finite set of instructions . We have to follow these instuctions in a certain order to get the desired output.
A data structure is a particular way of organizing and storing data ,it plays an important role in increasing the efficiency of an algorithm.
examples:- stack,queues,tree ,etc.
b) In array each element is independent where as in linked list address of current element is stored in the link part of previous element.Array supports random access so with the help of index we can directly access a particular element but linked list supports sequential access so we cannot access a particular element directly with the help of index.
c)
The smallest addressable unit in the memory is bit
e)
A friend function is a function that is given same access as methods to private and protected data.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.